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

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

-- |
-- Create a value of 'Font' 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:
--
-- 'fontFamily', 'font_fontFamily' - Determines the font family settings.
newFont ::
  Font
newFont :: Font
newFont = Font' {$sel:fontFamily:Font' :: Maybe Text
fontFamily = forall a. Maybe a
Prelude.Nothing}

-- | Determines the font family settings.
font_fontFamily :: Lens.Lens' Font (Prelude.Maybe Prelude.Text)
font_fontFamily :: Lens' Font (Maybe Text)
font_fontFamily = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Font' {Maybe Text
fontFamily :: Maybe Text
$sel:fontFamily:Font' :: Font -> Maybe Text
fontFamily} -> Maybe Text
fontFamily) (\s :: Font
s@Font' {} Maybe Text
a -> Font
s {$sel:fontFamily:Font' :: Maybe Text
fontFamily = Maybe Text
a} :: Font)

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

instance Prelude.Hashable Font where
  hashWithSalt :: Int -> Font -> Int
hashWithSalt Int
_salt Font' {Maybe Text
fontFamily :: Maybe Text
$sel:fontFamily:Font' :: Font -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fontFamily

instance Prelude.NFData Font where
  rnf :: Font -> ()
rnf Font' {Maybe Text
fontFamily :: Maybe Text
$sel:fontFamily:Font' :: Font -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
fontFamily

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