{-# 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.ThousandSeparatorOptions
-- 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.ThousandSeparatorOptions 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.NumericSeparatorSymbol
import Amazonka.QuickSight.Types.Visibility

-- | The options that determine the thousands separator configuration.
--
-- /See:/ 'newThousandSeparatorOptions' smart constructor.
data ThousandSeparatorOptions = ThousandSeparatorOptions'
  { -- | Determines the thousands separator symbol.
    ThousandSeparatorOptions -> Maybe NumericSeparatorSymbol
symbol :: Prelude.Maybe NumericSeparatorSymbol,
    -- | Determines the visibility of the thousands separator.
    ThousandSeparatorOptions -> Maybe Visibility
visibility :: Prelude.Maybe Visibility
  }
  deriving (ThousandSeparatorOptions -> ThousandSeparatorOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThousandSeparatorOptions -> ThousandSeparatorOptions -> Bool
$c/= :: ThousandSeparatorOptions -> ThousandSeparatorOptions -> Bool
== :: ThousandSeparatorOptions -> ThousandSeparatorOptions -> Bool
$c== :: ThousandSeparatorOptions -> ThousandSeparatorOptions -> Bool
Prelude.Eq, ReadPrec [ThousandSeparatorOptions]
ReadPrec ThousandSeparatorOptions
Int -> ReadS ThousandSeparatorOptions
ReadS [ThousandSeparatorOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ThousandSeparatorOptions]
$creadListPrec :: ReadPrec [ThousandSeparatorOptions]
readPrec :: ReadPrec ThousandSeparatorOptions
$creadPrec :: ReadPrec ThousandSeparatorOptions
readList :: ReadS [ThousandSeparatorOptions]
$creadList :: ReadS [ThousandSeparatorOptions]
readsPrec :: Int -> ReadS ThousandSeparatorOptions
$creadsPrec :: Int -> ReadS ThousandSeparatorOptions
Prelude.Read, Int -> ThousandSeparatorOptions -> ShowS
[ThousandSeparatorOptions] -> ShowS
ThousandSeparatorOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThousandSeparatorOptions] -> ShowS
$cshowList :: [ThousandSeparatorOptions] -> ShowS
show :: ThousandSeparatorOptions -> String
$cshow :: ThousandSeparatorOptions -> String
showsPrec :: Int -> ThousandSeparatorOptions -> ShowS
$cshowsPrec :: Int -> ThousandSeparatorOptions -> ShowS
Prelude.Show, forall x.
Rep ThousandSeparatorOptions x -> ThousandSeparatorOptions
forall x.
ThousandSeparatorOptions -> Rep ThousandSeparatorOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ThousandSeparatorOptions x -> ThousandSeparatorOptions
$cfrom :: forall x.
ThousandSeparatorOptions -> Rep ThousandSeparatorOptions x
Prelude.Generic)

-- |
-- Create a value of 'ThousandSeparatorOptions' 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:
--
-- 'symbol', 'thousandSeparatorOptions_symbol' - Determines the thousands separator symbol.
--
-- 'visibility', 'thousandSeparatorOptions_visibility' - Determines the visibility of the thousands separator.
newThousandSeparatorOptions ::
  ThousandSeparatorOptions
newThousandSeparatorOptions :: ThousandSeparatorOptions
newThousandSeparatorOptions =
  ThousandSeparatorOptions'
    { $sel:symbol:ThousandSeparatorOptions' :: Maybe NumericSeparatorSymbol
symbol = forall a. Maybe a
Prelude.Nothing,
      $sel:visibility:ThousandSeparatorOptions' :: Maybe Visibility
visibility = forall a. Maybe a
Prelude.Nothing
    }

-- | Determines the thousands separator symbol.
thousandSeparatorOptions_symbol :: Lens.Lens' ThousandSeparatorOptions (Prelude.Maybe NumericSeparatorSymbol)
thousandSeparatorOptions_symbol :: Lens' ThousandSeparatorOptions (Maybe NumericSeparatorSymbol)
thousandSeparatorOptions_symbol = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThousandSeparatorOptions' {Maybe NumericSeparatorSymbol
symbol :: Maybe NumericSeparatorSymbol
$sel:symbol:ThousandSeparatorOptions' :: ThousandSeparatorOptions -> Maybe NumericSeparatorSymbol
symbol} -> Maybe NumericSeparatorSymbol
symbol) (\s :: ThousandSeparatorOptions
s@ThousandSeparatorOptions' {} Maybe NumericSeparatorSymbol
a -> ThousandSeparatorOptions
s {$sel:symbol:ThousandSeparatorOptions' :: Maybe NumericSeparatorSymbol
symbol = Maybe NumericSeparatorSymbol
a} :: ThousandSeparatorOptions)

-- | Determines the visibility of the thousands separator.
thousandSeparatorOptions_visibility :: Lens.Lens' ThousandSeparatorOptions (Prelude.Maybe Visibility)
thousandSeparatorOptions_visibility :: Lens' ThousandSeparatorOptions (Maybe Visibility)
thousandSeparatorOptions_visibility = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThousandSeparatorOptions' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:ThousandSeparatorOptions' :: ThousandSeparatorOptions -> Maybe Visibility
visibility} -> Maybe Visibility
visibility) (\s :: ThousandSeparatorOptions
s@ThousandSeparatorOptions' {} Maybe Visibility
a -> ThousandSeparatorOptions
s {$sel:visibility:ThousandSeparatorOptions' :: Maybe Visibility
visibility = Maybe Visibility
a} :: ThousandSeparatorOptions)

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

instance Prelude.Hashable ThousandSeparatorOptions where
  hashWithSalt :: Int -> ThousandSeparatorOptions -> Int
hashWithSalt Int
_salt ThousandSeparatorOptions' {Maybe NumericSeparatorSymbol
Maybe Visibility
visibility :: Maybe Visibility
symbol :: Maybe NumericSeparatorSymbol
$sel:visibility:ThousandSeparatorOptions' :: ThousandSeparatorOptions -> Maybe Visibility
$sel:symbol:ThousandSeparatorOptions' :: ThousandSeparatorOptions -> Maybe NumericSeparatorSymbol
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NumericSeparatorSymbol
symbol
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Visibility
visibility

instance Prelude.NFData ThousandSeparatorOptions where
  rnf :: ThousandSeparatorOptions -> ()
rnf ThousandSeparatorOptions' {Maybe NumericSeparatorSymbol
Maybe Visibility
visibility :: Maybe Visibility
symbol :: Maybe NumericSeparatorSymbol
$sel:visibility:ThousandSeparatorOptions' :: ThousandSeparatorOptions -> Maybe Visibility
$sel:symbol:ThousandSeparatorOptions' :: ThousandSeparatorOptions -> Maybe NumericSeparatorSymbol
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe NumericSeparatorSymbol
symbol
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Visibility
visibility

instance Data.ToJSON ThousandSeparatorOptions where
  toJSON :: ThousandSeparatorOptions -> Value
toJSON ThousandSeparatorOptions' {Maybe NumericSeparatorSymbol
Maybe Visibility
visibility :: Maybe Visibility
symbol :: Maybe NumericSeparatorSymbol
$sel:visibility:ThousandSeparatorOptions' :: ThousandSeparatorOptions -> Maybe Visibility
$sel:symbol:ThousandSeparatorOptions' :: ThousandSeparatorOptions -> Maybe NumericSeparatorSymbol
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Symbol" 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 NumericSeparatorSymbol
symbol,
            (Key
"Visibility" 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 Visibility
visibility
          ]
      )