{-# 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.ParameterSliderControl
-- 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.ParameterSliderControl 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.SliderControlDisplayOptions

-- | A control to display a horizontal toggle bar. This is used to change a
-- value by sliding the toggle.
--
-- /See:/ 'newParameterSliderControl' smart constructor.
data ParameterSliderControl = ParameterSliderControl'
  { -- | The display options of a control.
    ParameterSliderControl -> Maybe SliderControlDisplayOptions
displayOptions :: Prelude.Maybe SliderControlDisplayOptions,
    -- | The ID of the @ParameterSliderControl@.
    ParameterSliderControl -> Text
parameterControlId :: Prelude.Text,
    -- | The title of the @ParameterSliderControl@.
    ParameterSliderControl -> Text
title :: Prelude.Text,
    -- | The source parameter name of the @ParameterSliderControl@.
    ParameterSliderControl -> Text
sourceParameterName :: Prelude.Text,
    -- | The smaller value that is displayed at the left of the slider.
    ParameterSliderControl -> Double
maximumValue :: Prelude.Double,
    -- | The larger value that is displayed at the right of the slider.
    ParameterSliderControl -> Double
minimumValue :: Prelude.Double,
    -- | The number of increments that the slider bar is divided into.
    ParameterSliderControl -> Double
stepSize :: Prelude.Double
  }
  deriving (ParameterSliderControl -> ParameterSliderControl -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParameterSliderControl -> ParameterSliderControl -> Bool
$c/= :: ParameterSliderControl -> ParameterSliderControl -> Bool
== :: ParameterSliderControl -> ParameterSliderControl -> Bool
$c== :: ParameterSliderControl -> ParameterSliderControl -> Bool
Prelude.Eq, ReadPrec [ParameterSliderControl]
ReadPrec ParameterSliderControl
Int -> ReadS ParameterSliderControl
ReadS [ParameterSliderControl]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParameterSliderControl]
$creadListPrec :: ReadPrec [ParameterSliderControl]
readPrec :: ReadPrec ParameterSliderControl
$creadPrec :: ReadPrec ParameterSliderControl
readList :: ReadS [ParameterSliderControl]
$creadList :: ReadS [ParameterSliderControl]
readsPrec :: Int -> ReadS ParameterSliderControl
$creadsPrec :: Int -> ReadS ParameterSliderControl
Prelude.Read, Int -> ParameterSliderControl -> ShowS
[ParameterSliderControl] -> ShowS
ParameterSliderControl -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParameterSliderControl] -> ShowS
$cshowList :: [ParameterSliderControl] -> ShowS
show :: ParameterSliderControl -> String
$cshow :: ParameterSliderControl -> String
showsPrec :: Int -> ParameterSliderControl -> ShowS
$cshowsPrec :: Int -> ParameterSliderControl -> ShowS
Prelude.Show, forall x. Rep ParameterSliderControl x -> ParameterSliderControl
forall x. ParameterSliderControl -> Rep ParameterSliderControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ParameterSliderControl x -> ParameterSliderControl
$cfrom :: forall x. ParameterSliderControl -> Rep ParameterSliderControl x
Prelude.Generic)

-- |
-- Create a value of 'ParameterSliderControl' 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:
--
-- 'displayOptions', 'parameterSliderControl_displayOptions' - The display options of a control.
--
-- 'parameterControlId', 'parameterSliderControl_parameterControlId' - The ID of the @ParameterSliderControl@.
--
-- 'title', 'parameterSliderControl_title' - The title of the @ParameterSliderControl@.
--
-- 'sourceParameterName', 'parameterSliderControl_sourceParameterName' - The source parameter name of the @ParameterSliderControl@.
--
-- 'maximumValue', 'parameterSliderControl_maximumValue' - The smaller value that is displayed at the left of the slider.
--
-- 'minimumValue', 'parameterSliderControl_minimumValue' - The larger value that is displayed at the right of the slider.
--
-- 'stepSize', 'parameterSliderControl_stepSize' - The number of increments that the slider bar is divided into.
newParameterSliderControl ::
  -- | 'parameterControlId'
  Prelude.Text ->
  -- | 'title'
  Prelude.Text ->
  -- | 'sourceParameterName'
  Prelude.Text ->
  -- | 'maximumValue'
  Prelude.Double ->
  -- | 'minimumValue'
  Prelude.Double ->
  -- | 'stepSize'
  Prelude.Double ->
  ParameterSliderControl
