{-# 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.FilterTextAreaControl
-- 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.FilterTextAreaControl 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:/ 'newFilterTextAreaControl' smart constructor.
data FilterTextAreaControl = FilterTextAreaControl'
  { -- | The delimiter that is used to separate the lines in text.
    FilterTextAreaControl -> Maybe Text
delimiter :: Prelude.Maybe Prelude.Text,
    -- | The display options of a control.
    FilterTextAreaControl -> Maybe TextAreaControlDisplayOptions
displayOptions :: Prelude.Maybe TextAreaControlDisplayOptions,
    -- | The ID of the @FilterTextAreaControl@.
    FilterTextAreaControl -> Text
filterControlId :: Prelude.Text,
    -- | The title of the @FilterTextAreaControl@.
    FilterTextAreaControl -> Text
title :: Prelude.Text,
    -- | The source filter ID of the @FilterTextAreaControl@.
    FilterTextAreaControl -> Text
sourceFilterId :: Prelude.Text
  }
  deriving (FilterTextAreaControl -> FilterTextAreaControl -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FilterTextAreaControl -> FilterTextAreaControl -> Bool
$c/= :: FilterTextAreaControl -> FilterTextAreaControl -> Bool
== :: FilterTextAreaControl -> FilterTextAreaControl -> Bool
$c== :: FilterTextAreaControl -> FilterTextAreaControl -> Bool
Prelude.Eq, ReadPrec [FilterTextAreaControl]
ReadPrec FilterTextAreaControl
Int -> ReadS FilterTextAreaControl
ReadS [FilterTextAreaControl]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FilterTextAreaControl]
$creadListPrec :: ReadPrec [FilterTextAreaControl]
readPrec :: ReadPrec FilterTextAreaControl
$creadPrec :: ReadPrec FilterTextAreaControl
readList :: ReadS [FilterTextAreaControl]
$creadList :: ReadS [FilterTextAreaControl]
readsPrec :: Int -> ReadS FilterTextAreaControl
$creadsPrec :: Int -> ReadS FilterTextAreaControl
Prelude.Read, Int -> FilterTextAreaControl -> ShowS
[FilterTextAreaControl] -> ShowS
FilterTextAreaControl -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FilterTextAreaControl] -> ShowS
$cshowList :: [FilterTextAreaControl] -> ShowS
show :: FilterTextAreaControl -> String
$cshow :: FilterTextAreaControl -> String
showsPrec :: Int -> FilterTextAreaControl -> ShowS
$cshowsPrec :: Int -> FilterTextAreaControl -> ShowS
Prelude.Show, forall x. Rep FilterTextAreaControl x -> FilterTextAreaControl
forall x. FilterTextAreaControl -> Rep FilterTextAreaControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FilterTextAreaControl x -> FilterTextAreaControl
$cfrom :: forall x. FilterTextAreaControl -> Rep FilterTextAreaControl x
Prelude.Generic)

-- |
-- Create a value of 'FilterTextAreaControl' 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', 'filterTextAreaControl_delimiter' - The delimiter that is used to separate the lines in text.
--
-- 'displayOptions', 'filterTextAreaControl_displayOptions' - The display options of a control.
--
-- 'filterControlId', 'filterTextAreaControl_filterControlId' - The ID of the @FilterTextAreaControl@.
--
-- 'title', 'filterTextAreaControl_title' - The title of the @FilterTextAreaControl@.
--
-- 'sourceFilterId', 'filterTextAreaControl_sourceFilterId' - The source filter ID of the @FilterTextAreaControl@.
newFilterTextAreaControl ::
  -- | 'filterControlId'
  Prelude.Text ->
  -- | 'title'
  Prelude.Text ->
  -- | 'sourceFilterId'
  Prelude.Text ->
  FilterTextAreaControl
newFilterTextAreaControl :: Text -> Text -> Text -> FilterTextAreaControl
newFilterTextAreaControl
  Text
pFilterControlId_
  Text
pTitle_
  Text
pSourceFilterId_ =
    FilterTextAreaControl'
      { $sel:delimiter:FilterTextAreaControl' :: Maybe Text
delimiter = forall a. Maybe a
Prelude.Nothing,
        $sel:displayOptions:FilterTextAreaControl' :: Maybe TextAreaControlDisplayOptions
displayOptions = forall a. Maybe a
Prelude.Nothing,
        $sel:filterControlId:FilterTextAreaControl' :: Text
filterControlId = Text
pFilterControlId_,
        $sel:title:FilterTextAreaControl' :: Text
title = Text
pTitle_,
        $sel:sourceFilterId:FilterTextAreaControl' :: Text
sourceFilterId = Text
pSourceFilterId_
      }

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

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

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

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

