{-# 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.NullValueFormatConfiguration
-- 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.NullValueFormatConfiguration 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

-- | The options that determine the null value format configuration.
--
-- /See:/ 'newNullValueFormatConfiguration' smart constructor.
data NullValueFormatConfiguration = NullValueFormatConfiguration'
  { -- | Determines the null string of null values.
    NullValueFormatConfiguration -> Sensitive Text
nullString :: Data.Sensitive Prelude.Text
  }
  deriving (NullValueFormatConfiguration
-> NullValueFormatConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NullValueFormatConfiguration
-> NullValueFormatConfiguration -> Bool
$c/= :: NullValueFormatConfiguration
-> NullValueFormatConfiguration -> Bool
== :: NullValueFormatConfiguration
-> NullValueFormatConfiguration -> Bool
$c== :: NullValueFormatConfiguration
-> NullValueFormatConfiguration -> Bool
Prelude.Eq, Int -> NullValueFormatConfiguration -> ShowS
[NullValueFormatConfiguration] -> ShowS
NullValueFormatConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NullValueFormatConfiguration] -> ShowS
$cshowList :: [NullValueFormatConfiguration] -> ShowS
show :: NullValueFormatConfiguration -> String
$cshow :: NullValueFormatConfiguration -> String
showsPrec :: Int -> NullValueFormatConfiguration -> ShowS
$cshowsPrec :: Int -> NullValueFormatConfiguration -> ShowS
Prelude.Show, forall x.
Rep NullValueFormatConfiguration x -> NullValueFormatConfiguration
forall x.
NullValueFormatConfiguration -> Rep NullValueFormatConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NullValueFormatConfiguration x -> NullValueFormatConfiguration
$cfrom :: forall x.
NullValueFormatConfiguration -> Rep NullValueFormatConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'NullValueFormatConfiguration' 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:
--
-- 'nullString', 'nullValueFormatConfiguration_nullString' - Determines the null string of null values.
newNullValueFormatConfiguration ::
  -- | 'nullString'
  Prelude.Text ->
  NullValueFormatConfiguration
newNullValueFormatConfiguration :: Text -> NullValueFormatConfiguration
newNullValueFormatConfiguration Text
pNullString_ =
  NullValueFormatConfiguration'
    { $sel:nullString:NullValueFormatConfiguration' :: Sensitive Text
nullString =
        forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pNullString_
    }

-- | Determines the null string of null values.
nullValueFormatConfiguration_nullString :: Lens.Lens' NullValueFormatConfiguration Prelude.Text
nullValueFormatConfiguration_nullString :: Lens' NullValueFormatConfiguration Text
nullValueFormatConfiguration_nullString = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NullValueFormatConfiguration' {Sensitive Text
nullString :: Sensitive Text
$sel:nullString:NullValueFormatConfiguration' :: NullValueFormatConfiguration -> Sensitive Text
nullString} -> Sensitive Text
nullString) (\s :: NullValueFormatConfiguration
s@NullValueFormatConfiguration' {} Sensitive Text
a -> NullValueFormatConfiguration
s {$sel:nullString:NullValueFormatConfiguration' :: Sensitive Text
nullString = Sensitive Text
a} :: NullValueFormatConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

instance Data.FromJSON NullValueFormatConfiguration where
  parseJSON :: Value -> Parser NullValueFormatConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NullValueFormatConfiguration"
      ( \Object
x ->
          Sensitive Text -> NullValueFormatConfiguration
NullValueFormatConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"NullString")
      )

instance
  Prelude.Hashable
    NullValueFormatConfiguration
  where
  hashWithSalt :: Int -> NullValueFormatConfiguration -> Int
hashWithSalt Int
_salt NullValueFormatConfiguration' {Sensitive Text
nullString :: Sensitive Text
$sel:nullString:NullValueFormatConfiguration' :: NullValueFormatConfiguration -> Sensitive Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
nullString

instance Prelude.NFData NullValueFormatConfiguration where
  rnf :: NullValueFormatConfiguration -> ()
rnf NullValueFormatConfiguration' {Sensitive Text
nullString :: Sensitive Text
$sel:nullString:NullValueFormatConfiguration' :: NullValueFormatConfiguration -> Sensitive Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
nullString

instance Data.ToJSON NullValueFormatConfiguration where
  toJSON :: NullValueFormatConfiguration -> Value
toJSON NullValueFormatConfiguration' {Sensitive Text
nullString :: Sensitive Text
$sel:nullString:NullValueFormatConfiguration' :: NullValueFormatConfiguration -> Sensitive Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"NullString" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
nullString)]
      )