newParameterSliderControl :: Text
-> Text
-> Text
-> Double
-> Double
-> Double
-> ParameterSliderControl
newParameterSliderControl
  Text
pParameterControlId_
  Text
pTitle_
  Text
pSourceParameterName_
  Double
pMaximumValue_
  Double
pMinimumValue_
  Double
pStepSize_ =
    ParameterSliderControl'
      { $sel:displayOptions:ParameterSliderControl' :: Maybe SliderControlDisplayOptions
displayOptions =
          forall a. Maybe a
Prelude.Nothing,
        $sel:parameterControlId:ParameterSliderControl' :: Text
parameterControlId = Text
pParameterControlId_,
        $sel:title:ParameterSliderControl' :: Text
title = Text
pTitle_,
        $sel:sourceParameterName:ParameterSliderControl' :: Text
sourceParameterName = Text
pSourceParameterName_,
        $sel:maximumValue:ParameterSliderControl' :: Double
maximumValue = Double
pMaximumValue_,
        $sel:minimumValue:ParameterSliderControl' :: Double
minimumValue = Double
pMinimumValue_,
        $sel:stepSize:ParameterSliderControl' :: Double
stepSize = Double
pStepSize_
      }

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

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

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

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

-- | The smaller value that is displayed at the left of the slider.
parameterSliderControl_maximumValue :: Lens.Lens' ParameterSliderControl Prelude.Double
parameterSliderControl_maximumValue :: Lens' ParameterSliderControl Double
parameterSliderControl_maximumValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterSliderControl' {Double
maximumValue :: Double
$sel:maximumValue:ParameterSliderControl' :: ParameterSliderControl -> Double
maximumValue} -> Double
maximumValue) (\s :: ParameterSliderControl
s@ParameterSliderControl' {} Double
a -> ParameterSliderControl
s {$sel:maximumValue:ParameterSliderControl' :: Double
maximumValue = Double
a} :: ParameterSliderControl)

-- | The larger value that is displayed at the right of the slider.
parameterSliderControl_minimumValue :: Lens.Lens' ParameterSliderControl Prelude.Double
parameterSliderControl_minimumValue :: Lens' ParameterSliderControl Double
parameterSliderControl_minimumValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterSliderControl' {Double
minimumValue :: Double
$sel:minimumValue:ParameterSliderControl' :: ParameterSliderControl -> Double
minimumValue} -> Double
minimumValue) (\s :: ParameterSliderControl
s@ParameterSliderControl' {} Double
a -> ParameterSliderControl
s {$sel:minimumValue:ParameterSliderControl' :: Double
minimumValue = Double
a} :: ParameterSliderControl)

-- | The number of increments that the slider bar is divided into.
parameterSliderControl_stepSize :: Lens.Lens' ParameterSliderControl Prelude.Double
parameterSliderControl_stepSize :: Lens' ParameterSliderControl Double
parameterSliderControl_stepSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterSliderControl' {Double
stepSize :: Double
$sel:stepSize:ParameterSliderControl' :: ParameterSliderControl -> Double
stepSize} -> Double
stepSize) (\s :: ParameterSliderControl
s@ParameterSliderControl' {} Double
a -> ParameterSliderControl
s {$sel:stepSize:ParameterSliderControl' :: Double
stepSize = Double
a} :: ParameterSliderControl)

instance Data.FromJSON ParameterSliderControl where
  parseJSON :: Value -> Parser ParameterSliderControl
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ParameterSliderControl"
      ( \Object
x ->
          Maybe SliderControlDisplayOptions
-> Text
-> Text
-> Text
-> Double
-> Double
-> Double
-> ParameterSliderControl
ParameterSliderControl'
            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
"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")
            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
