{-# 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.NumericSeparatorConfiguration
-- 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.NumericSeparatorConfiguration 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.ThousandSeparatorOptions

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

-- |
-- Create a value of 'NumericSeparatorConfiguration' 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:
--
-- 'decimalSeparator', 'numericSeparatorConfiguration_decimalSeparator' - Determines the decimal separator.
--
-- 'thousandsSeparator', 'numericSeparatorConfiguration_thousandsSeparator' - The options that determine the thousands separator configuration.
newNumericSeparatorConfiguration ::
  NumericSeparatorConfiguration
newNumericSeparatorConfiguration :: NumericSeparatorConfiguration
newNumericSeparatorConfiguration =
  NumericSeparatorConfiguration'
    { $sel:decimalSeparator:NumericSeparatorConfiguration' :: Maybe NumericSeparatorSymbol
decimalSeparator =
        forall a. Maybe a
Prelude.Nothing,
      $sel:thousandsSeparator:NumericSeparatorConfiguration' :: Maybe ThousandSeparatorOptions
thousandsSeparator = forall a. Maybe a
Prelude.Nothing
    }

-- | Determines the decimal separator.
numericSeparatorConfiguration_decimalSeparator :: Lens.Lens' NumericSeparatorConfiguration (Prelude.Maybe NumericSeparatorSymbol)
numericSeparatorConfiguration_decimalSeparator :: Lens' NumericSeparatorConfiguration (Maybe NumericSeparatorSymbol)
numericSeparatorConfiguration_decimalSeparator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NumericSeparatorConfiguration' {Maybe NumericSeparatorSymbol
decimalSeparator :: Maybe NumericSeparatorSymbol
$sel:decimalSeparator:NumericSeparatorConfiguration' :: NumericSeparatorConfiguration -> Maybe NumericSeparatorSymbol
decimalSeparator} -> Maybe NumericSeparatorSymbol
decimalSeparator) (\s :: NumericSeparatorConfiguration
s@NumericSeparatorConfiguration' {} Maybe NumericSeparatorSymbol
a -> NumericSeparatorConfiguration
s {$sel:decimalSeparator:NumericSeparatorConfiguration' :: Maybe NumericSeparatorSymbol
decimalSeparator = Maybe NumericSeparatorSymbol
a} :: NumericSeparatorConfiguration)

-- | The options that determine the thousands separator configuration.
numericSeparatorConfiguration_thousandsSeparator :: Lens.Lens' NumericSeparatorConfiguration (Prelude.Maybe ThousandSeparatorOptions)
numericSeparatorConfiguration_thousandsSeparator :: Lens'
  NumericSeparatorConfiguration (Maybe ThousandSeparatorOptions)
numericSeparatorConfiguration_thousandsSeparator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NumericSeparatorConfiguration' {Maybe ThousandSeparatorOptions
thousandsSeparator :: Maybe ThousandSeparatorOptions
$sel:thousandsSeparator:NumericSeparatorConfiguration' :: NumericSeparatorConfiguration -> Maybe ThousandSeparatorOptions
thousandsSeparator} -> Maybe ThousandSeparatorOptions
thousandsSeparator) (\s :: NumericSeparatorConfiguration
s@NumericSeparatorConfiguration' {} Maybe ThousandSeparatorOptions
a -> NumericSeparatorConfiguration
s {$sel:thousandsSeparator:NumericSeparatorConfiguration' :: Maybe ThousandSeparatorOptions
thousandsSeparator = Maybe ThousandSeparatorOptions
a} :: NumericSeparatorConfiguration)

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

instance
  Prelude.Hashable
    NumericSeparatorConfiguration
  where
  hashWithSalt :: Int -> NumericSeparatorConfiguration -> Int
hashWithSalt Int
_salt NumericSeparatorConfiguration' {Maybe NumericSeparatorSymbol
Maybe ThousandSeparatorOptions
thousandsSeparator :: Maybe ThousandSeparatorOptions
decimalSeparator :: Maybe NumericSeparatorSymbol
$sel:thousandsSeparator:NumericSeparatorConfiguration' :: NumericSeparatorConfiguration -> Maybe ThousandSeparatorOptions
$sel:decimalSeparator:NumericSeparatorConfiguration' :: NumericSeparatorConfiguration -> Maybe NumericSeparatorSymbol
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NumericSeparatorSymbol
decimalSeparator
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ThousandSeparatorOptions
thousandsSeparator

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

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