{-# 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.AxisLogarithmicScale
-- 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.AxisLogarithmicScale 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 logarithmic axis scale setup.
--
-- /See:/ 'newAxisLogarithmicScale' smart constructor.
data AxisLogarithmicScale = AxisLogarithmicScale'
  { -- | The base setup of a logarithmic axis scale.
    AxisLogarithmicScale -> Maybe Double
base :: Prelude.Maybe Prelude.Double
  }
  deriving (AxisLogarithmicScale -> AxisLogarithmicScale -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AxisLogarithmicScale -> AxisLogarithmicScale -> Bool
$c/= :: AxisLogarithmicScale -> AxisLogarithmicScale -> Bool
== :: AxisLogarithmicScale -> AxisLogarithmicScale -> Bool
$c== :: AxisLogarithmicScale -> AxisLogarithmicScale -> Bool
Prelude.Eq, ReadPrec [AxisLogarithmicScale]
ReadPrec AxisLogarithmicScale
Int -> ReadS AxisLogarithmicScale
ReadS [AxisLogarithmicScale]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AxisLogarithmicScale]
$creadListPrec :: ReadPrec [AxisLogarithmicScale]
readPrec :: ReadPrec AxisLogarithmicScale
$creadPrec :: ReadPrec AxisLogarithmicScale
readList :: ReadS [AxisLogarithmicScale]
$creadList :: ReadS [AxisLogarithmicScale]
readsPrec :: Int -> ReadS AxisLogarithmicScale
$creadsPrec :: Int -> ReadS AxisLogarithmicScale
Prelude.Read, Int -> AxisLogarithmicScale -> ShowS
[AxisLogarithmicScale] -> ShowS
AxisLogarithmicScale -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AxisLogarithmicScale] -> ShowS
$cshowList :: [AxisLogarithmicScale] -> ShowS
show :: AxisLogarithmicScale -> String
$cshow :: AxisLogarithmicScale -> String
showsPrec :: Int -> AxisLogarithmicScale -> ShowS
$cshowsPrec :: Int -> AxisLogarithmicScale -> ShowS
Prelude.Show, forall x. Rep AxisLogarithmicScale x -> AxisLogarithmicScale
forall x. AxisLogarithmicScale -> Rep AxisLogarithmicScale x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AxisLogarithmicScale x -> AxisLogarithmicScale
$cfrom :: forall x. AxisLogarithmicScale -> Rep AxisLogarithmicScale x
Prelude.Generic)

-- |
-- Create a value of 'AxisLogarithmicScale' 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:
--
-- 'base', 'axisLogarithmicScale_base' - The base setup of a logarithmic axis scale.
newAxisLogarithmicScale ::
  AxisLogarithmicScale
newAxisLogarithmicScale :: AxisLogarithmicScale
newAxisLogarithmicScale =
  AxisLogarithmicScale' {$sel:base:AxisLogarithmicScale' :: Maybe Double
base = forall a. Maybe a
Prelude.Nothing}

-- | The base setup of a logarithmic axis scale.
axisLogarithmicScale_base :: Lens.Lens' AxisLogarithmicScale (Prelude.Maybe Prelude.Double)
axisLogarithmicScale_base :: Lens' AxisLogarithmicScale (Maybe Double)
axisLogarithmicScale_base = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AxisLogarithmicScale' {Maybe Double
base :: Maybe Double
$sel:base:AxisLogarithmicScale' :: AxisLogarithmicScale -> Maybe Double
base} -> Maybe Double
base) (\s :: AxisLogarithmicScale
s@AxisLogarithmicScale' {} Maybe Double
a -> AxisLogarithmicScale
s {$sel:base:AxisLogarithmicScale' :: Maybe Double
base = Maybe Double
a} :: AxisLogarithmicScale)

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

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

instance Prelude.NFData AxisLogarithmicScale where
  rnf :: AxisLogarithmicScale -> ()
rnf AxisLogarithmicScale' {Maybe Double
base :: Maybe Double
$sel:base:AxisLogarithmicScale' :: AxisLogarithmicScale -> Maybe Double
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
base

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