{-# 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.ScatterPlotFieldWells
-- 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.ScatterPlotFieldWells 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.ScatterPlotCategoricallyAggregatedFieldWells
import Amazonka.QuickSight.Types.ScatterPlotUnaggregatedFieldWells

-- | The field well configuration of a scatter plot.
--
-- This is a union type structure. For this structure to be valid, only one
-- of the attributes can be defined.
--
-- /See:/ 'newScatterPlotFieldWells' smart constructor.
data ScatterPlotFieldWells = ScatterPlotFieldWells'
  { -- | The aggregated field wells of a scatter plot. Scatter plots that have a
    -- field in the category (group\/color) field will have aggregated field
    -- wells. The x and y-axes of these scatter plots are aggregated by
    -- category.
    ScatterPlotFieldWells
-> Maybe ScatterPlotCategoricallyAggregatedFieldWells
scatterPlotCategoricallyAggregatedFieldWells :: Prelude.Maybe ScatterPlotCategoricallyAggregatedFieldWells,
    -- | The unaggregated field wells of a scatter plot. Scatter plots without a
    -- category field well have unaggregated field wells. The x and y-axes of
    -- these scatter plots are unaggregated.
    ScatterPlotFieldWells -> Maybe ScatterPlotUnaggregatedFieldWells
scatterPlotUnaggregatedFieldWells :: Prelude.Maybe ScatterPlotUnaggregatedFieldWells
  }
  deriving (ScatterPlotFieldWells -> ScatterPlotFieldWells -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScatterPlotFieldWells -> ScatterPlotFieldWells -> Bool
$c/= :: ScatterPlotFieldWells -> ScatterPlotFieldWells -> Bool
== :: ScatterPlotFieldWells -> ScatterPlotFieldWells -> Bool
$c== :: ScatterPlotFieldWells -> ScatterPlotFieldWells -> Bool
Prelude.Eq, Int -> ScatterPlotFieldWells -> ShowS
[ScatterPlotFieldWells] -> ShowS
ScatterPlotFieldWells -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScatterPlotFieldWells] -> ShowS
$cshowList :: [ScatterPlotFieldWells] -> ShowS
show :: ScatterPlotFieldWells -> String
$cshow :: ScatterPlotFieldWells -> String
showsPrec :: Int -> ScatterPlotFieldWells -> ShowS
$cshowsPrec :: Int -> ScatterPlotFieldWells -> ShowS
Prelude.Show, forall x. Rep ScatterPlotFieldWells x -> ScatterPlotFieldWells
forall x. ScatterPlotFieldWells -> Rep ScatterPlotFieldWells x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScatterPlotFieldWells x -> ScatterPlotFieldWells
$cfrom :: forall x. ScatterPlotFieldWells -> Rep ScatterPlotFieldWells x
Prelude.Generic)

-- |
-- Create a value of 'ScatterPlotFieldWells' 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:
--
-- 'scatterPlotCategoricallyAggregatedFieldWells', 'scatterPlotFieldWells_scatterPlotCategoricallyAggregatedFieldWells' - The aggregated field wells of a scatter plot. Scatter plots that have a
-- field in the category (group\/color) field will have aggregated field
-- wells. The x and y-axes of these scatter plots are aggregated by
-- category.
--
-- 'scatterPlotUnaggregatedFieldWells', 'scatterPlotFieldWells_scatterPlotUnaggregatedFieldWells' - The unaggregated field wells of a scatter plot. Scatter plots without a
-- category field well have unaggregated field wells. The x and y-axes of
-- these scatter plots are unaggregated.
newScatterPlotFieldWells ::
  ScatterPlotFieldWells
newScatterPlotFieldWells :: ScatterPlotFieldWells
newScatterPlotFieldWells =
  ScatterPlotFieldWells'
    { $sel:scatterPlotCategoricallyAggregatedFieldWells:ScatterPlotFieldWells' :: Maybe ScatterPlotCategoricallyAggregatedFieldWells
scatterPlotCategoricallyAggregatedFieldWells =
        forall a. Maybe a
Prelude.Nothing,
      $sel:scatterPlotUnaggregatedFieldWells:ScatterPlotFieldWells' :: Maybe ScatterPlotUnaggregatedFieldWells
scatterPlotUnaggregatedFieldWells = forall a. Maybe a
Prelude.Nothing
    }

