{-# 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.IntegerParameter
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.QuickSight.Types.IntegerParameter where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An integer parameter.
--
-- /See:/ 'newIntegerParameter' smart constructor.
data IntegerParameter = IntegerParameter'
  { -- | The name of the integer parameter.
    IntegerParameter -> Text
name :: Prelude.Text,
    -- | The values for the integer parameter.
    IntegerParameter -> [Integer]
values :: [Prelude.Integer]
  }
  deriving (IntegerParameter -> IntegerParameter -> Bool
(IntegerParameter -> IntegerParameter -> Bool)
-> (IntegerParameter -> IntegerParameter -> Bool)
-> Eq IntegerParameter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntegerParameter -> IntegerParameter -> Bool
$c/= :: IntegerParameter -> IntegerParameter -> Bool
== :: IntegerParameter -> IntegerParameter -> Bool
$c== :: IntegerParameter -> IntegerParameter -> Bool
Prelude.Eq, ReadPrec [IntegerParameter]
ReadPrec IntegerParameter
Int -> ReadS IntegerParameter
ReadS [IntegerParameter]
(Int -> ReadS IntegerParameter)
-> ReadS [IntegerParameter]
-> ReadPrec IntegerParameter
-> ReadPrec [IntegerParameter]
-> Read IntegerParameter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IntegerParameter]
$creadListPrec :: ReadPrec [IntegerParameter]
readPrec :: ReadPrec IntegerParameter
$creadPrec :: ReadPrec IntegerParameter
readList :: ReadS [IntegerParameter]
$creadList :: ReadS [IntegerParameter]
readsPrec :: Int -> ReadS IntegerParameter
$creadsPrec :: Int -> ReadS IntegerParameter
Prelude.Read, Int -> IntegerParameter -> ShowS
[IntegerParameter] -> ShowS
IntegerParameter -> String
(Int -> IntegerParameter -> ShowS)
-> (IntegerParameter -> String)
-> ([IntegerParameter] -> ShowS)
-> Show IntegerParameter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IntegerParameter] -> ShowS
$cshowList :: [IntegerParameter] -> ShowS
show :: IntegerParameter -> String
$cshow :: IntegerParameter -> String
showsPrec :: Int -> IntegerParameter -> ShowS
$cshowsPrec :: Int -> IntegerParameter -> ShowS
Prelude.Show, (forall x. IntegerParameter -> Rep IntegerParameter x)
-> (forall x. Rep IntegerParameter x -> IntegerParameter)
-> Generic IntegerParameter
forall x. Rep IntegerParameter x -> IntegerParameter
forall x. IntegerParameter -> Rep IntegerParameter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IntegerParameter x -> IntegerParameter
$cfrom :: forall x. IntegerParameter -> Rep IntegerParameter x
Prelude.Generic)

-- |
-- Create a value of 'IntegerParameter' 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', 'integerParameter_name' - The name of the integer parameter.
--
-- 'values', 'integerParameter_values' - The values for the integer parameter.
newIntegerParameter ::
  -- | 'name'
  Prelude.Text ->
  IntegerParameter
newIntegerParameter :: Text -> IntegerParameter
newIntegerParameter Text
pName_ =
  IntegerParameter' :: Text -> [Integer] -> IntegerParameter
IntegerParameter'
    { $sel:name:IntegerParameter' :: Text
name = Text
pName_,
      $sel:values:IntegerParameter' :: [Integer]
values = [Integer]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The name of the integer parameter.
integerParameter_name :: Lens.Lens' IntegerParameter Prelude.Text
integerParameter_name :: (Text -> f Text) -> IntegerParameter -> f IntegerParameter
integerParameter_name = (IntegerParameter -> Text)
-> (IntegerParameter -> Text -> IntegerParameter)
-> Lens IntegerParameter IntegerParameter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntegerParameter' {Text
name :: Text
$sel:name:IntegerParameter' :: IntegerParameter -> Text
name} -> Text
name) (\s :: IntegerParameter
s@IntegerParameter' {} Text
a -> IntegerParameter
s {$sel:name:IntegerParameter' :: Text
name = Text
a} :: IntegerParameter)

-- | The values for the integer parameter.
integerParameter_values :: Lens.Lens' IntegerParameter [Prelude.Integer]
integerParameter_values :: ([Integer] -> f [Integer])
-> IntegerParameter -> f IntegerParameter
integerParameter_values = (IntegerParameter -> [Integer])
-> (IntegerParameter -> [Integer] -> IntegerParameter)
-> Lens IntegerParameter IntegerParameter [Integer] [Integer]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntegerParameter' {[Integer]
values :: [Integer]
$sel:values:IntegerParameter' :: IntegerParameter -> [Integer]
values} -> [Integer]
values) (\s :: IntegerParameter
s@IntegerParameter' {} [Integer]
a -> IntegerParameter
s {$sel:values:IntegerParameter' :: [Integer]
values = [Integer]
a} :: IntegerParameter) (([Integer] -> f [Integer])
 -> IntegerParameter -> f IntegerParameter)
-> (([Integer] -> f [Integer]) -> [Integer] -> f [Integer])
-> ([Integer] -> f [Integer])
-> IntegerParameter
-> f IntegerParameter
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Integer] -> f [Integer]) -> [Integer] -> f [Integer]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable IntegerParameter

instance Prelude.NFData IntegerParameter

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