{-# 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.WordCloudFieldWells
-- 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.WordCloudFieldWells 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.WordCloudAggregatedFieldWells

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

-- |
-- Create a value of 'WordCloudFieldWells' 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:
--
-- 'wordCloudAggregatedFieldWells', 'wordCloudFieldWells_wordCloudAggregatedFieldWells' - The aggregated field wells of a word cloud.
newWordCloudFieldWells ::
  WordCloudFieldWells
newWordCloudFieldWells :: WordCloudFieldWells
newWordCloudFieldWells =
  WordCloudFieldWells'
    { $sel:wordCloudAggregatedFieldWells:WordCloudFieldWells' :: Maybe WordCloudAggregatedFieldWells
wordCloudAggregatedFieldWells =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The aggregated field wells of a word cloud.
wordCloudFieldWells_wordCloudAggregatedFieldWells :: Lens.Lens' WordCloudFieldWells (Prelude.Maybe WordCloudAggregatedFieldWells)
wordCloudFieldWells_wordCloudAggregatedFieldWells :: Lens' WordCloudFieldWells (Maybe WordCloudAggregatedFieldWells)
wordCloudFieldWells_wordCloudAggregatedFieldWells = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WordCloudFieldWells' {Maybe WordCloudAggregatedFieldWells
wordCloudAggregatedFieldWells :: Maybe WordCloudAggregatedFieldWells
$sel:wordCloudAggregatedFieldWells:WordCloudFieldWells' :: WordCloudFieldWells -> Maybe WordCloudAggregatedFieldWells
wordCloudAggregatedFieldWells} -> Maybe WordCloudAggregatedFieldWells
wordCloudAggregatedFieldWells) (\s :: WordCloudFieldWells
s@WordCloudFieldWells' {} Maybe WordCloudAggregatedFieldWells
a -> WordCloudFieldWells
s {$sel:wordCloudAggregatedFieldWells:WordCloudFieldWells' :: Maybe WordCloudAggregatedFieldWells
wordCloudAggregatedFieldWells = Maybe WordCloudAggregatedFieldWells
a} :: WordCloudFieldWells)

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

instance Prelude.Hashable WordCloudFieldWells where
  hashWithSalt :: Int -> WordCloudFieldWells -> Int
hashWithSalt Int
_salt WordCloudFieldWells' {Maybe WordCloudAggregatedFieldWells
wordCloudAggregatedFieldWells :: Maybe WordCloudAggregatedFieldWells
$sel:wordCloudAggregatedFieldWells:WordCloudFieldWells' :: WordCloudFieldWells -> Maybe WordCloudAggregatedFieldWells
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe WordCloudAggregatedFieldWells
wordCloudAggregatedFieldWells

instance Prelude.NFData WordCloudFieldWells where
  rnf :: WordCloudFieldWells -> ()
rnf WordCloudFieldWells' {Maybe WordCloudAggregatedFieldWells
wordCloudAggregatedFieldWells :: Maybe WordCloudAggregatedFieldWells
$sel:wordCloudAggregatedFieldWells:WordCloudFieldWells' :: WordCloudFieldWells -> Maybe WordCloudAggregatedFieldWells
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe WordCloudAggregatedFieldWells
wordCloudAggregatedFieldWells

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