{-# 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.FontWeight
-- 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.FontWeight 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.FontWeightName

-- | The option that determines the text display weight, or boldness.
--
-- /See:/ 'newFontWeight' smart constructor.
data FontWeight = FontWeight'
  { -- | The lexical name for the level of boldness of the text display.
    FontWeight -> Maybe FontWeightName
name :: Prelude.Maybe FontWeightName
  }
  deriving (FontWeight -> FontWeight -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FontWeight -> FontWeight -> Bool
$c/= :: FontWeight -> FontWeight -> Bool
== :: FontWeight -> FontWeight -> Bool
$c== :: FontWeight -> FontWeight -> Bool
Prelude.Eq, ReadPrec [FontWeight]
ReadPrec FontWeight
Int -> ReadS FontWeight
ReadS [FontWeight]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FontWeight]
$creadListPrec :: ReadPrec [FontWeight]
readPrec :: ReadPrec FontWeight
$creadPrec :: ReadPrec FontWeight
readList :: ReadS [FontWeight]
$creadList :: ReadS [FontWeight]
readsPrec :: Int -> ReadS FontWeight
$creadsPrec :: Int -> ReadS FontWeight
Prelude.Read, Int -> FontWeight -> ShowS
[FontWeight] -> ShowS
FontWeight -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FontWeight] -> ShowS
$cshowList :: [FontWeight] -> ShowS
show :: FontWeight -> String
$cshow :: FontWeight -> String
showsPrec :: Int -> FontWeight -> ShowS
$cshowsPrec :: Int -> FontWeight -> ShowS
Prelude.Show, forall x. Rep FontWeight x -> FontWeight
forall x. FontWeight -> Rep FontWeight x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FontWeight x -> FontWeight
$cfrom :: forall x. FontWeight -> Rep FontWeight x
Prelude.Generic)

-- |
-- Create a value of 'FontWeight' 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:
--
-- 'name', 'fontWeight_name' - The lexical name for the level of boldness of the text display.
newFontWeight ::
  FontWeight
newFontWeight :: FontWeight
newFontWeight = FontWeight' {$sel:name:FontWeight' :: Maybe FontWeightName
name = forall a. Maybe a
Prelude.Nothing}

-- | The lexical name for the level of boldness of the text display.
fontWeight_name :: Lens.Lens' FontWeight (Prelude.Maybe FontWeightName)
fontWeight_name :: Lens' FontWeight (Maybe FontWeightName)
fontWeight_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FontWeight' {Maybe FontWeightName
name :: Maybe FontWeightName
$sel:name:FontWeight' :: FontWeight -> Maybe FontWeightName
name} -> Maybe FontWeightName
name) (\s :: FontWeight
s@FontWeight' {} Maybe FontWeightName
a -> FontWeight
s {$sel:name:FontWeight' :: Maybe FontWeightName
name = Maybe FontWeightName
a} :: FontWeight)

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

instance Prelude.Hashable FontWeight where
  hashWithSalt :: Int -> FontWeight -> Int
hashWithSalt Int
_salt FontWeight' {Maybe FontWeightName
name :: Maybe FontWeightName
$sel:name:FontWeight' :: FontWeight -> Maybe FontWeightName
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FontWeightName
name

instance Prelude.NFData FontWeight where
  rnf :: FontWeight -> ()
rnf FontWeight' {Maybe FontWeightName
name :: Maybe FontWeightName
$sel:name:FontWeight' :: FontWeight -> Maybe FontWeightName
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe FontWeightName
name

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