{-# 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.ChartAxisLabelOptions
-- 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.ChartAxisLabelOptions 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.AxisLabelOptions
import Amazonka.QuickSight.Types.Visibility

-- | The label options for an axis on a chart.
--
-- /See:/ 'newChartAxisLabelOptions' smart constructor.
data ChartAxisLabelOptions = ChartAxisLabelOptions'
  { -- | The label options for a chart axis.
    ChartAxisLabelOptions -> Maybe [AxisLabelOptions]
axisLabelOptions :: Prelude.Maybe [AxisLabelOptions],
    -- | The visibility configuration of the sort icon on a chart\'s axis label.
    ChartAxisLabelOptions -> Maybe Visibility
sortIconVisibility :: Prelude.Maybe Visibility,
    -- | The visibility of an axis label on a chart. Choose one of the following
    -- options:
    --
    -- -   @VISIBLE@: Shows the axis.
    --
    -- -   @HIDDEN@: Hides the axis.
    ChartAxisLabelOptions -> Maybe Visibility
visibility :: Prelude.Maybe Visibility
  }
  deriving (ChartAxisLabelOptions -> ChartAxisLabelOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChartAxisLabelOptions -> ChartAxisLabelOptions -> Bool
$c/= :: ChartAxisLabelOptions -> ChartAxisLabelOptions -> Bool
== :: ChartAxisLabelOptions -> ChartAxisLabelOptions -> Bool
$c== :: ChartAxisLabelOptions -> ChartAxisLabelOptions -> Bool
Prelude.Eq, ReadPrec [ChartAxisLabelOptions]
ReadPrec ChartAxisLabelOptions
Int -> ReadS ChartAxisLabelOptions
ReadS [ChartAxisLabelOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChartAxisLabelOptions]
$creadListPrec :: ReadPrec [ChartAxisLabelOptions]
readPrec :: ReadPrec ChartAxisLabelOptions
$creadPrec :: ReadPrec ChartAxisLabelOptions
readList :: ReadS [ChartAxisLabelOptions]
$creadList :: ReadS [ChartAxisLabelOptions]
readsPrec :: Int -> ReadS ChartAxisLabelOptions
$creadsPrec :: Int -> ReadS ChartAxisLabelOptions
Prelude.Read, Int -> ChartAxisLabelOptions -> ShowS
[ChartAxisLabelOptions] -> ShowS
ChartAxisLabelOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChartAxisLabelOptions] -> ShowS
$cshowList :: [ChartAxisLabelOptions] -> ShowS
show :: ChartAxisLabelOptions -> String
$cshow :: ChartAxisLabelOptions -> String
showsPrec :: Int -> ChartAxisLabelOptions -> ShowS
$cshowsPrec :: Int -> ChartAxisLabelOptions -> ShowS
Prelude.Show, forall x. Rep ChartAxisLabelOptions x -> ChartAxisLabelOptions
forall x. ChartAxisLabelOptions -> Rep ChartAxisLabelOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChartAxisLabelOptions x -> ChartAxisLabelOptions
$cfrom :: forall x. ChartAxisLabelOptions -> Rep ChartAxisLabelOptions x
Prelude.Generic)

-- |
-- Create a value of 'ChartAxisLabelOptions' 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:
--
-- 'axisLabelOptions', 'chartAxisLabelOptions_axisLabelOptions' - The label options for a chart axis.
--
-- 'sortIconVisibility', 'chartAxisLabelOptions_sortIconVisibility' - The visibility configuration of the sort icon on a chart\'s axis label.
--
-- 'visibility', 'chartAxisLabelOptions_visibility' - The visibility of an axis label on a chart. Choose one of the following
-- options:
--
-- -   @VISIBLE@: Shows the axis.
--
-- -   @HIDDEN@: Hides the axis.
newChartAxisLabelOptions ::
  ChartAxisLabelOptions
newChartAxisLabelOptions :: ChartAxisLabelOptions
newChartAxisLabelOptions =
  ChartAxisLabelOptions'
    { $sel:axisLabelOptions:ChartAxisLabelOptions' :: Maybe [AxisLabelOptions]
axisLabelOptions =
        forall a. Maybe a
Prelude.Nothing,
      $sel:sortIconVisibility:ChartAxisLabelOptions' :: Maybe Visibility
sortIconVisibility = forall a. Maybe a
Prelude.Nothing,
      $sel:visibility:ChartAxisLabelOptions' :: Maybe Visibility
visibility = forall a. Maybe a
Prelude.Nothing
    }

