{-# 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.StringValueWhenUnsetConfiguration
-- 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.StringValueWhenUnsetConfiguration 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.ValueWhenUnsetOption

-- | The configuration that defines the default value of a @String@ parameter
-- when a value has not been set.
--
-- /See:/ 'newStringValueWhenUnsetConfiguration' smart constructor.
data StringValueWhenUnsetConfiguration = StringValueWhenUnsetConfiguration'
  { -- | A custom value that\'s used when the value of a parameter isn\'t set.
    StringValueWhenUnsetConfiguration -> Maybe (Sensitive Text)
customValue :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The built-in options for default values. The value can be one of the
    -- following:
    --
    -- -   @RECOMMENDED@: The recommended value.
    --
    -- -   @NULL@: The @NULL@ value.
    StringValueWhenUnsetConfiguration -> Maybe ValueWhenUnsetOption
valueWhenUnsetOption :: Prelude.Maybe ValueWhenUnsetOption
  }
  deriving (StringValueWhenUnsetConfiguration
-> StringValueWhenUnsetConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StringValueWhenUnsetConfiguration
-> StringValueWhenUnsetConfiguration -> Bool
$c/= :: StringValueWhenUnsetConfiguration
-> StringValueWhenUnsetConfiguration -> Bool
== :: StringValueWhenUnsetConfiguration
-> StringValueWhenUnsetConfiguration -> Bool
$c== :: StringValueWhenUnsetConfiguration
-> StringValueWhenUnsetConfiguration -> Bool
Prelude.Eq, Int -> StringValueWhenUnsetConfiguration -> ShowS
[StringValueWhenUnsetConfiguration] -> ShowS
StringValueWhenUnsetConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StringValueWhenUnsetConfiguration] -> ShowS
$cshowList :: [StringValueWhenUnsetConfiguration] -> ShowS
show :: StringValueWhenUnsetConfiguration -> String
$cshow :: StringValueWhenUnsetConfiguration -> String
showsPrec :: Int -> StringValueWhenUnsetConfiguration -> ShowS
$cshowsPrec :: Int -> StringValueWhenUnsetConfiguration -> ShowS
Prelude.Show, forall x.
Rep StringValueWhenUnsetConfiguration x
-> StringValueWhenUnsetConfiguration
forall x.
StringValueWhenUnsetConfiguration
-> Rep StringValueWhenUnsetConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StringValueWhenUnsetConfiguration x
-> StringValueWhenUnsetConfiguration
$cfrom :: forall x.
StringValueWhenUnsetConfiguration
-> Rep StringValueWhenUnsetConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'StringValueWhenUnsetConfiguration' 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:
--
-- 'customValue', 'stringValueWhenUnsetConfiguration_customValue' - A custom value that\'s used when the value of a parameter isn\'t set.
--
-- 'valueWhenUnsetOption', 'stringValueWhenUnsetConfiguration_valueWhenUnsetOption' - The built-in options for default values. The value can be one of the
-- following:
--
-- -   @RECOMMENDED@: The recommended value.
--
-- -   @NULL@: The @NULL@ value.
newStringValueWhenUnsetConfiguration ::
  StringValueWhenUnsetConfiguration
newStringValueWhenUnsetConfiguration :: StringValueWhenUnsetConfiguration
newStringValueWhenUnsetConfiguration =
  StringValueWhenUnsetConfiguration'
    { $sel:customValue:StringValueWhenUnsetConfiguration' :: Maybe (Sensitive Text)
customValue =
        forall a. Maybe a
Prelude.Nothing,
      $sel:valueWhenUnsetOption:StringValueWhenUnsetConfiguration' :: Maybe ValueWhenUnsetOption
valueWhenUnsetOption = forall a. Maybe a
Prelude.Nothing
    }

-- | A custom value that\'s used when the value of a parameter isn\'t set.
stringValueWhenUnsetConfiguration_customValue :: Lens.Lens' StringValueWhenUnsetConfiguration (Prelude.Maybe Prelude.Text)
stringValueWhenUnsetConfiguration_customValue :: Lens' StringValueWhenUnsetConfiguration (Maybe Text)
stringValueWhenUnsetConfiguration_customValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StringValueWhenUnsetConfiguration' {Maybe (Sensitive Text)
customValue :: Maybe (Sensitive Text)
$sel:customValue:StringValueWhenUnsetConfiguration' :: StringValueWhenUnsetConfiguration -> Maybe (Sensitive Text)
customValue} -> Maybe (Sensitive Text)
customValue) (\s :: StringValueWhenUnsetConfiguration
s@StringValueWhenUnsetConfiguration' {} Maybe (Sensitive Text)
a -> StringValueWhenUnsetConfiguration
s {$sel:customValue:StringValueWhenUnsetConfiguration' :: Maybe (Sensitive Text)
customValue = Maybe (Sensitive Text)
a} :: StringValueWhenUnsetConfiguration) 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 a. Iso' (Sensitive a) a
Data._Sensitive

