{-# 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.ParameterTextAreaControl
-- 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.ParameterTextAreaControl 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.TextAreaControlDisplayOptions

-- | A control to display a text box that is used to enter multiple entries.
--
-- /See:/ 'newParameterTextAreaControl' smart constructor.
data ParameterTextAreaControl = ParameterTextAreaControl'
  { -- | The delimiter that is used to separate the lines in text.
    ParameterTextAreaControl -> Maybe Text
delimiter :: Prelude.Maybe Prelude.Text,
    -- | The display options of a control.
    ParameterTextAreaControl -> Maybe TextAreaControlDisplayOptions
displayOptions :: Prelude.Maybe TextAreaControlDisplayOptions,
    -- | The ID of the @ParameterTextAreaControl@.
    ParameterTextAreaControl -> Text
parameterControlId :: Prelude.Text,
    -- | The title of the @ParameterTextAreaControl@.
    ParameterTextAreaControl -> Text
title :: Prelude.Text,
    -- | The source parameter name of the @ParameterTextAreaControl@.
    ParameterTextAreaControl -> Text
sourceParameterName :: Prelude.Text
  }
  deriving (ParameterTextAreaControl -> ParameterTextAreaControl -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParameterTextAreaControl -> ParameterTextAreaControl -> Bool
$c/= :: ParameterTextAreaControl -> ParameterTextAreaControl -> Bool
== :: ParameterTextAreaControl -> ParameterTextAreaControl -> Bool
$c== :: ParameterTextAreaControl -> ParameterTextAreaControl -> Bool
Prelude.Eq, ReadPrec [ParameterTextAreaControl]
ReadPrec ParameterTextAreaControl
Int -> ReadS ParameterTextAreaControl
ReadS [ParameterTextAreaControl]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParameterTextAreaControl]
$creadListPrec :: ReadPrec [ParameterTextAreaControl]
readPrec :: ReadPrec ParameterTextAreaControl
$creadPrec :: ReadPrec ParameterTextAreaControl
readList :: ReadS [ParameterTextAreaControl]
$creadList :: ReadS [ParameterTextAreaControl]
readsPrec :: Int -> ReadS ParameterTextAreaControl
$creadsPrec :: Int -> ReadS ParameterTextAreaControl
Prelude.Read, Int -> ParameterTextAreaControl -> ShowS
[ParameterTextAreaControl] -> ShowS
ParameterTextAreaControl -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParameterTextAreaControl] -> ShowS
$cshowList :: [ParameterTextAreaControl] -> ShowS
show :: ParameterTextAreaControl -> String
$cshow :: ParameterTextAreaControl -> String
showsPrec :: Int -> ParameterTextAreaControl -> ShowS
$cshowsPrec :: Int -> ParameterTextAreaControl -> ShowS
Prelude.Show, forall x.
Rep ParameterTextAreaControl x -> ParameterTextAreaControl
forall x.
ParameterTextAreaControl -> Rep ParameterTextAreaControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ParameterTextAreaControl x -> ParameterTextAreaControl
$cfrom :: forall x.
ParameterTextAreaControl -> Rep ParameterTextAreaControl x
Prelude.Generic)

-- |
-- Create a value of 'ParameterTextAreaControl' 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:
--
-- 'delimiter', 'parameterTextAreaControl_delimiter' - The delimiter that is used to separate the lines in text.
--
-- 'displayOptions', 'parameterTextAreaControl_displayOptions' - The display options of a control.
--
-- 'parameterControlId', 'parameterTextAreaControl_parameterControlId' - The ID of the @ParameterTextAreaControl@.
--
-- 'title', 'parameterTextAreaControl_title' - The title of the @ParameterTextAreaControl@.
--
-- 'sourceParameterName', 'parameterTextAreaControl_sourceParameterName' - The source parameter name of the @ParameterTextAreaControl@.
newParameterTextAreaControl ::
  -- | 'parameterControlId'
  Prelude.Text ->
  -- | 'title'
  Prelude.Text ->
  -- | 'sourceParameterName'
  Prelude.Text ->
  ParameterTextAreaControl
newParameterTextAreaControl :: Text -> Text -> Text -> ParameterTextAreaControl
newParameterTextAreaControl
  Text
pParameterControlId_
  Text
pTitle_
  Text
