{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.QuickSight.Types.ScatterPlotCategoricallyAggregatedFieldWells
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.QuickSight.Types.ScatterPlotCategoricallyAggregatedFieldWells where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.DimensionField
import Amazonka.QuickSight.Types.MeasureField

-- | The aggregated field well of a scatter plot.
--
-- /See:/ 'newScatterPlotCategoricallyAggregatedFieldWells' smart constructor.
data ScatterPlotCategoricallyAggregatedFieldWells = ScatterPlotCategoricallyAggregatedFieldWells'
  { -- | The category field well of a scatter plot.
    ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [DimensionField]
category :: Prelude.Maybe [DimensionField],
    -- | The size field well of a scatter plot.
    ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
size :: Prelude.Maybe [MeasureField],
    -- | The x-axis field well of a scatter plot.
    --
    -- The x-axis is aggregated by category.
    ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
xAxis :: Prelude.Maybe [MeasureField],
    -- | The y-axis field well of a scatter plot.
    --
    -- The y-axis is aggregated by category.
    ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
yAxis :: Prelude.Maybe [MeasureField]
  }
  deriving (ScatterPlotCategoricallyAggregatedFieldWells
-> ScatterPlotCategoricallyAggregatedFieldWells -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScatterPlotCategoricallyAggregatedFieldWells
-> ScatterPlotCategoricallyAggregatedFieldWells -> Bool
$c/= :: ScatterPlotCategoricallyAggregatedFieldWells
-> ScatterPlotCategoricallyAggregatedFieldWells -> Bool
== :: ScatterPlotCategoricallyAggregatedFieldWells
-> ScatterPlotCategoricallyAggregatedFieldWells -> Bool
$c== :: ScatterPlotCategoricallyAggregatedFieldWells
-> ScatterPlotCategoricallyAggregatedFieldWells -> Bool
Prelude.Eq, Int -> ScatterPlotCategoricallyAggregatedFieldWells -> ShowS
[ScatterPlotCategoricallyAggregatedFieldWells] -> ShowS
ScatterPlotCategoricallyAggregatedFieldWells -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScatterPlotCategoricallyAggregatedFieldWells] -> ShowS
$cshowList :: [ScatterPlotCategoricallyAggregatedFieldWells] -> ShowS
show :: ScatterPlotCategoricallyAggregatedFieldWells -> String
$cshow :: ScatterPlotCategoricallyAggregatedFieldWells -> String
showsPrec :: Int -> ScatterPlotCategoricallyAggregatedFieldWells -> ShowS
$cshowsPrec :: Int -> ScatterPlotCategoricallyAggregatedFieldWells -> ShowS
Prelude.Show, forall x.
Rep ScatterPlotCategoricallyAggregatedFieldWells x
-> ScatterPlotCategoricallyAggregatedFieldWells
forall x.
ScatterPlotCategoricallyAggregatedFieldWells
-> Rep ScatterPlotCategoricallyAggregatedFieldWells x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ScatterPlotCategoricallyAggregatedFieldWells x
-> ScatterPlotCategoricallyAggregatedFieldWells
$cfrom :: forall x.
ScatterPlotCategoricallyAggregatedFieldWells
-> Rep ScatterPlotCategoricallyAggregatedFieldWells x
Prelude.Generic)

-- |
-- Create a value of 'ScatterPlotCategoricallyAggregatedFieldWells' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'category', 'scatterPlotCategoricallyAggregatedFieldWells_category' - The category field well of a scatter plot.
--
-- 'size', 'scatterPlotCategoricallyAggregatedFieldWells_size' - The size field well of a scatter plot.
--
-- 'xAxis', 'scatterPlotCategoricallyAggregatedFieldWells_xAxis' - The x-axis field well of a scatter plot.
--
-- The x-axis is aggregated by category.
--
-- 'yAxis', 'scatterPlotCategoricallyAggregatedFieldWells_yAxis' - The y-axis field well of a scatter plot.
--
-- The y-axis is aggregated by category.
newScatterPlotCategoricallyAggregatedFieldWells ::
  ScatterPlotCategoricallyAggregatedFieldWells
