{-# 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.StringParameter
-- 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.StringParameter where

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

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

-- |
-- Create a value of 'StringParameter' 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', 'stringParameter_name' - A display name for a string parameter.
--
-- 'values', 'stringParameter_values' - The values of a string parameter.
newStringParameter ::
  -- | 'name'
  Prelude.Text ->
  StringParameter
newStringParameter :: Text -> StringParameter
newStringParameter Text
pName_ =
  StringParameter' :: Text -> [Text] -> StringParameter
StringParameter'
    { $sel:name:StringParameter' :: Text
name = Text
pName_,
      $sel:values:StringParameter' :: [Text]
values = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | A display name for a string parameter.
stringParameter_name :: Lens.Lens' StringParameter Prelude.Text
stringParameter_name :: (Text -> f Text) -> StringParameter -> f StringParameter
stringParameter_name = (StringParameter -> Text)
-> (StringParameter -> Text -> StringParameter)
-> Lens StringParameter StringParameter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StringParameter' {Text
name :: Text
$sel:name:StringParameter' :: StringParameter -> Text
name} -> Text
name) (\s :: StringParameter
s@StringParameter' {} Text
a -> StringParameter
s {$sel:name:StringParameter' :: Text
name = Text
a} :: StringParameter)

-- | The values of a string parameter.
stringParameter_values :: Lens.Lens' StringParameter [Prelude.Text]
stringParameter_values :: ([Text] -> f [Text]) -> StringParameter -> f StringParameter
stringParameter_values = (StringParameter -> [Text])
-> (StringParameter -> [Text] -> StringParameter)
-> Lens StringParameter StringParameter [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StringParameter' {[Text]
values :: [Text]
$sel:values:StringParameter' :: StringParameter -> [Text]
values} -> [Text]
values) (\s :: StringParameter
s@StringParameter' {} [Text]
a -> StringParameter
s {$sel:values:StringParameter' :: [Text]
values = [Text]
a} :: StringParameter) (([Text] -> f [Text]) -> StringParameter -> f StringParameter)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> StringParameter
-> f StringParameter
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable StringParameter

instance Prelude.NFData StringParameter

instance Core.ToJSON StringParameter where
  toJSON :: StringParameter -> Value
toJSON StringParameter' {[Text]
Text
values :: [Text]
name :: Text
$sel:values:StringParameter' :: StringParameter -> [Text]
$sel:name:StringParameter' :: StringParameter -> 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 -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
values)
          ]
      )