-- | The aggregated field wells of a scatter plot. Scatter plots that have a
-- field in the category (group\/color) field will have aggregated field
-- wells. The x and y-axes of these scatter plots are aggregated by
-- category.
scatterPlotFieldWells_scatterPlotCategoricallyAggregatedFieldWells :: Lens.Lens' ScatterPlotFieldWells (Prelude.Maybe ScatterPlotCategoricallyAggregatedFieldWells)
scatterPlotFieldWells_scatterPlotCategoricallyAggregatedFieldWells :: Lens'
  ScatterPlotFieldWells
  (Maybe ScatterPlotCategoricallyAggregatedFieldWells)
scatterPlotFieldWells_scatterPlotCategoricallyAggregatedFieldWells = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScatterPlotFieldWells' {Maybe ScatterPlotCategoricallyAggregatedFieldWells
scatterPlotCategoricallyAggregatedFieldWells :: Maybe ScatterPlotCategoricallyAggregatedFieldWells
$sel:scatterPlotCategoricallyAggregatedFieldWells:ScatterPlotFieldWells' :: ScatterPlotFieldWells
-> Maybe ScatterPlotCategoricallyAggregatedFieldWells
scatterPlotCategoricallyAggregatedFieldWells} -> Maybe ScatterPlotCategoricallyAggregatedFieldWells
scatterPlotCategoricallyAggregatedFieldWells) (\s :: ScatterPlotFieldWells
s@ScatterPlotFieldWells' {} Maybe ScatterPlotCategoricallyAggregatedFieldWells
a -> ScatterPlotFieldWells
s {$sel:scatterPlotCategoricallyAggregatedFieldWells:ScatterPlotFieldWells' :: Maybe ScatterPlotCategoricallyAggregatedFieldWells
scatterPlotCategoricallyAggregatedFieldWells = Maybe ScatterPlotCategoricallyAggregatedFieldWells
a} :: ScatterPlotFieldWells)

-- | The unaggregated field wells of a scatter plot. Scatter plots without a
-- category field well have unaggregated field wells. The x and y-axes of
-- these scatter plots are unaggregated.
scatterPlotFieldWells_scatterPlotUnaggregatedFieldWells :: Lens.Lens' ScatterPlotFieldWells (Prelude.Maybe ScatterPlotUnaggregatedFieldWells)
scatterPlotFieldWells_scatterPlotUnaggregatedFieldWells :: Lens'
  ScatterPlotFieldWells (Maybe ScatterPlotUnaggregatedFieldWells)
scatterPlotFieldWells_scatterPlotUnaggregatedFieldWells = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScatterPlotFieldWells' {Maybe ScatterPlotUnaggregatedFieldWells
scatterPlotUnaggregatedFieldWells :: Maybe ScatterPlotUnaggregatedFieldWells
$sel:scatterPlotUnaggregatedFieldWells:ScatterPlotFieldWells' :: ScatterPlotFieldWells -> Maybe ScatterPlotUnaggregatedFieldWells
scatterPlotUnaggregatedFieldWells} -> Maybe ScatterPlotUnaggregatedFieldWells
scatterPlotUnaggregatedFieldWells) (\s :: ScatterPlotFieldWells
s@ScatterPlotFieldWells' {} Maybe ScatterPlotUnaggregatedFieldWells
a -> ScatterPlotFieldWells
s {$sel:scatterPlotUnaggregatedFieldWells:ScatterPlotFieldWells' :: Maybe ScatterPlotUnaggregatedFieldWells
scatterPlotUnaggregatedFieldWells = Maybe ScatterPlotUnaggregatedFieldWells
a} :: ScatterPlotFieldWells)

