{-# 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.FilterSliderControl
-- 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.FilterSliderControl 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.SheetControlSliderType
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:/ 'newFilterSliderControl' smart constructor.
data FilterSliderControl = FilterSliderControl'
  { -- | The display options of a control.
    FilterSliderControl -> Maybe SliderControlDisplayOptions
displayOptions :: Prelude.Maybe SliderControlDisplayOptions,
    -- | The type of @FilterSliderControl@. Choose one of the following options:
    --
    -- -   @SINGLE_POINT@: Filter against(equals) a single data point.
    --
    -- -   @RANGE@: Filter data that is in a specified range.
    FilterSliderControl -> Maybe SheetControlSliderType
type' :: Prelude.Maybe SheetControlSliderType,
    -- | The ID of the @FilterSliderControl@.
    FilterSliderControl -> Text
filterControlId :: Prelude.Text,
    -- | The title of the @FilterSliderControl@.
    FilterSliderControl -> Text
title :: Prelude.Text,
    -- | The source filter ID of the @FilterSliderControl@.
    FilterSliderControl -> Text
sourceFilterId :: Prelude.Text,
    -- | The smaller value that is displayed at the left of the slider.
    FilterSliderControl -> Double
maximumValue :: Prelude.Double,
    -- | The larger value that is displayed at the right of the slider.
    FilterSliderControl -> Double
minimumValue :: Prelude.Double,
    -- | The number of increments that the slider bar is divided into.
    FilterSliderControl -> Double
stepSize :: Prelude.Double
  }
  deriving (FilterSliderControl -> FilterSliderControl -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FilterSliderControl -> FilterSliderControl -> Bool
$c/= :: FilterSliderControl -> FilterSliderControl -> Bool
== :: FilterSliderControl -> FilterSliderControl -> Bool
$c== :: FilterSliderControl -> FilterSliderControl -> Bool
Prelude.Eq, ReadPrec [FilterSliderControl]
ReadPrec FilterSliderControl
Int -> ReadS FilterSliderControl
ReadS [FilterSliderControl]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FilterSliderControl]
$creadListPrec :: ReadPrec [FilterSliderControl]
readPrec :: ReadPrec FilterSliderControl
$creadPrec :: ReadPrec FilterSliderControl
readList :: ReadS [FilterSliderControl]
$creadList :: ReadS [FilterSliderControl]
readsPrec :: Int -> ReadS FilterSliderControl
$creadsPrec :: Int -> ReadS FilterSliderControl
Prelude.Read, Int -> FilterSliderControl -> ShowS
[FilterSliderControl] -> ShowS
FilterSliderControl -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FilterSliderControl] -> ShowS
$cshowList :: [FilterSliderControl] -> ShowS
show :: FilterSliderControl -> String
$cshow :: FilterSliderControl -> String
showsPrec :: Int -> FilterSliderControl -> ShowS
$cshowsPrec :: Int -> FilterSliderControl -> ShowS
Prelude.Show, forall x. Rep FilterSliderControl x -> FilterSliderControl
forall x. FilterSliderControl -> Rep FilterSliderControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FilterSliderControl x -> FilterSliderControl
$cfrom :: forall x. FilterSliderControl -> Rep FilterSliderControl x
Prelude.Generic)

-- |
-- Create a value of 'FilterSliderControl' 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', 'filterSliderControl_displayOptions' - The display options of a control.
--
-- 'type'', 'filterSliderControl_type' - The type of @FilterSliderControl@. Choose one of the following options:
--
-- -   @SINGLE_POINT@: Filter against(equals) a single data point.
--
-- -   @RANGE@: Filter data that is in a specified range.
--
-- 'filterControlId', 'filterSliderControl_filterControlId' - The ID of the @FilterSliderControl@.
--
-- 'title', 'filterSliderControl_title' - The title of the @FilterSliderControl@.
--
-- 'sourceFilterId', 'filterSliderControl_sourceFilterId' - The source filter ID of the @FilterSliderControl@.
--
-- 'maximumValue', 'filterSliderControl_maximumValue' - The smaller value that is displayed at the left of the slider.
--
-- 'minimumValue', 'filterSliderControl_minimumValue' - The larger value that is displayed at the right of the slider.
--
-- 'stepSize', 'filterSliderControl_stepSize' - The number of increments that the slider bar is divided into.
newFilterSliderControl ::
  -- | 'filterControlId'
  Prelude.Text ->
  -- | 'title'
  Prelude.Text ->
  -- | 'sourceFilterId'
  Prelude.Text ->
  -- | 'maximumValue'
  Prelude.Double ->
  -- | 'minimumValue'
  Prelude.Double ->
  -- | 'stepSize'
  Prelude.Double ->
  FilterSliderControl
newFilterSliderControl :: Text
-> Text
-> Text
-> Double
-> Double
-> Double
-> FilterSliderControl
newFilterSliderControl
  Text
pFilterControlId_
  Text
pTitle_
  Text
pSourceFilterId_
  Double
pMaximumValue_
  Double
pMinimumValue_
  Double
pStepSize_ =
    FilterSliderControl'
      { $sel:displayOptions:FilterSliderControl' :: Maybe SliderControlDisplayOptions
displayOptions =
          forall a. Maybe a
Prelude.Nothing,
        $sel:type':FilterSliderControl' :: Maybe SheetControlSliderType
type' = forall a. Maybe a
Prelude.Nothing,
        $sel:filterControlId:FilterSliderControl' :: Text
filterControlId = Text
pFilterControlId_,
        $sel:title:FilterSliderControl' :: Text
title = Text
pTitle_,
        $sel:sourceFilterId:FilterSliderControl' :: Text
sourceFilterId = Text
pSourceFilterId_,
        $sel:maximumValue:FilterSliderControl' :: Double
maximumValue = Double
pMaximumValue_,
        $sel:minimumValue:FilterSliderControl' :: Double
minimumValue = Double
pMinimumValue_,
        $sel:stepSize:FilterSliderControl' :: Double
stepSize = Double
pStepSize_
      }

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

