{-# 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.ParameterListControl
-- 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.ParameterListControl 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.CascadingControlConfiguration
import Amazonka.QuickSight.Types.ListControlDisplayOptions
import Amazonka.QuickSight.Types.ParameterSelectableValues
import Amazonka.QuickSight.Types.SheetControlListType

-- | A control to display a list with buttons or boxes that are used to
-- select either a single value or multiple values.
--
-- /See:/ 'newParameterListControl' smart constructor.
data ParameterListControl = ParameterListControl'
  { -- | The values that are displayed in a control can be configured to only
    -- show values that are valid based on what\'s selected in other controls.
    ParameterListControl -> Maybe CascadingControlConfiguration
cascadingControlConfiguration :: Prelude.Maybe CascadingControlConfiguration,
    -- | The display options of a control.
    ParameterListControl -> Maybe ListControlDisplayOptions
displayOptions :: Prelude.Maybe ListControlDisplayOptions,
    -- | A list of selectable values that are used in a control.
    ParameterListControl -> Maybe ParameterSelectableValues
selectableValues :: Prelude.Maybe ParameterSelectableValues,
    -- | The type of @ParameterListControl@.
    ParameterListControl -> Maybe SheetControlListType
type' :: Prelude.Maybe SheetControlListType,
    -- | The ID of the @ParameterListControl@.
    ParameterListControl -> Text
parameterControlId :: Prelude.Text,
    -- | The title of the @ParameterListControl@.
    ParameterListControl -> Text
title :: Prelude.Text,
    -- | The source parameter name of the @ParameterListControl@.
    ParameterListControl -> Text
sourceParameterName :: Prelude.Text
  }
  deriving (ParameterListControl -> ParameterListControl -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParameterListControl -> ParameterListControl -> Bool
$c/= :: ParameterListControl -> ParameterListControl -> Bool
== :: ParameterListControl -> ParameterListControl -> Bool
$c== :: ParameterListControl -> ParameterListControl -> Bool
Prelude.Eq, ReadPrec [ParameterListControl]
ReadPrec ParameterListControl
Int -> ReadS ParameterListControl
ReadS [ParameterListControl]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParameterListControl]
$creadListPrec :: ReadPrec [ParameterListControl]
readPrec :: ReadPrec ParameterListControl
$creadPrec :: ReadPrec ParameterListControl
readList :: ReadS [ParameterListControl]
$creadList :: ReadS [ParameterListControl]
readsPrec :: Int -> ReadS ParameterListControl
$creadsPrec :: Int -> ReadS ParameterListControl
Prelude.Read, Int -> ParameterListControl -> ShowS
[ParameterListControl] -> ShowS
ParameterListControl -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParameterListControl] -> ShowS
$cshowList :: [ParameterListControl] -> ShowS
show :: ParameterListControl -> String
$cshow :: ParameterListControl -> String
showsPrec :: Int -> ParameterListControl -> ShowS
$cshowsPrec :: Int -> ParameterListControl -> ShowS
Prelude.Show, forall x. Rep ParameterListControl x -> ParameterListControl
forall x. ParameterListControl -> Rep ParameterListControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ParameterListControl x -> ParameterListControl
$cfrom :: forall x. ParameterListControl -> Rep ParameterListControl x
Prelude.Generic)

-- |
-- Create a value of 'ParameterListControl' 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:
--
-- 'cascadingControlConfiguration', 'parameterListControl_cascadingControlConfiguration' - The values that are displayed in a control can be configured to only
-- show values that are valid based on what\'s selected in other controls.
--
-- 'displayOptions', 'parameterListControl_displayOptions' - The display options of a control.
--
-- 'selectableValues', 'parameterListControl_selectableValues' - A list of selectable values that are used in a control.
--
-- 'type'', 'parameterListControl_type' - The type of @ParameterListControl@.
--
-- 'parameterControlId', 'parameterListControl_parameterControlId' - The ID of the @ParameterListControl@.
--
-- 'title', 'parameterListControl_title' - The title of the @ParameterListControl@.
--
-- 'sourceParameterName', 'parameterListControl_sourceParameterName' - The source parameter name of the @ParameterListControl@.
newParameterListControl ::
  -- | 'parameterControlId'
  Prelude.Text ->
  -- | 'title'
  Prelude.Text ->
  -- | 'sourceParameterName'
  Prelude.Text ->
  ParameterListControl
newParameterListControl :: Text -> Text -> Text -> ParameterListControl
newParameterListControl
  Text
