{-# 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.Typography
-- 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.Typography 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.Font

-- | Determines the typography options.
--
-- /See:/ 'newTypography' smart constructor.
data Typography = Typography'
  { -- | Determines the list of font families.
    Typography -> Maybe [Font]
fontFamilies :: Prelude.Maybe [Font]
  }
  deriving (Typography -> Typography -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Typography -> Typography -> Bool
$c/= :: Typography -> Typography -> Bool
== :: Typography -> Typography -> Bool
$c== :: Typography -> Typography -> Bool
Prelude.Eq, ReadPrec [Typography]
ReadPrec Typography
Int -> ReadS Typography
ReadS [Typography]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Typography]
$creadListPrec :: ReadPrec [Typography]
readPrec :: ReadPrec Typography
$creadPrec :: ReadPrec Typography
readList :: ReadS [Typography]
$creadList :: ReadS [Typography]
readsPrec :: Int -> ReadS Typography
$creadsPrec :: Int -> ReadS Typography
Prelude.Read, Int -> Typography -> ShowS
[Typography] -> ShowS
Typography -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Typography] -> ShowS
$cshowList :: [Typography] -> ShowS
show :: Typography -> String
$cshow :: Typography -> String
showsPrec :: Int -> Typography -> ShowS
$cshowsPrec :: Int -> Typography -> ShowS
Prelude.Show, forall x. Rep Typography x -> Typography
forall x. Typography -> Rep Typography x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Typography x -> Typography
$cfrom :: forall x. Typography -> Rep Typography x
Prelude.Generic)

-- |
-- Create a value of 'Typography' 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:
--
-- 'fontFamilies', 'typography_fontFamilies' - Determines the list of font families.
newTypography ::
  Typography
newTypography :: Typography
newTypography =
  Typography' {$sel:fontFamilies:Typography' :: Maybe [Font]
fontFamilies = forall a. Maybe a
Prelude.Nothing}

-- | Determines the list of font families.
typography_fontFamilies :: Lens.Lens' Typography (Prelude.Maybe [Font])
typography_fontFamilies :: Lens' Typography (Maybe [Font])
typography_fontFamilies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Typography' {Maybe [Font]
fontFamilies :: Maybe [Font]
$sel:fontFamilies:Typography' :: Typography -> Maybe [Font]
fontFamilies} -> Maybe [Font]
fontFamilies) (\s :: Typography
s@Typography' {} Maybe [Font]
a -> Typography
s {$sel:fontFamilies:Typography' :: Maybe [Font]
fontFamilies = Maybe [Font]
a} :: Typography) 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

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

instance Prelude.Hashable Typography where
  hashWithSalt :: Int -> Typography -> Int
hashWithSalt Int
_salt Typography' {Maybe [Font]
fontFamilies :: Maybe [Font]
$sel:fontFamilies:Typography' :: Typography -> Maybe [Font]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Font]
fontFamilies

instance Prelude.NFData Typography where
  rnf :: Typography -> ()
rnf Typography' {Maybe [Font]
fontFamilies :: Maybe [Font]
$sel:fontFamilies:Typography' :: Typography -> Maybe [Font]
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe [Font]
fontFamilies

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