instance Data.FromJSON ScatterPlotFieldWells where
  parseJSON :: Value -> Parser ScatterPlotFieldWells
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ScatterPlotFieldWells"
      ( \Object
x ->
          Maybe ScatterPlotCategoricallyAggregatedFieldWells
-> Maybe ScatterPlotUnaggregatedFieldWells -> ScatterPlotFieldWells
ScatterPlotFieldWells'
            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
"ScatterPlotCategoricallyAggregatedFieldWells"
                        )
            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
"ScatterPlotUnaggregatedFieldWells")
      )

instance Prelude.Hashable ScatterPlotFieldWells where
  hashWithSalt :: Int -> ScatterPlotFieldWells -> Int
hashWithSalt Int
_salt ScatterPlotFieldWells' {Maybe ScatterPlotUnaggregatedFieldWells
Maybe ScatterPlotCategoricallyAggregatedFieldWells
scatterPlotUnaggregatedFieldWells :: Maybe ScatterPlotUnaggregatedFieldWells
scatterPlotCategoricallyAggregatedFieldWells :: Maybe ScatterPlotCategoricallyAggregatedFieldWells
$sel:scatterPlotUnaggregatedFieldWells:ScatterPlotFieldWells' :: ScatterPlotFieldWells -> Maybe ScatterPlotUnaggregatedFieldWells
$sel:scatterPlotCategoricallyAggregatedFieldWells:ScatterPlotFieldWells' :: ScatterPlotFieldWells
-> Maybe ScatterPlotCategoricallyAggregatedFieldWells
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ScatterPlotCategoricallyAggregatedFieldWells
scatterPlotCategoricallyAggregatedFieldWells
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ScatterPlotUnaggregatedFieldWells
scatterPlotUnaggregatedFieldWells

instance Prelude.NFData ScatterPlotFieldWells where
  rnf :: ScatterPlotFieldWells -> ()
rnf ScatterPlotFieldWells' {Maybe ScatterPlotUnaggregatedFieldWells
Maybe ScatterPlotCategoricallyAggregatedFieldWells
scatterPlotUnaggregatedFieldWells :: Maybe ScatterPlotUnaggregatedFieldWells
scatterPlotCategoricallyAggregatedFieldWells :: Maybe ScatterPlotCategoricallyAggregatedFieldWells
$sel:scatterPlotUnaggregatedFieldWells:ScatterPlotFieldWells' :: ScatterPlotFieldWells -> Maybe ScatterPlotUnaggregatedFieldWells
$sel:scatterPlotCategoricallyAggregatedFieldWells:ScatterPlotFieldWells' :: ScatterPlotFieldWells
-> Maybe ScatterPlotCategoricallyAggregatedFieldWells
..} =
    forall a. NFData a => a -> ()
Prelude.rnf
      Maybe ScatterPlotCategoricallyAggregatedFieldWells
scatterPlotCategoricallyAggregatedFieldWells
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ScatterPlotUnaggregatedFieldWells
scatterPlotUnaggregatedFieldWells

instance Data.ToJSON ScatterPlotFieldWells where
  toJSON :: ScatterPlotFieldWells -> Value
toJSON ScatterPlotFieldWells' {Maybe ScatterPlotUnaggregatedFieldWells
Maybe ScatterPlotCategoricallyAggregatedFieldWells
scatterPlotUnaggregatedFieldWells :: Maybe ScatterPlotUnaggregatedFieldWells
scatterPlotCategoricallyAggregatedFieldWells :: Maybe ScatterPlotCategoricallyAggregatedFieldWells
$sel:scatterPlotUnaggregatedFieldWells:ScatterPlotFieldWells' :: ScatterPlotFieldWells -> Maybe ScatterPlotUnaggregatedFieldWells
$sel:scatterPlotCategoricallyAggregatedFieldWells:ScatterPlotFieldWells' :: ScatterPlotFieldWells
-> Maybe ScatterPlotCategoricallyAggregatedFieldWells
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ ( Key
"ScatterPlotCategoricallyAggregatedFieldWells"
                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 ScatterPlotCategoricallyAggregatedFieldWells
scatterPlotCategoricallyAggregatedFieldWells,
            (Key
"ScatterPlotUnaggregatedFieldWells" 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 ScatterPlotUnaggregatedFieldWells
scatterPlotUnaggregatedFieldWells
          ]
      )