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

-- | The share label options for the labels.
--
-- /See:/ 'newLabelOptions' smart constructor.
data LabelOptions = LabelOptions'
  { -- | The text for the label.
    LabelOptions -> Maybe Text
customLabel :: Prelude.Maybe Prelude.Text,
    -- | The font configuration of the label.
    LabelOptions -> Maybe FontConfiguration
fontConfiguration :: Prelude.Maybe FontConfiguration,
    -- | Determines whether or not the label is visible.
    LabelOptions -> Maybe Visibility
visibility :: Prelude.Maybe Visibility
  }
  deriving (LabelOptions -> LabelOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LabelOptions -> LabelOptions -> Bool
$c/= :: LabelOptions -> LabelOptions -> Bool
== :: LabelOptions -> LabelOptions -> Bool
$c== :: LabelOptions -> LabelOptions -> Bool
Prelude.Eq, ReadPrec [LabelOptions]
ReadPrec LabelOptions
Int -> ReadS LabelOptions
ReadS [LabelOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LabelOptions]
$creadListPrec :: ReadPrec [LabelOptions]
readPrec :: ReadPrec LabelOptions
$creadPrec :: ReadPrec LabelOptions
readList :: ReadS [LabelOptions]
$creadList :: ReadS [LabelOptions]
readsPrec :: Int -> ReadS LabelOptions
$creadsPrec :: Int -> ReadS LabelOptions
Prelude.Read, Int -> LabelOptions -> ShowS
[LabelOptions] -> ShowS
LabelOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LabelOptions] -> ShowS
$cshowList :: [LabelOptions] -> ShowS
show :: LabelOptions -> String
$cshow :: LabelOptions -> String
showsPrec :: Int -> LabelOptions -> ShowS
$cshowsPrec :: Int -> LabelOptions -> ShowS
Prelude.Show, forall x. Rep LabelOptions x -> LabelOptions
forall x. LabelOptions -> Rep LabelOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LabelOptions x -> LabelOptions
$cfrom :: forall x. LabelOptions -> Rep LabelOptions x
Prelude.Generic)

-- |
-- Create a value of 'LabelOptions' 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:
--
-- 'customLabel', 'labelOptions_customLabel' - The text for the label.
--
-- 'fontConfiguration', 'labelOptions_fontConfiguration' - The font configuration of the label.
--
-- 'visibility', 'labelOptions_visibility' - Determines whether or not the label is visible.
newLabelOptions ::
  LabelOptions
newLabelOptions :: LabelOptions
newLabelOptions =
  LabelOptions'
    { $sel:customLabel:LabelOptions' :: Maybe Text
customLabel = forall a. Maybe a
Prelude.Nothing,
      $sel:fontConfiguration:LabelOptions' :: Maybe FontConfiguration
fontConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:visibility:LabelOptions' :: Maybe Visibility
visibility = forall a. Maybe a
Prelude.Nothing
    }

-- | The text for the label.
labelOptions_customLabel :: Lens.Lens' LabelOptions (Prelude.Maybe Prelude.Text)
labelOptions_customLabel :: Lens' LabelOptions (Maybe Text)
labelOptions_customLabel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LabelOptions' {Maybe Text
customLabel :: Maybe Text
$sel:customLabel:LabelOptions' :: LabelOptions -> Maybe Text
customLabel} -> Maybe Text
customLabel) (\s :: LabelOptions
s@LabelOptions' {} Maybe Text
a -> LabelOptions
s {$sel:customLabel:LabelOptions' :: Maybe Text
customLabel = Maybe Text
a} :: LabelOptions)

-- | The font configuration of the label.
labelOptions_fontConfiguration :: Lens.Lens' LabelOptions (Prelude.Maybe FontConfiguration)
labelOptions_fontConfiguration :: Lens' LabelOptions (Maybe FontConfiguration)
labelOptions_fontConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LabelOptions' {Maybe FontConfiguration
fontConfiguration :: Maybe FontConfiguration
$sel:fontConfiguration:LabelOptions' :: LabelOptions -> Maybe FontConfiguration
fontConfiguration} -> Maybe FontConfiguration
fontConfiguration) (\s :: LabelOptions
s@LabelOptions' {} Maybe FontConfiguration
a -> LabelOptions
s {$sel:fontConfiguration:LabelOptions' :: Maybe FontConfiguration
fontConfiguration = Maybe FontConfiguration
a} :: LabelOptions)

-- | Determines whether or not the label is visible.
labelOptions_visibility :: Lens.Lens' LabelOptions (Prelude.Maybe Visibility)
labelOptions_visibility :: Lens' LabelOptions (Maybe Visibility)
labelOptions_visibility = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LabelOptions' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:LabelOptions' :: LabelOptions -> Maybe Visibility
visibility} -> Maybe Visibility
visibility) (\s :: LabelOptions
s@LabelOptions' {} Maybe Visibility
a -> LabelOptions
s {$sel:visibility:LabelOptions' :: Maybe Visibility
visibility = Maybe Visibility
a} :: LabelOptions)

instance Data.FromJSON LabelOptions where
  parseJSON :: Value -> Parser LabelOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LabelOptions"
      ( \Object
x ->
          Maybe Text
-> Maybe FontConfiguration -> Maybe Visibility -> LabelOptions
LabelOptions'
            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
"CustomLabel")
            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
"FontConfiguration")
            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 LabelOptions where
  hashWithSalt :: Int -> LabelOptions -> Int
hashWithSalt Int
_salt LabelOptions' {Maybe Text
Maybe FontConfiguration
Maybe Visibility
visibility :: Maybe Visibility
fontConfiguration :: Maybe FontConfiguration
customLabel :: Maybe Text
$sel:visibility:LabelOptions' :: LabelOptions -> Maybe Visibility
$sel:fontConfiguration:LabelOptions' :: LabelOptions -> Maybe FontConfiguration
$sel:customLabel:LabelOptions' :: LabelOptions -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customLabel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FontConfiguration
fontConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Visibility
visibility

instance Prelude.NFData LabelOptions where
  rnf :: LabelOptions -> ()
rnf LabelOptions' {Maybe Text
Maybe FontConfiguration
Maybe Visibility
visibility :: Maybe Visibility
fontConfiguration :: Maybe FontConfiguration
customLabel :: Maybe Text
$sel:visibility:LabelOptions' :: LabelOptions -> Maybe Visibility
$sel:fontConfiguration:LabelOptions' :: LabelOptions -> Maybe FontConfiguration
$sel:customLabel:LabelOptions' :: LabelOptions -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customLabel
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FontConfiguration
fontConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Visibility
visibility

instance Data.ToJSON LabelOptions where
  toJSON :: LabelOptions -> Value
toJSON LabelOptions' {Maybe Text
Maybe FontConfiguration
Maybe Visibility
visibility :: Maybe Visibility
fontConfiguration :: Maybe FontConfiguration
customLabel :: Maybe Text
$sel:visibility:LabelOptions' :: LabelOptions -> Maybe Visibility
$sel:fontConfiguration:LabelOptions' :: LabelOptions -> Maybe FontConfiguration
$sel:customLabel:LabelOptions' :: LabelOptions -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CustomLabel" 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 Text
customLabel,
            (Key
"FontConfiguration" 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 FontConfiguration
fontConfiguration,
            (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
          ]
      )