{-# 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.ArcAxisDisplayRange
-- 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.ArcAxisDisplayRange 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

-- | The arc axis range of a @GaugeChartVisual@.
--
-- /See:/ 'newArcAxisDisplayRange' smart constructor.
data ArcAxisDisplayRange = ArcAxisDisplayRange'
  { -- | The maximum value of the arc axis range.
    ArcAxisDisplayRange -> Maybe Double
max :: Prelude.Maybe Prelude.Double,
    -- | The minimum value of the arc axis range.
    ArcAxisDisplayRange -> Maybe Double
min :: Prelude.Maybe Prelude.Double
  }
  deriving (ArcAxisDisplayRange -> ArcAxisDisplayRange -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArcAxisDisplayRange -> ArcAxisDisplayRange -> Bool
$c/= :: ArcAxisDisplayRange -> ArcAxisDisplayRange -> Bool
== :: ArcAxisDisplayRange -> ArcAxisDisplayRange -> Bool
$c== :: ArcAxisDisplayRange -> ArcAxisDisplayRange -> Bool
Prelude.Eq, ReadPrec [ArcAxisDisplayRange]
ReadPrec ArcAxisDisplayRange
Int -> ReadS ArcAxisDisplayRange
ReadS [ArcAxisDisplayRange]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArcAxisDisplayRange]
$creadListPrec :: ReadPrec [ArcAxisDisplayRange]
readPrec :: ReadPrec ArcAxisDisplayRange
$creadPrec :: ReadPrec ArcAxisDisplayRange
readList :: ReadS [ArcAxisDisplayRange]
$creadList :: ReadS [ArcAxisDisplayRange]
readsPrec :: Int -> ReadS ArcAxisDisplayRange
$creadsPrec :: Int -> ReadS ArcAxisDisplayRange
Prelude.Read, Int -> ArcAxisDisplayRange -> ShowS
[ArcAxisDisplayRange] -> ShowS
ArcAxisDisplayRange -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArcAxisDisplayRange] -> ShowS
$cshowList :: [ArcAxisDisplayRange] -> ShowS
show :: ArcAxisDisplayRange -> String
$cshow :: ArcAxisDisplayRange -> String
showsPrec :: Int -> ArcAxisDisplayRange -> ShowS
$cshowsPrec :: Int -> ArcAxisDisplayRange -> ShowS
Prelude.Show, forall x. Rep ArcAxisDisplayRange x -> ArcAxisDisplayRange
forall x. ArcAxisDisplayRange -> Rep ArcAxisDisplayRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArcAxisDisplayRange x -> ArcAxisDisplayRange
$cfrom :: forall x. ArcAxisDisplayRange -> Rep ArcAxisDisplayRange x
Prelude.Generic)

-- |
-- Create a value of 'ArcAxisDisplayRange' 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:
--
-- 'max', 'arcAxisDisplayRange_max' - The maximum value of the arc axis range.
--
-- 'min', 'arcAxisDisplayRange_min' - The minimum value of the arc axis range.
newArcAxisDisplayRange ::
  ArcAxisDisplayRange
newArcAxisDisplayRange :: ArcAxisDisplayRange
newArcAxisDisplayRange =
  ArcAxisDisplayRange'
    { $sel:max:ArcAxisDisplayRange' :: Maybe Double
max = forall a. Maybe a
Prelude.Nothing,
      $sel:min:ArcAxisDisplayRange' :: Maybe Double
min = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum value of the arc axis range.
arcAxisDisplayRange_max :: Lens.Lens' ArcAxisDisplayRange (Prelude.Maybe Prelude.Double)
arcAxisDisplayRange_max :: Lens' ArcAxisDisplayRange (Maybe Double)
arcAxisDisplayRange_max = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArcAxisDisplayRange' {Maybe Double
max :: Maybe Double
$sel:max:ArcAxisDisplayRange' :: ArcAxisDisplayRange -> Maybe Double
max} -> Maybe Double
max) (\s :: ArcAxisDisplayRange
s@ArcAxisDisplayRange' {} Maybe Double
a -> ArcAxisDisplayRange
s {$sel:max:ArcAxisDisplayRange' :: Maybe Double
max = Maybe Double
a} :: ArcAxisDisplayRange)

-- | The minimum value of the arc axis range.
arcAxisDisplayRange_min :: Lens.Lens' ArcAxisDisplayRange (Prelude.Maybe Prelude.Double)
arcAxisDisplayRange_min :: Lens' ArcAxisDisplayRange (Maybe Double)
arcAxisDisplayRange_min = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArcAxisDisplayRange' {Maybe Double
min :: Maybe Double
$sel:min:ArcAxisDisplayRange' :: ArcAxisDisplayRange -> Maybe Double
min} -> Maybe Double
min) (\s :: ArcAxisDisplayRange
s@ArcAxisDisplayRange' {} Maybe Double
a -> ArcAxisDisplayRange
s {$sel:min:ArcAxisDisplayRange' :: Maybe Double
min = Maybe Double
a} :: ArcAxisDisplayRange)

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

instance Prelude.Hashable ArcAxisDisplayRange where
  hashWithSalt :: Int -> ArcAxisDisplayRange -> Int
hashWithSalt Int
_salt ArcAxisDisplayRange' {Maybe Double
min :: Maybe Double
max :: Maybe Double
$sel:min:ArcAxisDisplayRange' :: ArcAxisDisplayRange -> Maybe Double
$sel:max:ArcAxisDisplayRange' :: ArcAxisDisplayRange -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
max
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
min

instance Prelude.NFData ArcAxisDisplayRange where
  rnf :: ArcAxisDisplayRange -> ()
rnf ArcAxisDisplayRange' {Maybe Double
min :: Maybe Double
max :: Maybe Double
$sel:min:ArcAxisDisplayRange' :: ArcAxisDisplayRange -> Maybe Double
$sel:max:ArcAxisDisplayRange' :: ArcAxisDisplayRange -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
max seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
min

instance Data.ToJSON ArcAxisDisplayRange where
  toJSON :: ArcAxisDisplayRange -> Value
toJSON ArcAxisDisplayRange' {Maybe Double
min :: Maybe Double
max :: Maybe Double
$sel:min:ArcAxisDisplayRange' :: ArcAxisDisplayRange -> Maybe Double
$sel:max:ArcAxisDisplayRange' :: ArcAxisDisplayRange -> Maybe Double
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Max" 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 Double
max,
            (Key
"Min" 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 Double
min
          ]
      )