"MaximumValue")
            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
"MinimumValue")
            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
"StepSize")
      )

instance Prelude.Hashable ParameterSliderControl where
  hashWithSalt :: Int -> ParameterSliderControl -> Int
hashWithSalt Int
_salt ParameterSliderControl' {Double
Maybe SliderControlDisplayOptions
Text
stepSize :: Double
minimumValue :: Double
maximumValue :: Double
sourceParameterName :: Text
title :: Text
parameterControlId :: Text
displayOptions :: Maybe SliderControlDisplayOptions
$sel:stepSize:ParameterSliderControl' :: ParameterSliderControl -> Double
$sel:minimumValue:ParameterSliderControl' :: ParameterSliderControl -> Double
$sel:maximumValue:ParameterSliderControl' :: ParameterSliderControl -> Double
$sel:sourceParameterName:ParameterSliderControl' :: ParameterSliderControl -> Text
$sel:title:ParameterSliderControl' :: ParameterSliderControl -> Text
$sel:parameterControlId:ParameterSliderControl' :: ParameterSliderControl -> Text
$sel:displayOptions:ParameterSliderControl' :: ParameterSliderControl -> Maybe SliderControlDisplayOptions
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SliderControlDisplayOptions
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
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
maximumValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
minimumValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
stepSize

instance Prelude.NFData ParameterSliderControl where
  rnf :: ParameterSliderControl -> ()
rnf ParameterSliderControl' {Double
Maybe SliderControlDisplayOptions
Text
stepSize :: Double
minimumValue :: Double
maximumValue :: Double
sourceParameterName :: Text
title :: Text
parameterControlId :: Text
displayOptions :: Maybe SliderControlDisplayOptions
$sel:stepSize:ParameterSliderControl' :: ParameterSliderControl -> Double
$sel:minimumValue:ParameterSliderControl' :: ParameterSliderControl -> Double
$sel:maximumValue:ParameterSliderControl' :: ParameterSliderControl -> Double
$sel:sourceParameterName:ParameterSliderControl' :: ParameterSliderControl -> Text
$sel:title:ParameterSliderControl' :: ParameterSliderControl -> Text
$sel:parameterControlId:ParameterSliderControl' :: ParameterSliderControl -> Text
$sel:displayOptions:ParameterSliderControl' :: ParameterSliderControl -> Maybe SliderControlDisplayOptions
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SliderControlDisplayOptions
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
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
maximumValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
minimumValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
stepSize

instance Data.ToJSON ParameterSliderControl where
  toJSON :: ParameterSliderControl -> Value
toJSON ParameterSliderControl' {Double
Maybe SliderControlDisplayOptions
Text
stepSize :: Double
minimumValue :: Double
maximumValue :: Double
sourceParameterName :: Text
title :: Text
parameterControlId :: Text
displayOptions :: Maybe SliderControlDisplayOptions
$sel:stepSize:ParameterSliderControl' :: ParameterSliderControl -> Double
$sel:minimumValue:ParameterSliderControl' :: ParameterSliderControl -> Double
$sel:maximumValue:ParameterSliderControl' :: ParameterSliderControl -> Double
$sel:sourceParameterName:ParameterSliderControl' :: ParameterSliderControl -> Text
$sel:title:ParameterSliderControl' :: ParameterSliderControl -> Text
$sel:parameterControlId:ParameterSliderControl' :: ParameterSliderControl -> Text
$sel:displayOptions:ParameterSliderControl' :: ParameterSliderControl -> Maybe SliderControlDisplayOptions
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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 SliderControlDisplayOptions
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),
            forall a. a -> Maybe a
Prelude.Just (Key
"MaximumValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
maximumValue),
            forall a. a -> Maybe a
Prelude.Just (Key
"MinimumValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
minimumValue),
            forall a. a -> Maybe a
Prelude.Just (Key
"StepSize" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
stepSize)
          ]
      )