newScatterPlotCategoricallyAggregatedFieldWells :: ScatterPlotCategoricallyAggregatedFieldWells
newScatterPlotCategoricallyAggregatedFieldWells =
  ScatterPlotCategoricallyAggregatedFieldWells'
    { $sel:category:ScatterPlotCategoricallyAggregatedFieldWells' :: Maybe [DimensionField]
category =
        forall a. Maybe a
Prelude.Nothing,
      $sel:size:ScatterPlotCategoricallyAggregatedFieldWells' :: Maybe [MeasureField]
size = forall a. Maybe a
Prelude.Nothing,
      $sel:xAxis:ScatterPlotCategoricallyAggregatedFieldWells' :: Maybe [MeasureField]
xAxis = forall a. Maybe a
Prelude.Nothing,
      $sel:yAxis:ScatterPlotCategoricallyAggregatedFieldWells' :: Maybe [MeasureField]
yAxis = forall a. Maybe a
Prelude.Nothing
    }

-- | The category field well of a scatter plot.
scatterPlotCategoricallyAggregatedFieldWells_category :: Lens.Lens' ScatterPlotCategoricallyAggregatedFieldWells (Prelude.Maybe [DimensionField])
scatterPlotCategoricallyAggregatedFieldWells_category :: Lens'
  ScatterPlotCategoricallyAggregatedFieldWells
  (Maybe [DimensionField])
scatterPlotCategoricallyAggregatedFieldWells_category = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScatterPlotCategoricallyAggregatedFieldWells' {Maybe [DimensionField]
category :: Maybe [DimensionField]
$sel:category:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [DimensionField]
category} -> Maybe [DimensionField]
category) (\s :: ScatterPlotCategoricallyAggregatedFieldWells
s@ScatterPlotCategoricallyAggregatedFieldWells' {} Maybe [DimensionField]
a -> ScatterPlotCategoricallyAggregatedFieldWells
s {$sel:category:ScatterPlotCategoricallyAggregatedFieldWells' :: Maybe [DimensionField]
category = Maybe [DimensionField]
a} :: ScatterPlotCategoricallyAggregatedFieldWells) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The size field well of a scatter plot.
scatterPlotCategoricallyAggregatedFieldWells_size :: Lens.Lens' ScatterPlotCategoricallyAggregatedFieldWells (Prelude.Maybe [MeasureField])
scatterPlotCategoricallyAggregatedFieldWells_size :: Lens'
  ScatterPlotCategoricallyAggregatedFieldWells (Maybe [MeasureField])
scatterPlotCategoricallyAggregatedFieldWells_size = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScatterPlotCategoricallyAggregatedFieldWells' {Maybe [MeasureField]
size :: Maybe [MeasureField]
$sel:size:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
size} -> Maybe [MeasureField]
size) (\s :: ScatterPlotCategoricallyAggregatedFieldWells
s@ScatterPlotCategoricallyAggregatedFieldWells' {} Maybe [MeasureField]
a -> ScatterPlotCategoricallyAggregatedFieldWells
s {$sel:size:ScatterPlotCategoricallyAggregatedFieldWells' :: Maybe [MeasureField]
size = Maybe [MeasureField]
a} :: ScatterPlotCategoricallyAggregatedFieldWells) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The x-axis field well of a scatter plot.
--
-- The x-axis is aggregated by category.
scatterPlotCategoricallyAggregatedFieldWells_xAxis :: Lens.Lens' ScatterPlotCategoricallyAggregatedFieldWells (Prelude.Maybe [MeasureField])
scatterPlotCategoricallyAggregatedFieldWells_xAxis :: Lens'
  ScatterPlotCategoricallyAggregatedFieldWells (Maybe [MeasureField])
scatterPlotCategoricallyAggregatedFieldWells_xAxis = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScatterPlotCategoricallyAggregatedFieldWells' {Maybe [MeasureField]
xAxis :: Maybe [MeasureField]
$sel:xAxis:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
xAxis} -> Maybe [MeasureField]
xAxis) (\s :: ScatterPlotCategoricallyAggregatedFieldWells
s@ScatterPlotCategoricallyAggregatedFieldWells' {} Maybe [MeasureField]
a -> ScatterPlotCategoricallyAggregatedFieldWells
s {$sel:xAxis:ScatterPlotCategoricallyAggregatedFieldWells' :: Maybe [MeasureField]
xAxis = Maybe [MeasureField]
a} :: ScatterPlotCategoricallyAggregatedFieldWells) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The y-axis field well of a scatter plot.
--
-- The y-axis is aggregated by category.
scatterPlotCategoricallyAggregatedFieldWells_yAxis :: Lens.Lens' ScatterPlotCategoricallyAggregatedFieldWells (Prelude.Maybe [MeasureField])
scatterPlotCategoricallyAggregatedFieldWells_yAxis :: Lens'
  ScatterPlotCategoricallyAggregatedFieldWells (Maybe [MeasureField])
