{-# 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.BoxPlotFieldWells
-- 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.BoxPlotFieldWells 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.BoxPlotAggregatedFieldWells

-- | The field wells of a @BoxPlotVisual@.
--
-- This is a union type structure. For this structure to be valid, only one
-- of the attributes can be defined.
--
-- /See:/ 'newBoxPlotFieldWells' smart constructor.
data BoxPlotFieldWells = BoxPlotFieldWells'
  { -- | The aggregated field wells of a box plot.
    BoxPlotFieldWells -> Maybe BoxPlotAggregatedFieldWells
boxPlotAggregatedFieldWells :: Prelude.Maybe BoxPlotAggregatedFieldWells
  }
  deriving (BoxPlotFieldWells -> BoxPlotFieldWells -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BoxPlotFieldWells -> BoxPlotFieldWells -> Bool
$c/= :: BoxPlotFieldWells -> BoxPlotFieldWells -> Bool
== :: BoxPlotFieldWells -> BoxPlotFieldWells -> Bool
$c== :: BoxPlotFieldWells -> BoxPlotFieldWells -> Bool
Prelude.Eq, Int -> BoxPlotFieldWells -> ShowS
[BoxPlotFieldWells] -> ShowS
BoxPlotFieldWells -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BoxPlotFieldWells] -> ShowS
$cshowList :: [BoxPlotFieldWells] -> ShowS
show :: BoxPlotFieldWells -> String
$cshow :: BoxPlotFieldWells -> String
showsPrec :: Int -> BoxPlotFieldWells -> ShowS
$cshowsPrec :: Int -> BoxPlotFieldWells -> ShowS
Prelude.Show, forall x. Rep BoxPlotFieldWells x -> BoxPlotFieldWells
forall x. BoxPlotFieldWells -> Rep BoxPlotFieldWells x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BoxPlotFieldWells x -> BoxPlotFieldWells
$cfrom :: forall x. BoxPlotFieldWells -> Rep BoxPlotFieldWells x
Prelude.Generic)

-- |
-- Create a value of 'BoxPlotFieldWells' 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:
--
-- 'boxPlotAggregatedFieldWells', 'boxPlotFieldWells_boxPlotAggregatedFieldWells' - The aggregated field wells of a box plot.
newBoxPlotFieldWells ::
  BoxPlotFieldWells
newBoxPlotFieldWells :: BoxPlotFieldWells
newBoxPlotFieldWells =
  BoxPlotFieldWells'
    { $sel:boxPlotAggregatedFieldWells:BoxPlotFieldWells' :: Maybe BoxPlotAggregatedFieldWells
boxPlotAggregatedFieldWells =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The aggregated field wells of a box plot.
boxPlotFieldWells_boxPlotAggregatedFieldWells :: Lens.Lens' BoxPlotFieldWells (Prelude.Maybe BoxPlotAggregatedFieldWells)
boxPlotFieldWells_boxPlotAggregatedFieldWells :: Lens' BoxPlotFieldWells (Maybe BoxPlotAggregatedFieldWells)
boxPlotFieldWells_boxPlotAggregatedFieldWells = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BoxPlotFieldWells' {Maybe BoxPlotAggregatedFieldWells
boxPlotAggregatedFieldWells :: Maybe BoxPlotAggregatedFieldWells
$sel:boxPlotAggregatedFieldWells:BoxPlotFieldWells' :: BoxPlotFieldWells -> Maybe BoxPlotAggregatedFieldWells
boxPlotAggregatedFieldWells} -> Maybe BoxPlotAggregatedFieldWells
boxPlotAggregatedFieldWells) (\s :: BoxPlotFieldWells
s@BoxPlotFieldWells' {} Maybe BoxPlotAggregatedFieldWells
a -> BoxPlotFieldWells
s {$sel:boxPlotAggregatedFieldWells:BoxPlotFieldWells' :: Maybe BoxPlotAggregatedFieldWells
boxPlotAggregatedFieldWells = Maybe BoxPlotAggregatedFieldWells
a} :: BoxPlotFieldWells)

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

instance Prelude.Hashable BoxPlotFieldWells where
  hashWithSalt :: Int -> BoxPlotFieldWells -> Int
hashWithSalt Int
_salt BoxPlotFieldWells' {Maybe BoxPlotAggregatedFieldWells
boxPlotAggregatedFieldWells :: Maybe BoxPlotAggregatedFieldWells
$sel:boxPlotAggregatedFieldWells:BoxPlotFieldWells' :: BoxPlotFieldWells -> Maybe BoxPlotAggregatedFieldWells
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BoxPlotAggregatedFieldWells
boxPlotAggregatedFieldWells

instance Prelude.NFData BoxPlotFieldWells where
  rnf :: BoxPlotFieldWells -> ()
rnf BoxPlotFieldWells' {Maybe BoxPlotAggregatedFieldWells
boxPlotAggregatedFieldWells :: Maybe BoxPlotAggregatedFieldWells
$sel:boxPlotAggregatedFieldWells:BoxPlotFieldWells' :: BoxPlotFieldWells -> Maybe BoxPlotAggregatedFieldWells
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe BoxPlotAggregatedFieldWells
boxPlotAggregatedFieldWells

instance Data.ToJSON BoxPlotFieldWells where
  toJSON :: BoxPlotFieldWells -> Value
toJSON BoxPlotFieldWells' {Maybe BoxPlotAggregatedFieldWells
boxPlotAggregatedFieldWells :: Maybe BoxPlotAggregatedFieldWells
$sel:boxPlotAggregatedFieldWells:BoxPlotFieldWells' :: BoxPlotFieldWells -> Maybe BoxPlotAggregatedFieldWells
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"BoxPlotAggregatedFieldWells" 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 BoxPlotAggregatedFieldWells
boxPlotAggregatedFieldWells
          ]
      )