{-# 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.VisibleRangeOptions
-- 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.VisibleRangeOptions 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.PercentVisibleRange

-- | The range options for the data zoom scroll bar.
--
-- /See:/ 'newVisibleRangeOptions' smart constructor.
data VisibleRangeOptions = VisibleRangeOptions'
  { -- | The percent range in the visible range.
    VisibleRangeOptions -> Maybe PercentVisibleRange
percentRange :: Prelude.Maybe PercentVisibleRange
  }
  deriving (VisibleRangeOptions -> VisibleRangeOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VisibleRangeOptions -> VisibleRangeOptions -> Bool
$c/= :: VisibleRangeOptions -> VisibleRangeOptions -> Bool
== :: VisibleRangeOptions -> VisibleRangeOptions -> Bool
$c== :: VisibleRangeOptions -> VisibleRangeOptions -> Bool
Prelude.Eq, ReadPrec [VisibleRangeOptions]
ReadPrec VisibleRangeOptions
Int -> ReadS VisibleRangeOptions
ReadS [VisibleRangeOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VisibleRangeOptions]
$creadListPrec :: ReadPrec [VisibleRangeOptions]
readPrec :: ReadPrec VisibleRangeOptions
$creadPrec :: ReadPrec VisibleRangeOptions
readList :: ReadS [VisibleRangeOptions]
$creadList :: ReadS [VisibleRangeOptions]
readsPrec :: Int -> ReadS VisibleRangeOptions
$creadsPrec :: Int -> ReadS VisibleRangeOptions
Prelude.Read, Int -> VisibleRangeOptions -> ShowS
[VisibleRangeOptions] -> ShowS
VisibleRangeOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VisibleRangeOptions] -> ShowS
$cshowList :: [VisibleRangeOptions] -> ShowS
show :: VisibleRangeOptions -> String
$cshow :: VisibleRangeOptions -> String
showsPrec :: Int -> VisibleRangeOptions -> ShowS
$cshowsPrec :: Int -> VisibleRangeOptions -> ShowS
Prelude.Show, forall x. Rep VisibleRangeOptions x -> VisibleRangeOptions
forall x. VisibleRangeOptions -> Rep VisibleRangeOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VisibleRangeOptions x -> VisibleRangeOptions
$cfrom :: forall x. VisibleRangeOptions -> Rep VisibleRangeOptions x
Prelude.Generic)

-- |
-- Create a value of 'VisibleRangeOptions' 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:
--
-- 'percentRange', 'visibleRangeOptions_percentRange' - The percent range in the visible range.
newVisibleRangeOptions ::
  VisibleRangeOptions
newVisibleRangeOptions :: VisibleRangeOptions
newVisibleRangeOptions =
  VisibleRangeOptions'
    { $sel:percentRange:VisibleRangeOptions' :: Maybe PercentVisibleRange
percentRange =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The percent range in the visible range.
visibleRangeOptions_percentRange :: Lens.Lens' VisibleRangeOptions (Prelude.Maybe PercentVisibleRange)
visibleRangeOptions_percentRange :: Lens' VisibleRangeOptions (Maybe PercentVisibleRange)
visibleRangeOptions_percentRange = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VisibleRangeOptions' {Maybe PercentVisibleRange
percentRange :: Maybe PercentVisibleRange
$sel:percentRange:VisibleRangeOptions' :: VisibleRangeOptions -> Maybe PercentVisibleRange
percentRange} -> Maybe PercentVisibleRange
percentRange) (\s :: VisibleRangeOptions
s@VisibleRangeOptions' {} Maybe PercentVisibleRange
a -> VisibleRangeOptions
s {$sel:percentRange:VisibleRangeOptions' :: Maybe PercentVisibleRange
percentRange = Maybe PercentVisibleRange
a} :: VisibleRangeOptions)

instance Data.FromJSON VisibleRangeOptions where
  parseJSON :: Value -> Parser VisibleRangeOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VisibleRangeOptions"
      ( \Object
x ->
          Maybe PercentVisibleRange -> VisibleRangeOptions
VisibleRangeOptions'
            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
"PercentRange")
      )

instance Prelude.Hashable VisibleRangeOptions where
  hashWithSalt :: Int -> VisibleRangeOptions -> Int
hashWithSalt Int
_salt VisibleRangeOptions' {Maybe PercentVisibleRange
percentRange :: Maybe PercentVisibleRange
$sel:percentRange:VisibleRangeOptions' :: VisibleRangeOptions -> Maybe PercentVisibleRange
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PercentVisibleRange
percentRange

instance Prelude.NFData VisibleRangeOptions where
  rnf :: VisibleRangeOptions -> ()
rnf VisibleRangeOptions' {Maybe PercentVisibleRange
percentRange :: Maybe PercentVisibleRange
$sel:percentRange:VisibleRangeOptions' :: VisibleRangeOptions -> Maybe PercentVisibleRange
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe PercentVisibleRange
percentRange

instance Data.ToJSON VisibleRangeOptions where
  toJSON :: VisibleRangeOptions -> Value
toJSON VisibleRangeOptions' {Maybe PercentVisibleRange
percentRange :: Maybe PercentVisibleRange
$sel:percentRange:VisibleRangeOptions' :: VisibleRangeOptions -> Maybe PercentVisibleRange
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"PercentRange" 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 PercentVisibleRange
percentRange]
      )