-- | The built-in options for default values. The value can be one of the
-- following:
--
-- -   @RECOMMENDED@: The recommended value.
--
-- -   @NULL@: The @NULL@ value.
stringValueWhenUnsetConfiguration_valueWhenUnsetOption :: Lens.Lens' StringValueWhenUnsetConfiguration (Prelude.Maybe ValueWhenUnsetOption)
stringValueWhenUnsetConfiguration_valueWhenUnsetOption :: Lens'
  StringValueWhenUnsetConfiguration (Maybe ValueWhenUnsetOption)
stringValueWhenUnsetConfiguration_valueWhenUnsetOption = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StringValueWhenUnsetConfiguration' {Maybe ValueWhenUnsetOption
valueWhenUnsetOption :: Maybe ValueWhenUnsetOption
$sel:valueWhenUnsetOption:StringValueWhenUnsetConfiguration' :: StringValueWhenUnsetConfiguration -> Maybe ValueWhenUnsetOption
valueWhenUnsetOption} -> Maybe ValueWhenUnsetOption
valueWhenUnsetOption) (\s :: StringValueWhenUnsetConfiguration
s@StringValueWhenUnsetConfiguration' {} Maybe ValueWhenUnsetOption
a -> StringValueWhenUnsetConfiguration
s {$sel:valueWhenUnsetOption:StringValueWhenUnsetConfiguration' :: Maybe ValueWhenUnsetOption
valueWhenUnsetOption = Maybe ValueWhenUnsetOption
a} :: StringValueWhenUnsetConfiguration)

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

instance
  Prelude.Hashable
    StringValueWhenUnsetConfiguration
  where
  hashWithSalt :: Int -> StringValueWhenUnsetConfiguration -> Int
hashWithSalt
    Int
_salt
    StringValueWhenUnsetConfiguration' {Maybe (Sensitive Text)
Maybe ValueWhenUnsetOption
valueWhenUnsetOption :: Maybe ValueWhenUnsetOption
customValue :: Maybe (Sensitive Text)
$sel:valueWhenUnsetOption:StringValueWhenUnsetConfiguration' :: StringValueWhenUnsetConfiguration -> Maybe ValueWhenUnsetOption
$sel:customValue:StringValueWhenUnsetConfiguration' :: StringValueWhenUnsetConfiguration -> Maybe (Sensitive Text)
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
customValue
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ValueWhenUnsetOption
valueWhenUnsetOption

instance
  Prelude.NFData
    StringValueWhenUnsetConfiguration
  where
  rnf :: StringValueWhenUnsetConfiguration -> ()
rnf StringValueWhenUnsetConfiguration' {Maybe (Sensitive Text)
Maybe ValueWhenUnsetOption
valueWhenUnsetOption :: Maybe ValueWhenUnsetOption
customValue :: Maybe (Sensitive Text)
$sel:valueWhenUnsetOption:StringValueWhenUnsetConfiguration' :: StringValueWhenUnsetConfiguration -> Maybe ValueWhenUnsetOption
$sel:customValue:StringValueWhenUnsetConfiguration' :: StringValueWhenUnsetConfiguration -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
customValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ValueWhenUnsetOption
valueWhenUnsetOption

instance
  Data.ToJSON
    StringValueWhenUnsetConfiguration
  where
  toJSON :: StringValueWhenUnsetConfiguration -> Value
toJSON StringValueWhenUnsetConfiguration' {Maybe (Sensitive Text)
Maybe ValueWhenUnsetOption
valueWhenUnsetOption :: Maybe ValueWhenUnsetOption
customValue :: Maybe (Sensitive Text)
$sel:valueWhenUnsetOption:StringValueWhenUnsetConfiguration' :: StringValueWhenUnsetConfiguration -> Maybe ValueWhenUnsetOption
$sel:customValue:StringValueWhenUnsetConfiguration' :: StringValueWhenUnsetConfiguration -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CustomValue" 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 (Sensitive Text)
customValue,
            (Key
"ValueWhenUnsetOption" 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 ValueWhenUnsetOption
valueWhenUnsetOption
          ]
      )