-- | The source filter ID of the @FilterTextAreaControl@.
filterTextAreaControl_sourceFilterId :: Lens.Lens' FilterTextAreaControl Prelude.Text
filterTextAreaControl_sourceFilterId :: Lens' FilterTextAreaControl Text
filterTextAreaControl_sourceFilterId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterTextAreaControl' {Text
sourceFilterId :: Text
$sel:sourceFilterId:FilterTextAreaControl' :: FilterTextAreaControl -> Text
sourceFilterId} -> Text
sourceFilterId) (\s :: FilterTextAreaControl
s@FilterTextAreaControl' {} Text
a -> FilterTextAreaControl
s {$sel:sourceFilterId:FilterTextAreaControl' :: Text
sourceFilterId = Text
a} :: FilterTextAreaControl)

instance Data.FromJSON FilterTextAreaControl where
  parseJSON :: Value -> Parser FilterTextAreaControl
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FilterTextAreaControl"
      ( \Object
x ->
          Maybe Text
-> Maybe TextAreaControlDisplayOptions
-> Text
-> Text
-> Text
-> FilterTextAreaControl
FilterTextAreaControl'
            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
"FilterControlId")
            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
"SourceFilterId")
      )

instance Prelude.Hashable FilterTextAreaControl where
  hashWithSalt :: Int -> FilterTextAreaControl -> Int
hashWithSalt Int
_salt FilterTextAreaControl' {Maybe Text
Maybe TextAreaControlDisplayOptions
Text
sourceFilterId :: Text
title :: Text
filterControlId :: Text
displayOptions :: Maybe TextAreaControlDisplayOptions
delimiter :: Maybe Text
$sel:sourceFilterId:FilterTextAreaControl' :: FilterTextAreaControl -> Text
$sel:title:FilterTextAreaControl' :: FilterTextAreaControl -> Text
$sel:filterControlId:FilterTextAreaControl' :: FilterTextAreaControl -> Text
$sel:displayOptions:FilterTextAreaControl' :: FilterTextAreaControl -> Maybe TextAreaControlDisplayOptions
$sel:delimiter:FilterTextAreaControl' :: FilterTextAreaControl -> 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
filterControlId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
title
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceFilterId

instance Prelude.NFData FilterTextAreaControl where
  rnf :: FilterTextAreaControl -> ()
rnf FilterTextAreaControl' {Maybe Text
Maybe TextAreaControlDisplayOptions
Text
sourceFilterId :: Text
title :: Text
filterControlId :: Text
displayOptions :: Maybe TextAreaControlDisplayOptions
delimiter :: Maybe Text
$sel:sourceFilterId:FilterTextAreaControl' :: FilterTextAreaControl -> Text
$sel:title:FilterTextAreaControl' :: FilterTextAreaControl -> Text
$sel:filterControlId:FilterTextAreaControl' :: FilterTextAreaControl -> Text
$sel:displayOptions:FilterTextAreaControl' :: FilterTextAreaControl -> Maybe TextAreaControlDisplayOptions
$sel:delimiter:FilterTextAreaControl' :: FilterTextAreaControl -> 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
filterControlId
      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
sourceFilterId

instance Data.ToJSON FilterTextAreaControl where
  toJSON :: FilterTextAreaControl -> Value
toJSON FilterTextAreaControl' {Maybe Text
Maybe TextAreaControlDisplayOptions
Text
sourceFilterId :: Text
title :: Text
filterControlId :: Text
displayOptions :: Maybe TextAreaControlDisplayOptions
delimiter :: Maybe Text
$sel:sourceFilterId:FilterTextAreaControl' :: FilterTextAreaControl -> Text
$sel:title:FilterTextAreaControl' :: FilterTextAreaControl -> Text
$sel:filterControlId:FilterTextAreaControl' :: FilterTextAreaControl -> Text
$sel:displayOptions:FilterTextAreaControl' :: FilterTextAreaControl -> Maybe TextAreaControlDisplayOptions
$sel:delimiter:FilterTextAreaControl' :: FilterTextAreaControl -> 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
"FilterControlId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
filterControlId),
            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
"SourceFilterId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
sourceFilterId)
          ]
      )