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

-- | A decimal parameter.
--
-- /See:/ 'newDecimalParameter' smart constructor.
data DecimalParameter = DecimalParameter'
  { -- | A display name for the decimal parameter.
    DecimalParameter -> Text
name :: Prelude.Text,
    -- | The values for the decimal parameter.
    DecimalParameter -> [Sensitive Double]
values :: [Data.Sensitive Prelude.Double]
  }
  deriving (DecimalParameter -> DecimalParameter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DecimalParameter -> DecimalParameter -> Bool
$c/= :: DecimalParameter -> DecimalParameter -> Bool
== :: DecimalParameter -> DecimalParameter -> Bool
$c== :: DecimalParameter -> DecimalParameter -> Bool
Prelude.Eq, Int -> DecimalParameter -> ShowS
[DecimalParameter] -> ShowS
DecimalParameter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DecimalParameter] -> ShowS
$cshowList :: [DecimalParameter] -> ShowS
show :: DecimalParameter -> String
$cshow :: DecimalParameter -> String
showsPrec :: Int -> DecimalParameter -> ShowS
$cshowsPrec :: Int -> DecimalParameter -> ShowS
Prelude.Show, forall x. Rep DecimalParameter x -> DecimalParameter
forall x. DecimalParameter -> Rep DecimalParameter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DecimalParameter x -> DecimalParameter
$cfrom :: forall x. DecimalParameter -> Rep DecimalParameter x
Prelude.Generic)

-- |
-- Create a value of 'DecimalParameter' 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:
--
-- 'name', 'decimalParameter_name' - A display name for the decimal parameter.
--
-- 'values', 'decimalParameter_values' - The values for the decimal parameter.
newDecimalParameter ::
  -- | 'name'
  Prelude.Text ->
  DecimalParameter
newDecimalParameter :: Text -> DecimalParameter
newDecimalParameter Text
pName_ =
  DecimalParameter'
    { $sel:name:DecimalParameter' :: Text
name = Text
pName_,
      $sel:values:DecimalParameter' :: [Sensitive Double]
values = forall a. Monoid a => a
Prelude.mempty
    }

-- | A display name for the decimal parameter.
decimalParameter_name :: Lens.Lens' DecimalParameter Prelude.Text
decimalParameter_name :: Lens' DecimalParameter Text
decimalParameter_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecimalParameter' {Text
name :: Text
$sel:name:DecimalParameter' :: DecimalParameter -> Text
name} -> Text
name) (\s :: DecimalParameter
s@DecimalParameter' {} Text
a -> DecimalParameter
s {$sel:name:DecimalParameter' :: Text
name = Text
a} :: DecimalParameter)

-- | The values for the decimal parameter.
decimalParameter_values :: Lens.Lens' DecimalParameter [Prelude.Double]
decimalParameter_values :: Lens' DecimalParameter [Double]
decimalParameter_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecimalParameter' {[Sensitive Double]
values :: [Sensitive Double]
$sel:values:DecimalParameter' :: DecimalParameter -> [Sensitive Double]
values} -> [Sensitive Double]
values) (\s :: DecimalParameter
s@DecimalParameter' {} [Sensitive Double]
a -> DecimalParameter
s {$sel:values:DecimalParameter' :: [Sensitive Double]
values = [Sensitive Double]
a} :: DecimalParameter) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable DecimalParameter where
  hashWithSalt :: Int -> DecimalParameter -> Int
hashWithSalt Int
_salt DecimalParameter' {[Sensitive Double]
Text
values :: [Sensitive Double]
name :: Text
$sel:values:DecimalParameter' :: DecimalParameter -> [Sensitive Double]
$sel:name:DecimalParameter' :: DecimalParameter -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Sensitive Double]
values

instance Prelude.NFData DecimalParameter where
  rnf :: DecimalParameter -> ()
rnf DecimalParameter' {[Sensitive Double]
Text
values :: [Sensitive Double]
name :: Text
$sel:values:DecimalParameter' :: DecimalParameter -> [Sensitive Double]
$sel:name:DecimalParameter' :: DecimalParameter -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Sensitive Double]
values

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