pSourceParameterName_ =
    ParameterTextAreaControl'
      { $sel:delimiter:ParameterTextAreaControl' :: Maybe Text
delimiter =
          forall a. Maybe a
Prelude.Nothing,
        $sel:displayOptions:ParameterTextAreaControl' :: Maybe TextAreaControlDisplayOptions
displayOptions = forall a. Maybe a
Prelude.Nothing,
        $sel:parameterControlId:ParameterTextAreaControl' :: Text
parameterControlId = Text
pParameterControlId_,
        $sel:title:ParameterTextAreaControl' :: Text
title = Text
pTitle_,
        $sel:sourceParameterName:ParameterTextAreaControl' :: Text
sourceParameterName = Text
pSourceParameterName_
      }

-- | The delimiter that is used to separate the lines in text.
parameterTextAreaControl_delimiter :: Lens.Lens' ParameterTextAreaControl (Prelude.Maybe Prelude.Text)
parameterTextAreaControl_delimiter :: Lens' ParameterTextAreaControl (Maybe Text)
parameterTextAreaControl_delimiter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterTextAreaControl' {Maybe Text
delimiter :: Maybe Text
$sel:delimiter:ParameterTextAreaControl' :: ParameterTextAreaControl -> Maybe Text
delimiter} -> Maybe Text
delimiter) (\s :: ParameterTextAreaControl
s@ParameterTextAreaControl' {} Maybe Text
a -> ParameterTextAreaControl
s {$sel:delimiter:ParameterTextAreaControl' :: Maybe Text
delimiter = Maybe Text
a} :: ParameterTextAreaControl)

-- | The display options of a control.
parameterTextAreaControl_displayOptions :: Lens.Lens' ParameterTextAreaControl (Prelude.Maybe TextAreaControlDisplayOptions)
parameterTextAreaControl_displayOptions :: Lens'
  ParameterTextAreaControl (Maybe TextAreaControlDisplayOptions)
parameterTextAreaControl_displayOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterTextAreaControl' {Maybe TextAreaControlDisplayOptions
displayOptions :: Maybe TextAreaControlDisplayOptions
$sel:displayOptions:ParameterTextAreaControl' :: ParameterTextAreaControl -> Maybe TextAreaControlDisplayOptions
displayOptions} -> Maybe TextAreaControlDisplayOptions
displayOptions) (\s :: ParameterTextAreaControl
s@ParameterTextAreaControl' {} Maybe TextAreaControlDisplayOptions
a -> ParameterTextAreaControl
s {$sel:displayOptions:ParameterTextAreaControl' :: Maybe TextAreaControlDisplayOptions
displayOptions = Maybe TextAreaControlDisplayOptions
a} :: ParameterTextAreaControl)

-- | The ID of the @ParameterTextAreaControl@.
parameterTextAreaControl_parameterControlId :: Lens.Lens' ParameterTextAreaControl Prelude.Text
parameterTextAreaControl_parameterControlId :: Lens' ParameterTextAreaControl Text
parameterTextAreaControl_parameterControlId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterTextAreaControl' {Text
parameterControlId :: Text
$sel:parameterControlId:ParameterTextAreaControl' :: ParameterTextAreaControl -> Text
parameterControlId} -> Text
parameterControlId) (\s :: ParameterTextAreaControl
s@ParameterTextAreaControl' {} Text
a -> ParameterTextAreaControl
s {$sel:parameterControlId:ParameterTextAreaControl' :: Text
parameterControlId = Text
a} :: ParameterTextAreaControl)

-- | The title of the @ParameterTextAreaControl@.
parameterTextAreaControl_title :: Lens.Lens' ParameterTextAreaControl Prelude.Text
parameterTextAreaControl_title :: Lens' ParameterTextAreaControl Text
parameterTextAreaControl_title = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterTextAreaControl' {Text
title :: Text
$sel:title:ParameterTextAreaControl' :: ParameterTextAreaControl -> Text
title} -> Text
title) (\s :: ParameterTextAreaControl
s@ParameterTextAreaControl' {} Text
a -> ParameterTextAreaControl
s {$sel:title:ParameterTextAreaControl' :: Text
title = Text
a} :: ParameterTextAreaControl)

