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

-- | The subtitle label options for a visual.
--
-- /See:/ 'newVisualSubtitleLabelOptions' smart constructor.
data VisualSubtitleLabelOptions = VisualSubtitleLabelOptions'
  { -- | The long text format of the subtitle label, such as plain text or rich
    -- text.
    VisualSubtitleLabelOptions -> Maybe LongFormatText
formatText :: Prelude.Maybe LongFormatText,
    -- | The visibility of the subtitle label.
    VisualSubtitleLabelOptions -> Maybe Visibility
visibility :: Prelude.Maybe Visibility
  }
  deriving (VisualSubtitleLabelOptions -> VisualSubtitleLabelOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VisualSubtitleLabelOptions -> VisualSubtitleLabelOptions -> Bool
$c/= :: VisualSubtitleLabelOptions -> VisualSubtitleLabelOptions -> Bool
== :: VisualSubtitleLabelOptions -> VisualSubtitleLabelOptions -> Bool
$c== :: VisualSubtitleLabelOptions -> VisualSubtitleLabelOptions -> Bool
Prelude.Eq, ReadPrec [VisualSubtitleLabelOptions]
ReadPrec VisualSubtitleLabelOptions
Int -> ReadS VisualSubtitleLabelOptions
ReadS [VisualSubtitleLabelOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VisualSubtitleLabelOptions]
$creadListPrec :: ReadPrec [VisualSubtitleLabelOptions]
readPrec :: ReadPrec VisualSubtitleLabelOptions
$creadPrec :: ReadPrec VisualSubtitleLabelOptions
readList :: ReadS [VisualSubtitleLabelOptions]
$creadList :: ReadS [VisualSubtitleLabelOptions]
readsPrec :: Int -> ReadS VisualSubtitleLabelOptions
$creadsPrec :: Int -> ReadS VisualSubtitleLabelOptions
Prelude.Read, Int -> VisualSubtitleLabelOptions -> ShowS
[VisualSubtitleLabelOptions] -> ShowS
VisualSubtitleLabelOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VisualSubtitleLabelOptions] -> ShowS
$cshowList :: [VisualSubtitleLabelOptions] -> ShowS
show :: VisualSubtitleLabelOptions -> String
$cshow :: VisualSubtitleLabelOptions -> String
showsPrec :: Int -> VisualSubtitleLabelOptions -> ShowS
$cshowsPrec :: Int -> VisualSubtitleLabelOptions -> ShowS
Prelude.Show, forall x.
Rep VisualSubtitleLabelOptions x -> VisualSubtitleLabelOptions
forall x.
VisualSubtitleLabelOptions -> Rep VisualSubtitleLabelOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VisualSubtitleLabelOptions x -> VisualSubtitleLabelOptions
$cfrom :: forall x.
VisualSubtitleLabelOptions -> Rep VisualSubtitleLabelOptions x
Prelude.Generic)

-- |
-- Create a value of 'VisualSubtitleLabelOptions' 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:
--
-- 'formatText', 'visualSubtitleLabelOptions_formatText' - The long text format of the subtitle label, such as plain text or rich
-- text.
--
-- 'visibility', 'visualSubtitleLabelOptions_visibility' - The visibility of the subtitle label.
newVisualSubtitleLabelOptions ::
  VisualSubtitleLabelOptions
newVisualSubtitleLabelOptions :: VisualSubtitleLabelOptions
newVisualSubtitleLabelOptions =
  VisualSubtitleLabelOptions'
    { $sel:formatText:VisualSubtitleLabelOptions' :: Maybe LongFormatText
formatText =
        forall a. Maybe a
Prelude.Nothing,
      $sel:visibility:VisualSubtitleLabelOptions' :: Maybe Visibility
visibility = forall a. Maybe a
Prelude.Nothing
    }

-- | The long text format of the subtitle label, such as plain text or rich
-- text.
visualSubtitleLabelOptions_formatText :: Lens.Lens' VisualSubtitleLabelOptions (Prelude.Maybe LongFormatText)
visualSubtitleLabelOptions_formatText :: Lens' VisualSubtitleLabelOptions (Maybe LongFormatText)
visualSubtitleLabelOptions_formatText = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VisualSubtitleLabelOptions' {Maybe LongFormatText
formatText :: Maybe LongFormatText
$sel:formatText:VisualSubtitleLabelOptions' :: VisualSubtitleLabelOptions -> Maybe LongFormatText
formatText} -> Maybe LongFormatText
formatText) (\s :: VisualSubtitleLabelOptions
s@VisualSubtitleLabelOptions' {} Maybe LongFormatText
a -> VisualSubtitleLabelOptions
s {$sel:formatText:VisualSubtitleLabelOptions' :: Maybe LongFormatText
formatText = Maybe LongFormatText
a} :: VisualSubtitleLabelOptions)

-- | The visibility of the subtitle label.
visualSubtitleLabelOptions_visibility :: Lens.Lens' VisualSubtitleLabelOptions (Prelude.Maybe Visibility)
visualSubtitleLabelOptions_visibility :: Lens' VisualSubtitleLabelOptions (Maybe Visibility)
visualSubtitleLabelOptions_visibility = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VisualSubtitleLabelOptions' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:VisualSubtitleLabelOptions' :: VisualSubtitleLabelOptions -> Maybe Visibility
visibility} -> Maybe Visibility
visibility) (\s :: VisualSubtitleLabelOptions
s@VisualSubtitleLabelOptions' {} Maybe Visibility
a -> VisualSubtitleLabelOptions
s {$sel:visibility:VisualSubtitleLabelOptions' :: Maybe Visibility
visibility = Maybe Visibility
a} :: VisualSubtitleLabelOptions)

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

instance Prelude.NFData VisualSubtitleLabelOptions where
  rnf :: VisualSubtitleLabelOptions -> ()
rnf VisualSubtitleLabelOptions' {Maybe LongFormatText
Maybe Visibility
visibility :: Maybe Visibility
formatText :: Maybe LongFormatText
$sel:visibility:VisualSubtitleLabelOptions' :: VisualSubtitleLabelOptions -> Maybe Visibility
$sel:formatText:VisualSubtitleLabelOptions' :: VisualSubtitleLabelOptions -> Maybe LongFormatText
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LongFormatText
formatText
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Visibility
visibility

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