{-# 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.DecimalPlacesConfiguration
-- 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.DecimalPlacesConfiguration 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 option that determines the decimal places configuration.
--
-- /See:/ 'newDecimalPlacesConfiguration' smart constructor.
data DecimalPlacesConfiguration = DecimalPlacesConfiguration'
  { -- | The values of the decimal places.
    DecimalPlacesConfiguration -> Natural
decimalPlaces :: Prelude.Natural
  }
  deriving (DecimalPlacesConfiguration -> DecimalPlacesConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DecimalPlacesConfiguration -> DecimalPlacesConfiguration -> Bool
$c/= :: DecimalPlacesConfiguration -> DecimalPlacesConfiguration -> Bool
== :: DecimalPlacesConfiguration -> DecimalPlacesConfiguration -> Bool
$c== :: DecimalPlacesConfiguration -> DecimalPlacesConfiguration -> Bool
Prelude.Eq, ReadPrec [DecimalPlacesConfiguration]
ReadPrec DecimalPlacesConfiguration
Int -> ReadS DecimalPlacesConfiguration
ReadS [DecimalPlacesConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DecimalPlacesConfiguration]
$creadListPrec :: ReadPrec [DecimalPlacesConfiguration]
readPrec :: ReadPrec DecimalPlacesConfiguration
$creadPrec :: ReadPrec DecimalPlacesConfiguration
readList :: ReadS [DecimalPlacesConfiguration]
$creadList :: ReadS [DecimalPlacesConfiguration]
readsPrec :: Int -> ReadS DecimalPlacesConfiguration
$creadsPrec :: Int -> ReadS DecimalPlacesConfiguration
Prelude.Read, Int -> DecimalPlacesConfiguration -> ShowS
[DecimalPlacesConfiguration] -> ShowS
DecimalPlacesConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DecimalPlacesConfiguration] -> ShowS
$cshowList :: [DecimalPlacesConfiguration] -> ShowS
show :: DecimalPlacesConfiguration -> String
$cshow :: DecimalPlacesConfiguration -> String
showsPrec :: Int -> DecimalPlacesConfiguration -> ShowS
$cshowsPrec :: Int -> DecimalPlacesConfiguration -> ShowS
Prelude.Show, forall x.
Rep DecimalPlacesConfiguration x -> DecimalPlacesConfiguration
forall x.
DecimalPlacesConfiguration -> Rep DecimalPlacesConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DecimalPlacesConfiguration x -> DecimalPlacesConfiguration
$cfrom :: forall x.
DecimalPlacesConfiguration -> Rep DecimalPlacesConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DecimalPlacesConfiguration' 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:
--
-- 'decimalPlaces', 'decimalPlacesConfiguration_decimalPlaces' - The values of the decimal places.
newDecimalPlacesConfiguration ::
  -- | 'decimalPlaces'
  Prelude.Natural ->
  DecimalPlacesConfiguration
newDecimalPlacesConfiguration :: Natural -> DecimalPlacesConfiguration
newDecimalPlacesConfiguration Natural
pDecimalPlaces_ =
  DecimalPlacesConfiguration'
    { $sel:decimalPlaces:DecimalPlacesConfiguration' :: Natural
decimalPlaces =
        Natural
pDecimalPlaces_
    }

-- | The values of the decimal places.
decimalPlacesConfiguration_decimalPlaces :: Lens.Lens' DecimalPlacesConfiguration Prelude.Natural
decimalPlacesConfiguration_decimalPlaces :: Lens' DecimalPlacesConfiguration Natural
decimalPlacesConfiguration_decimalPlaces = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecimalPlacesConfiguration' {Natural
decimalPlaces :: Natural
$sel:decimalPlaces:DecimalPlacesConfiguration' :: DecimalPlacesConfiguration -> Natural
decimalPlaces} -> Natural
decimalPlaces) (\s :: DecimalPlacesConfiguration
s@DecimalPlacesConfiguration' {} Natural
a -> DecimalPlacesConfiguration
s {$sel:decimalPlaces:DecimalPlacesConfiguration' :: Natural
decimalPlaces = Natural
a} :: DecimalPlacesConfiguration)

instance Data.FromJSON DecimalPlacesConfiguration where
  parseJSON :: Value -> Parser DecimalPlacesConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DecimalPlacesConfiguration"
      ( \Object
x ->
          Natural -> DecimalPlacesConfiguration
DecimalPlacesConfiguration'
            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
"DecimalPlaces")
      )

instance Prelude.Hashable DecimalPlacesConfiguration where
  hashWithSalt :: Int -> DecimalPlacesConfiguration -> Int
hashWithSalt Int
_salt DecimalPlacesConfiguration' {Natural
decimalPlaces :: Natural
$sel:decimalPlaces:DecimalPlacesConfiguration' :: DecimalPlacesConfiguration -> Natural
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
decimalPlaces

instance Prelude.NFData DecimalPlacesConfiguration where
  rnf :: DecimalPlacesConfiguration -> ()
rnf DecimalPlacesConfiguration' {Natural
decimalPlaces :: Natural
$sel:decimalPlaces:DecimalPlacesConfiguration' :: DecimalPlacesConfiguration -> Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Natural
decimalPlaces

instance Data.ToJSON DecimalPlacesConfiguration where
  toJSON :: DecimalPlacesConfiguration -> Value
toJSON DecimalPlacesConfiguration' {Natural
decimalPlaces :: Natural
$sel:decimalPlaces:DecimalPlacesConfiguration' :: DecimalPlacesConfiguration -> Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"DecimalPlaces" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
decimalPlaces)
          ]
      )