-- | The source parameter name of the @ParameterTextAreaControl@.
parameterTextAreaControl_sourceParameterName :: Lens.Lens' ParameterTextAreaControl Prelude.Text
parameterTextAreaControl_sourceParameterName :: Lens' ParameterTextAreaControl Text
parameterTextAreaControl_sourceParameterName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterTextAreaControl' {Text
sourceParameterName :: Text
$sel:sourceParameterName:ParameterTextAreaControl' :: ParameterTextAreaControl -> Text
sourceParameterName} -> Text
sourceParameterName) (\s :: ParameterTextAreaControl
s@ParameterTextAreaControl' {} Text
a -> ParameterTextAreaControl
s {$sel:sourceParameterName:ParameterTextAreaControl' :: Text
sourceParameterName = Text
a} :: ParameterTextAreaControl)

instance Data.FromJSON ParameterTextAreaControl where
  parseJSON :: Value -> Parser ParameterTextAreaControl
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ParameterTextAreaControl"
      ( \Object
x ->
          Maybe Text
-> Maybe TextAreaControlDisplayOptions
-> Text
-> Text
-> Text
-> ParameterTextAreaControl
ParameterTextAreaControl'
            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
"Delimiter")
            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
"DisplayOptions")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ParameterControlId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Title")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"SourceParameterName")
      )

instance Prelude.Hashable ParameterTextAreaControl where
  hashWithSalt :: Int -> ParameterTextAreaControl -> Int
hashWithSalt Int
_salt ParameterTextAreaControl' {Maybe Text
Maybe TextAreaControlDisplayOptions
Text
sourceParameterName :: Text
title :: Text
parameterControlId :: Text
displayOptions :: Maybe TextAreaControlDisplayOptions
delimiter :: Maybe Text
$sel:sourceParameterName:ParameterTextAreaControl' :: ParameterTextAreaControl -> Text
$sel:title:ParameterTextAreaControl' :: ParameterTextAreaControl -> Text
$sel:parameterControlId:ParameterTextAreaControl' :: ParameterTextAreaControl -> Text
$sel:displayOptions:ParameterTextAreaControl' :: ParameterTextAreaControl -> Maybe TextAreaControlDisplayOptions
$sel:delimiter:ParameterTextAreaControl' :: ParameterTextAreaControl -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
delimiter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TextAreaControlDisplayOptions
displayOptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
parameterControlId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
title
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceParameterName

instance Prelude.NFData ParameterTextAreaControl where
  rnf :: ParameterTextAreaControl -> ()
rnf ParameterTextAreaControl' {Maybe Text
Maybe TextAreaControlDisplayOptions
Text
sourceParameterName :: Text
title :: Text
parameterControlId :: Text
displayOptions :: Maybe TextAreaControlDisplayOptions
delimiter :: Maybe Text
$sel:sourceParameterName:ParameterTextAreaControl' :: ParameterTextAreaControl -> Text
$sel:title:ParameterTextAreaControl' :: ParameterTextAreaControl -> Text
$sel:parameterControlId:ParameterTextAreaControl' :: ParameterTextAreaControl -> Text
$sel:displayOptions:ParameterTextAreaControl' :: ParameterTextAreaControl -> Maybe TextAreaControlDisplayOptions
$sel:delimiter:ParameterTextAreaControl' :: ParameterTextAreaControl -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
delimiter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TextAreaControlDisplayOptions
displayOptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
parameterControlId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
title
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sourceParameterName

instance Data.ToJSON ParameterTextAreaControl where
  toJSON :: ParameterTextAreaControl -> Value
toJSON ParameterTextAreaControl' {Maybe Text
Maybe TextAreaControlDisplayOptions
Text
sourceParameterName :: Text
title :: Text
parameterControlId :: Text
displayOptions :: Maybe TextAreaControlDisplayOptions
delimiter :: Maybe Text
$sel:sourceParameterName:ParameterTextAreaControl' :: ParameterTextAreaControl -> Text
$sel:title:ParameterTextAreaControl' :: ParameterTextAreaControl -> Text
$sel:parameterControlId:ParameterTextAreaControl' :: ParameterTextAreaControl -> Text
$sel:displayOptions:ParameterTextAreaControl' :: ParameterTextAreaControl -> Maybe TextAreaControlDisplayOptions
$sel:delimiter:ParameterTextAreaControl' :: ParameterTextAreaControl -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Delimiter" 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 Text
delimiter,
            (Key
"DisplayOptions" 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 TextAreaControlDisplayOptions
displayOptions,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ParameterControlId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
parameterControlId),
            forall a. a -> Maybe a
Prelude.Just (Key
"Title" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
title),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"SourceParameterName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
sourceParameterName)
          ]
      )