scatterPlotCategoricallyAggregatedFieldWells_yAxis = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScatterPlotCategoricallyAggregatedFieldWells' {Maybe [MeasureField]
yAxis :: Maybe [MeasureField]
$sel:yAxis:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
yAxis} -> Maybe [MeasureField]
yAxis) (\s :: ScatterPlotCategoricallyAggregatedFieldWells
s@ScatterPlotCategoricallyAggregatedFieldWells' {} Maybe [MeasureField]
a -> ScatterPlotCategoricallyAggregatedFieldWells
s {$sel:yAxis:ScatterPlotCategoricallyAggregatedFieldWells' :: Maybe [MeasureField]
yAxis = Maybe [MeasureField]
a} :: ScatterPlotCategoricallyAggregatedFieldWells) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Data.FromJSON
    ScatterPlotCategoricallyAggregatedFieldWells
  where
  parseJSON :: Value -> Parser ScatterPlotCategoricallyAggregatedFieldWells
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ScatterPlotCategoricallyAggregatedFieldWells"
      ( \Object
x ->
          Maybe [DimensionField]
-> Maybe [MeasureField]
-> Maybe [MeasureField]
-> Maybe [MeasureField]
-> ScatterPlotCategoricallyAggregatedFieldWells
ScatterPlotCategoricallyAggregatedFieldWells'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Category" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Size" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"XAxis" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"YAxis" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    ScatterPlotCategoricallyAggregatedFieldWells
  where
  hashWithSalt :: Int -> ScatterPlotCategoricallyAggregatedFieldWells -> Int
hashWithSalt
    Int
_salt
    ScatterPlotCategoricallyAggregatedFieldWells' {Maybe [MeasureField]
Maybe [DimensionField]
yAxis :: Maybe [MeasureField]
xAxis :: Maybe [MeasureField]
size :: Maybe [MeasureField]
category :: Maybe [DimensionField]
$sel:yAxis:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
$sel:xAxis:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
$sel:size:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
$sel:category:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [DimensionField]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DimensionField]
category
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [MeasureField]
size
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [MeasureField]
xAxis
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [MeasureField]
yAxis

instance
  Prelude.NFData
    ScatterPlotCategoricallyAggregatedFieldWells
  where
  rnf :: ScatterPlotCategoricallyAggregatedFieldWells -> ()
rnf ScatterPlotCategoricallyAggregatedFieldWells' {Maybe [MeasureField]
Maybe [DimensionField]
yAxis :: Maybe [MeasureField]
xAxis :: Maybe [MeasureField]
size :: Maybe [MeasureField]
category :: Maybe [DimensionField]
$sel:yAxis:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
$sel:xAxis:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
$sel:size:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
$sel:category:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [DimensionField]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [DimensionField]
category
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [MeasureField]
size
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [MeasureField]
xAxis
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [MeasureField]
yAxis

instance
  Data.ToJSON
    ScatterPlotCategoricallyAggregatedFieldWells
  where
  toJSON :: ScatterPlotCategoricallyAggregatedFieldWells -> Value
toJSON
    ScatterPlotCategoricallyAggregatedFieldWells' {Maybe [MeasureField]
Maybe [DimensionField]
yAxis :: Maybe [MeasureField]
xAxis :: Maybe [MeasureField]
size :: Maybe [MeasureField]
category :: Maybe [DimensionField]
$sel:yAxis:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
$sel:xAxis:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
$sel:size:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [MeasureField]
$sel:category:ScatterPlotCategoricallyAggregatedFieldWells' :: ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe [DimensionField]
..} =
      [Pair] -> Value
Data.object
        ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Key
"Category" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [DimensionField]
category,
              (Key
"Size" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MeasureField]
size,
              (Key
"XAxis" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MeasureField]
xAxis,
              (Key
"YAxis" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MeasureField]
yAxis
            ]
        )