-- | The label options for a chart axis.
chartAxisLabelOptions_axisLabelOptions :: Lens.Lens' ChartAxisLabelOptions (Prelude.Maybe [AxisLabelOptions])
chartAxisLabelOptions_axisLabelOptions :: Lens' ChartAxisLabelOptions (Maybe [AxisLabelOptions])
chartAxisLabelOptions_axisLabelOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChartAxisLabelOptions' {Maybe [AxisLabelOptions]
axisLabelOptions :: Maybe [AxisLabelOptions]
$sel:axisLabelOptions:ChartAxisLabelOptions' :: ChartAxisLabelOptions -> Maybe [AxisLabelOptions]
axisLabelOptions} -> Maybe [AxisLabelOptions]
axisLabelOptions) (\s :: ChartAxisLabelOptions
s@ChartAxisLabelOptions' {} Maybe [AxisLabelOptions]
a -> ChartAxisLabelOptions
s {$sel:axisLabelOptions:ChartAxisLabelOptions' :: Maybe [AxisLabelOptions]
axisLabelOptions = Maybe [AxisLabelOptions]
a} :: ChartAxisLabelOptions) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The visibility configuration of the sort icon on a chart\'s axis label.
chartAxisLabelOptions_sortIconVisibility :: Lens.Lens' ChartAxisLabelOptions (Prelude.Maybe Visibility)
chartAxisLabelOptions_sortIconVisibility :: Lens' ChartAxisLabelOptions (Maybe Visibility)
chartAxisLabelOptions_sortIconVisibility = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChartAxisLabelOptions' {Maybe Visibility
sortIconVisibility :: Maybe Visibility
$sel:sortIconVisibility:ChartAxisLabelOptions' :: ChartAxisLabelOptions -> Maybe Visibility
sortIconVisibility} -> Maybe Visibility
sortIconVisibility) (\s :: ChartAxisLabelOptions
s@ChartAxisLabelOptions' {} Maybe Visibility
a -> ChartAxisLabelOptions
s {$sel:sortIconVisibility:ChartAxisLabelOptions' :: Maybe Visibility
sortIconVisibility = Maybe Visibility
a} :: ChartAxisLabelOptions)

-- | The visibility of an axis label on a chart. Choose one of the following
-- options:
--
-- -   @VISIBLE@: Shows the axis.
--
-- -   @HIDDEN@: Hides the axis.
chartAxisLabelOptions_visibility :: Lens.Lens' ChartAxisLabelOptions (Prelude.Maybe Visibility)
chartAxisLabelOptions_visibility :: Lens' ChartAxisLabelOptions (Maybe Visibility)
chartAxisLabelOptions_visibility = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChartAxisLabelOptions' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:ChartAxisLabelOptions' :: ChartAxisLabelOptions -> Maybe Visibility
visibility} -> Maybe Visibility
visibility) (\s :: ChartAxisLabelOptions
s@ChartAxisLabelOptions' {} Maybe Visibility
a -> ChartAxisLabelOptions
s {$sel:visibility:ChartAxisLabelOptions' :: Maybe Visibility
visibility = Maybe Visibility
a} :: ChartAxisLabelOptions)

instance Data.FromJSON ChartAxisLabelOptions where
  parseJSON :: Value -> Parser ChartAxisLabelOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ChartAxisLabelOptions"
      ( \Object
x ->
          Maybe [AxisLabelOptions]
-> Maybe Visibility -> Maybe Visibility -> ChartAxisLabelOptions
ChartAxisLabelOptions'
            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
"AxisLabelOptions"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"SortIconVisibility")
            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
"Visibility")
      )

instance Prelude.Hashable ChartAxisLabelOptions where
  hashWithSalt :: Int -> ChartAxisLabelOptions -> Int
hashWithSalt Int
_salt ChartAxisLabelOptions' {Maybe [AxisLabelOptions]
Maybe Visibility
visibility :: Maybe Visibility
sortIconVisibility :: Maybe Visibility
axisLabelOptions :: Maybe [AxisLabelOptions]
$sel:visibility:ChartAxisLabelOptions' :: ChartAxisLabelOptions -> Maybe Visibility
$sel:sortIconVisibility:ChartAxisLabelOptions' :: ChartAxisLabelOptions -> Maybe Visibility
$sel:axisLabelOptions:ChartAxisLabelOptions' :: ChartAxisLabelOptions -> Maybe [AxisLabelOptions]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AxisLabelOptions]
axisLabelOptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Visibility
sortIconVisibility
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Visibility
visibility

instance Prelude.NFData ChartAxisLabelOptions where
  rnf :: ChartAxisLabelOptions -> ()
rnf ChartAxisLabelOptions' {Maybe [AxisLabelOptions]
Maybe Visibility
visibility :: Maybe Visibility
sortIconVisibility :: Maybe Visibility
axisLabelOptions :: Maybe [AxisLabelOptions]
$sel:visibility:ChartAxisLabelOptions' :: ChartAxisLabelOptions -> Maybe Visibility
$sel:sortIconVisibility:ChartAxisLabelOptions' :: ChartAxisLabelOptions -> Maybe Visibility
$sel:axisLabelOptions:ChartAxisLabelOptions' :: ChartAxisLabelOptions -> Maybe [AxisLabelOptions]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AxisLabelOptions]
axisLabelOptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Visibility
sortIconVisibility
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Visibility
visibility

instance Data.ToJSON ChartAxisLabelOptions where
  toJSON :: ChartAxisLabelOptions -> Value
toJSON ChartAxisLabelOptions' {Maybe [AxisLabelOptions]
Maybe Visibility
visibility :: Maybe Visibility
sortIconVisibility :: Maybe Visibility
axisLabelOptions :: Maybe [AxisLabelOptions]
$sel:visibility:ChartAxisLabelOptions' :: ChartAxisLabelOptions -> Maybe Visibility
$sel:sortIconVisibility:ChartAxisLabelOptions' :: ChartAxisLabelOptions -> Maybe Visibility
$sel:axisLabelOptions:ChartAxisLabelOptions' :: ChartAxisLabelOptions -> Maybe [AxisLabelOptions]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AxisLabelOptions" 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 [AxisLabelOptions]
axisLabelOptions,
            (Key
"SortIconVisibility" 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 Visibility
sortIconVisibility,
            (Key
"Visibility" 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 Visibility
visibility
          ]
      )