pParameterControlId_
  Text
pTitle_
  Text
pSourceParameterName_ =
    ParameterListControl'
      { $sel:cascadingControlConfiguration:ParameterListControl' :: Maybe CascadingControlConfiguration
cascadingControlConfiguration =
          forall a. Maybe a
Prelude.Nothing,
        $sel:displayOptions:ParameterListControl' :: Maybe ListControlDisplayOptions
displayOptions = forall a. Maybe a
Prelude.Nothing,
        $sel:selectableValues:ParameterListControl' :: Maybe ParameterSelectableValues
selectableValues = forall a. Maybe a
Prelude.Nothing,
        $sel:type':ParameterListControl' :: Maybe SheetControlListType
type' = forall a. Maybe a
Prelude.Nothing,
        $sel:parameterControlId:ParameterListControl' :: Text
parameterControlId = Text
pParameterControlId_,
        $sel:title:ParameterListControl' :: Text
title = Text
pTitle_,
        $sel:sourceParameterName:ParameterListControl' :: Text
sourceParameterName = Text
pSourceParameterName_
      }

-- | The values that are displayed in a control can be configured to only
-- show values that are valid based on what\'s selected in other controls.
parameterListControl_cascadingControlConfiguration :: Lens.Lens' ParameterListControl (Prelude.Maybe CascadingControlConfiguration)
parameterListControl_cascadingControlConfiguration :: Lens' ParameterListControl (Maybe CascadingControlConfiguration)
parameterListControl_cascadingControlConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterListControl' {Maybe CascadingControlConfiguration
cascadingControlConfiguration :: Maybe CascadingControlConfiguration
$sel:cascadingControlConfiguration:ParameterListControl' :: ParameterListControl -> Maybe CascadingControlConfiguration
cascadingControlConfiguration} -> Maybe CascadingControlConfiguration
cascadingControlConfiguration) (\s :: ParameterListControl
s@ParameterListControl' {} Maybe CascadingControlConfiguration
a -> ParameterListControl
s {$sel:cascadingControlConfiguration:ParameterListControl' :: Maybe CascadingControlConfiguration
cascadingControlConfiguration = Maybe CascadingControlConfiguration
a} :: ParameterListControl)

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

-- | A list of selectable values that are used in a control.
parameterListControl_selectableValues :: Lens.Lens' ParameterListControl (Prelude.Maybe ParameterSelectableValues)
parameterListControl_selectableValues :: Lens' ParameterListControl (Maybe ParameterSelectableValues)
parameterListControl_selectableValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterListControl' {Maybe ParameterSelectableValues
selectableValues :: Maybe ParameterSelectableValues
$sel:selectableValues:ParameterListControl' :: ParameterListControl -> Maybe ParameterSelectableValues
selectableValues} -> Maybe ParameterSelectableValues
selectableValues) (\s :: ParameterListControl
s@ParameterListControl' {} Maybe ParameterSelectableValues
a -> ParameterListControl
s {$sel:selectableValues:ParameterListControl' :: Maybe ParameterSelectableValues
selectableValues = Maybe ParameterSelectableValues
a} :: ParameterListControl)

-- | The type of @ParameterListControl@.
parameterListControl_type :: Lens.Lens' ParameterListControl (Prelude.Maybe SheetControlListType)
parameterListControl_type :: Lens' ParameterListControl (Maybe SheetControlListType)
parameterListControl_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterListControl' {Maybe SheetControlListType
type' :: Maybe SheetControlListType
$sel:type':ParameterListControl' :: ParameterListControl -> Maybe SheetControlListType
type'} -> Maybe SheetControlListType
type') (\s :: ParameterListControl
s@ParameterListControl' {} Maybe SheetControlListType
a -> ParameterListControl
s {$sel:type':ParameterListControl' :: Maybe SheetControlListType
type' = Maybe SheetControlListType
a} :: ParameterListControl)

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

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

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

instance Data.FromJSON ParameterListControl where
  parseJSON :: Value -> Parser ParameterListControl
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ParameterListControl"
      ( \Object
x ->
          Maybe CascadingControlConfiguration
-> Maybe ListControlDisplayOptions
-> Maybe ParameterSelectableValues
-> Maybe SheetControlListType
-> Text
-> Text
-> Text
-> ParameterListControl
ParameterListControl'
            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
"CascadingControlConfiguration")
            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 (Maybe a)
Data..:? Key
"SelectableValues")
            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