-- | The type of @FilterSliderControl@. Choose one of the following options:
--
-- -   @SINGLE_POINT@: Filter against(equals) a single data point.
--
-- -   @RANGE@: Filter data that is in a specified range.
filterSliderControl_type :: Lens.Lens' FilterSliderControl (Prelude.Maybe SheetControlSliderType)
filterSliderControl_type :: Lens' FilterSliderControl (Maybe SheetControlSliderType)
filterSliderControl_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSliderControl' {Maybe SheetControlSliderType
type' :: Maybe SheetControlSliderType
$sel:type':FilterSliderControl' :: FilterSliderControl -> Maybe SheetControlSliderType
type'} -> Maybe SheetControlSliderType
type') (\s :: FilterSliderControl
s@FilterSliderControl' {} Maybe SheetControlSliderType
a -> FilterSliderControl
s {$sel:type':FilterSliderControl' :: Maybe SheetControlSliderType
type' = Maybe SheetControlSliderType
a} :: FilterSliderControl)

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

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

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

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

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

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

instance Data.FromJSON FilterSliderControl where
  parseJSON :: Value -> Parser FilterSliderControl
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FilterSliderControl"
      ( \Object
x ->
          Maybe SliderControlDisplayOptions
-> Maybe SheetControlSliderType
-> Text
-> Text
-> Text
-> Double
-> Double
-> Double
-> FilterSliderControl
FilterSliderControl'
            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 (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
"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")
            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 FilterSliderControl where
  hashWithSalt :: Int -> FilterSliderControl -> Int
hashWithSalt Int
_salt FilterSliderControl' {Double
Maybe SheetControlSliderType
Maybe SliderControlDisplayOptions
Text
stepSize :: Double
minimumValue :: Double
maximumValue :: Double
sourceFilterId :: Text
title :: Text
filterControlId :: Text
type' :: Maybe SheetControlSliderType
displayOptions :: Maybe SliderControlDisplayOptions
$sel:stepSize:FilterSliderControl' :: FilterSliderControl -> Double
$sel:minimumValue:FilterSliderControl' :: FilterSliderControl -> Double
$sel:maximumValue:FilterSliderControl' :: FilterSliderControl -> Double
$sel:sourceFilterId:FilterSliderControl' :: FilterSliderControl -> Text
$sel:title:FilterSliderControl' :: FilterSliderControl -> Text
$sel:filterControlId:FilterSliderControl' :: FilterSliderControl -> Text
$sel:type':FilterSliderControl' :: FilterSliderControl -> Maybe SheetControlSliderType
$sel:displayOptions:FilterSliderControl' :: FilterSliderControl -> 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` Maybe SheetControlSliderType
type'
      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
      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 FilterSliderControl where
  rnf :: FilterSliderControl -> ()
rnf FilterSliderControl' {Double
Maybe SheetControlSliderType
Maybe SliderControlDisplayOptions
Text
stepSize :: Double
minimumValue :: Double
maximumValue :: Double
sourceFilterId :: Text
title :: Text
filterControlId :: Text
type' :: Maybe SheetControlSliderType
displayOptions :: Maybe SliderControlDisplayOptions
$sel:stepSize:FilterSliderControl' :: FilterSliderControl -> Double
$sel:minimumValue:FilterSliderControl' :: FilterSliderControl -> Double
$sel:maximumValue:FilterSliderControl' :: FilterSliderControl -> Double
$sel:sourceFilterId:FilterSliderControl' :: FilterSliderControl -> Text
$sel:title:FilterSliderControl' :: FilterSliderControl -> Text
$sel:filterControlId:FilterSliderControl' :: FilterSliderControl -> Text
$sel:type':FilterSliderControl' :: FilterSliderControl -> Maybe SheetControlSliderType
$sel:displayOptions:FilterSliderControl' :: FilterSliderControl -> 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 Maybe SheetControlSliderType
type'
      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
      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 FilterSliderControl where
  toJSON :: FilterSliderControl -> Value
toJSON FilterSliderControl' {Double
Maybe SheetControlSliderType
Maybe SliderControlDisplayOptions
Text
stepSize :: Double
minimumValue :: Double
maximumValue :: Double
sourceFilterId :: Text
title :: Text
filterControlId :: Text
type' :: Maybe SheetControlSliderType
displayOptions :: Maybe SliderControlDisplayOptions
$sel:stepSize:FilterSliderControl' :: FilterSliderControl -> Double
$sel:minimumValue:FilterSliderControl' :: FilterSliderControl -> Double
$sel:maximumValue:FilterSliderControl' :: FilterSliderControl -> Double
$sel:sourceFilterId:FilterSliderControl' :: FilterSliderControl -> Text
$sel:title:FilterSliderControl' :: FilterSliderControl -> Text
$sel:filterControlId:FilterSliderControl' :: FilterSliderControl -> Text
$sel:type':FilterSliderControl' :: FilterSliderControl -> Maybe SheetControlSliderType
$sel:displayOptions:FilterSliderControl' :: FilterSliderControl -> 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,
            (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 SheetControlSliderType
type',
            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),
            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)
          ]
      )