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

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

-- | A custom value that\'s used when the value of a parameter isn\'t set.
decimalValueWhenUnsetConfiguration_customValue :: Lens.Lens' DecimalValueWhenUnsetConfiguration (Prelude.Maybe Prelude.Double)
decimalValueWhenUnsetConfiguration_customValue :: Lens' DecimalValueWhenUnsetConfiguration (Maybe Double)
decimalValueWhenUnsetConfiguration_customValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecimalValueWhenUnsetConfiguration' {Maybe (Sensitive Double)
customValue :: Maybe (Sensitive Double)
$sel:customValue:DecimalValueWhenUnsetConfiguration' :: DecimalValueWhenUnsetConfiguration -> Maybe (Sensitive Double)
customValue} -> Maybe (Sensitive Double)
customValue) (\s :: DecimalValueWhenUnsetConfiguration
s@DecimalValueWhenUnsetConfiguration' {} Maybe (Sensitive Double)
a -> DecimalValueWhenUnsetConfiguration
s {$sel:customValue:DecimalValueWhenUnsetConfiguration' :: Maybe (Sensitive Double)
customValue = Maybe (Sensitive Double)
a} :: DecimalValueWhenUnsetConfiguration) 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.
decimalValueWhenUnsetConfiguration_valueWhenUnsetOption :: Lens.Lens' DecimalValueWhenUnsetConfiguration (Prelude.Maybe ValueWhenUnsetOption)
decimalValueWhenUnsetConfiguration_valueWhenUnsetOption :: Lens'
  DecimalValueWhenUnsetConfiguration (Maybe ValueWhenUnsetOption)
decimalValueWhenUnsetConfiguration_valueWhenUnsetOption = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecimalValueWhenUnsetConfiguration' {Maybe ValueWhenUnsetOption
valueWhenUnsetOption :: Maybe ValueWhenUnsetOption
$sel:valueWhenUnsetOption:DecimalValueWhenUnsetConfiguration' :: DecimalValueWhenUnsetConfiguration -> Maybe ValueWhenUnsetOption
valueWhenUnsetOption} -> Maybe ValueWhenUnsetOption
valueWhenUnsetOption) (\s :: DecimalValueWhenUnsetConfiguration
s@DecimalValueWhenUnsetConfiguration' {} Maybe ValueWhenUnsetOption
a -> DecimalValueWhenUnsetConfiguration
s {$sel:valueWhenUnsetOption:DecimalValueWhenUnsetConfiguration' :: Maybe ValueWhenUnsetOption
valueWhenUnsetOption = Maybe ValueWhenUnsetOption
a} :: DecimalValueWhenUnsetConfiguration)

instance
  Data.FromJSON
    DecimalValueWhenUnsetConfiguration
  where
  parseJSON :: Value -> Parser DecimalValueWhenUnsetConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DecimalValueWhenUnsetConfiguration"
      ( \Object
x ->
          Maybe (Sensitive Double)
-> Maybe ValueWhenUnsetOption -> DecimalValueWhenUnsetConfiguration
DecimalValueWhenUnsetConfiguration'
            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
    DecimalValueWhenUnsetConfiguration
  where
  hashWithSalt :: Int -> DecimalValueWhenUnsetConfiguration -> Int
hashWithSalt
    Int
_salt
    DecimalValueWhenUnsetConfiguration' {Maybe (Sensitive Double)
Maybe ValueWhenUnsetOption
valueWhenUnsetOption :: Maybe ValueWhenUnsetOption
customValue :: Maybe (Sensitive Double)
$sel:valueWhenUnsetOption:DecimalValueWhenUnsetConfiguration' :: DecimalValueWhenUnsetConfiguration -> Maybe ValueWhenUnsetOption
$sel:customValue:DecimalValueWhenUnsetConfiguration' :: DecimalValueWhenUnsetConfiguration -> Maybe (Sensitive Double)
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Double)
customValue
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ValueWhenUnsetOption
valueWhenUnsetOption

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

instance
  Data.ToJSON
    DecimalValueWhenUnsetConfiguration
  where
  toJSON :: DecimalValueWhenUnsetConfiguration -> Value
toJSON DecimalValueWhenUnsetConfiguration' {Maybe (Sensitive Double)
Maybe ValueWhenUnsetOption
valueWhenUnsetOption :: Maybe ValueWhenUnsetOption
customValue :: Maybe (Sensitive Double)
$sel:valueWhenUnsetOption:DecimalValueWhenUnsetConfiguration' :: DecimalValueWhenUnsetConfiguration -> Maybe ValueWhenUnsetOption
$sel:customValue:DecimalValueWhenUnsetConfiguration' :: DecimalValueWhenUnsetConfiguration -> Maybe (Sensitive Double)
..} =
    [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 Double)
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
          ]
      )