{-# 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.AxisTickLabelOptions
-- 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.AxisTickLabelOptions 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.LabelOptions

-- | The tick label options of an axis.
--
-- /See:/ 'newAxisTickLabelOptions' smart constructor.
data AxisTickLabelOptions = AxisTickLabelOptions'
  { -- | Determines whether or not the axis ticks are visible.
    AxisTickLabelOptions -> Maybe LabelOptions
labelOptions :: Prelude.Maybe LabelOptions,
    -- | The rotation angle of the axis tick labels.
    AxisTickLabelOptions -> Maybe Double
rotationAngle :: Prelude.Maybe Prelude.Double
  }
  deriving (AxisTickLabelOptions -> AxisTickLabelOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AxisTickLabelOptions -> AxisTickLabelOptions -> Bool
$c/= :: AxisTickLabelOptions -> AxisTickLabelOptions -> Bool
== :: AxisTickLabelOptions -> AxisTickLabelOptions -> Bool
$c== :: AxisTickLabelOptions -> AxisTickLabelOptions -> Bool
Prelude.Eq, ReadPrec [AxisTickLabelOptions]
ReadPrec AxisTickLabelOptions
Int -> ReadS AxisTickLabelOptions
ReadS [AxisTickLabelOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AxisTickLabelOptions]
$creadListPrec :: ReadPrec [AxisTickLabelOptions]
readPrec :: ReadPrec AxisTickLabelOptions
$creadPrec :: ReadPrec AxisTickLabelOptions
readList :: ReadS [AxisTickLabelOptions]
$creadList :: ReadS [AxisTickLabelOptions]
readsPrec :: Int -> ReadS AxisTickLabelOptions
$creadsPrec :: Int -> ReadS AxisTickLabelOptions
Prelude.Read, Int -> AxisTickLabelOptions -> ShowS
[AxisTickLabelOptions] -> ShowS
AxisTickLabelOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AxisTickLabelOptions] -> ShowS
$cshowList :: [AxisTickLabelOptions] -> ShowS
show :: AxisTickLabelOptions -> String
$cshow :: AxisTickLabelOptions -> String
showsPrec :: Int -> AxisTickLabelOptions -> ShowS
$cshowsPrec :: Int -> AxisTickLabelOptions -> ShowS
Prelude.Show, forall x. Rep AxisTickLabelOptions x -> AxisTickLabelOptions
forall x. AxisTickLabelOptions -> Rep AxisTickLabelOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AxisTickLabelOptions x -> AxisTickLabelOptions
$cfrom :: forall x. AxisTickLabelOptions -> Rep AxisTickLabelOptions x
Prelude.Generic)

-- |
-- Create a value of 'AxisTickLabelOptions' 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:
--
-- 'labelOptions', 'axisTickLabelOptions_labelOptions' - Determines whether or not the axis ticks are visible.
--
-- 'rotationAngle', 'axisTickLabelOptions_rotationAngle' - The rotation angle of the axis tick labels.
newAxisTickLabelOptions ::
  AxisTickLabelOptions
newAxisTickLabelOptions :: AxisTickLabelOptions
newAxisTickLabelOptions =
  AxisTickLabelOptions'
    { $sel:labelOptions:AxisTickLabelOptions' :: Maybe LabelOptions
labelOptions =
        forall a. Maybe a
Prelude.Nothing,
      $sel:rotationAngle:AxisTickLabelOptions' :: Maybe Double
rotationAngle = forall a. Maybe a
Prelude.Nothing
    }

-- | Determines whether or not the axis ticks are visible.
axisTickLabelOptions_labelOptions :: Lens.Lens' AxisTickLabelOptions (Prelude.Maybe LabelOptions)
axisTickLabelOptions_labelOptions :: Lens' AxisTickLabelOptions (Maybe LabelOptions)
axisTickLabelOptions_labelOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AxisTickLabelOptions' {Maybe LabelOptions
labelOptions :: Maybe LabelOptions
$sel:labelOptions:AxisTickLabelOptions' :: AxisTickLabelOptions -> Maybe LabelOptions
labelOptions} -> Maybe LabelOptions
labelOptions) (\s :: AxisTickLabelOptions
s@AxisTickLabelOptions' {} Maybe LabelOptions
a -> AxisTickLabelOptions
s {$sel:labelOptions:AxisTickLabelOptions' :: Maybe LabelOptions
labelOptions = Maybe LabelOptions
a} :: AxisTickLabelOptions)

-- | The rotation angle of the axis tick labels.
axisTickLabelOptions_rotationAngle :: Lens.Lens' AxisTickLabelOptions (Prelude.Maybe Prelude.Double)
axisTickLabelOptions_rotationAngle :: Lens' AxisTickLabelOptions (Maybe Double)
axisTickLabelOptions_rotationAngle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AxisTickLabelOptions' {Maybe Double
rotationAngle :: Maybe Double
$sel:rotationAngle:AxisTickLabelOptions' :: AxisTickLabelOptions -> Maybe Double
rotationAngle} -> Maybe Double
rotationAngle) (\s :: AxisTickLabelOptions
s@AxisTickLabelOptions' {} Maybe Double
a -> AxisTickLabelOptions
s {$sel:rotationAngle:AxisTickLabelOptions' :: Maybe Double
rotationAngle = Maybe Double
a} :: AxisTickLabelOptions)

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

instance Prelude.Hashable AxisTickLabelOptions where
  hashWithSalt :: Int -> AxisTickLabelOptions -> Int
hashWithSalt Int
_salt AxisTickLabelOptions' {Maybe Double
Maybe LabelOptions
rotationAngle :: Maybe Double
labelOptions :: Maybe LabelOptions
$sel:rotationAngle:AxisTickLabelOptions' :: AxisTickLabelOptions -> Maybe Double
$sel:labelOptions:AxisTickLabelOptions' :: AxisTickLabelOptions -> Maybe LabelOptions
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LabelOptions
labelOptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
rotationAngle

instance Prelude.NFData AxisTickLabelOptions where
  rnf :: AxisTickLabelOptions -> ()
rnf AxisTickLabelOptions' {Maybe Double
Maybe LabelOptions
rotationAngle :: Maybe Double
labelOptions :: Maybe LabelOptions
$sel:rotationAngle:AxisTickLabelOptions' :: AxisTickLabelOptions -> Maybe Double
$sel:labelOptions:AxisTickLabelOptions' :: AxisTickLabelOptions -> Maybe LabelOptions
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LabelOptions
labelOptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
rotationAngle

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