"Type")
            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 ParameterListControl where
  hashWithSalt :: Int -> ParameterListControl -> Int
hashWithSalt Int
_salt ParameterListControl' {Maybe CascadingControlConfiguration
Maybe ParameterSelectableValues
Maybe SheetControlListType
Maybe ListControlDisplayOptions
Text
sourceParameterName :: Text
title :: Text
parameterControlId :: Text
type' :: Maybe SheetControlListType
selectableValues :: Maybe ParameterSelectableValues
displayOptions :: Maybe ListControlDisplayOptions
cascadingControlConfiguration :: Maybe CascadingControlConfiguration
$sel:sourceParameterName:ParameterListControl' :: ParameterListControl -> Text
$sel:title:ParameterListControl' :: ParameterListControl -> Text
$sel:parameterControlId:ParameterListControl' :: ParameterListControl -> Text
$sel:type':ParameterListControl' :: ParameterListControl -> Maybe SheetControlListType
$sel:selectableValues:ParameterListControl' :: ParameterListControl -> Maybe ParameterSelectableValues
$sel:displayOptions:ParameterListControl' :: ParameterListControl -> Maybe ListControlDisplayOptions
$sel:cascadingControlConfiguration:ParameterListControl' :: ParameterListControl -> Maybe CascadingControlConfiguration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CascadingControlConfiguration
cascadingControlConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ListControlDisplayOptions
displayOptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ParameterSelectableValues
selectableValues
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SheetControlListType
type'
      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 ParameterListControl where
  rnf :: ParameterListControl -> ()
rnf ParameterListControl' {Maybe CascadingControlConfiguration
Maybe ParameterSelectableValues
Maybe SheetControlListType
Maybe ListControlDisplayOptions
Text
sourceParameterName :: Text
title :: Text
parameterControlId :: Text
type' :: Maybe SheetControlListType
selectableValues :: Maybe ParameterSelectableValues
displayOptions :: Maybe ListControlDisplayOptions
cascadingControlConfiguration :: Maybe CascadingControlConfiguration
$sel:sourceParameterName:ParameterListControl' :: ParameterListControl -> Text
$sel:title:ParameterListControl' :: ParameterListControl -> Text
$sel:parameterControlId:ParameterListControl' :: ParameterListControl -> Text
$sel:type':ParameterListControl' :: ParameterListControl -> Maybe SheetControlListType
$sel:selectableValues:ParameterListControl' :: ParameterListControl -> Maybe ParameterSelectableValues
$sel:displayOptions:ParameterListControl' :: ParameterListControl -> Maybe ListControlDisplayOptions
$sel:cascadingControlConfiguration:ParameterListControl' :: ParameterListControl -> Maybe CascadingControlConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CascadingControlConfiguration
cascadingControlConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ListControlDisplayOptions
displayOptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ParameterSelectableValues
selectableValues
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SheetControlListType
type'
      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 ParameterListControl where
  toJSON :: ParameterListControl -> Value
toJSON ParameterListControl' {Maybe CascadingControlConfiguration
Maybe ParameterSelectableValues
Maybe SheetControlListType
Maybe ListControlDisplayOptions
Text
sourceParameterName :: Text
title :: Text
parameterControlId :: Text
type' :: Maybe SheetControlListType
selectableValues :: Maybe ParameterSelectableValues
displayOptions :: Maybe ListControlDisplayOptions
cascadingControlConfiguration :: Maybe CascadingControlConfiguration
$sel:sourceParameterName:ParameterListControl' :: ParameterListControl -> Text
$sel:title:ParameterListControl' :: ParameterListControl -> Text
$sel:parameterControlId:ParameterListControl' :: ParameterListControl -> Text
$sel:type':ParameterListControl' :: ParameterListControl -> Maybe SheetControlListType
$sel:selectableValues:ParameterListControl' :: ParameterListControl -> Maybe ParameterSelectableValues
$sel:displayOptions:ParameterListControl' :: ParameterListControl -> Maybe ListControlDisplayOptions
$sel:cascadingControlConfiguration:ParameterListControl' :: ParameterListControl -> Maybe CascadingControlConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CascadingControlConfiguration" 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 CascadingControlConfiguration
cascadingControlConfiguration,
            (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 ListControlDisplayOptions
displayOptions,
            (Key
"SelectableValues" 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 ParameterSelectableValues
selectableValues,
            (Key
"Type" 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 SheetControlListType
type',
            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)
          ]
      )