{-# 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.Pinpoint.Types.InAppMessageHeaderConfig
-- 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.Pinpoint.Types.InAppMessageHeaderConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pinpoint.Types.Alignment
import qualified Amazonka.Prelude as Prelude

-- | Text config for Message Header.
--
-- /See:/ 'newInAppMessageHeaderConfig' smart constructor.
data InAppMessageHeaderConfig = InAppMessageHeaderConfig'
  { -- | The alignment of the text. Valid values: LEFT, CENTER, RIGHT.
    InAppMessageHeaderConfig -> Alignment
alignment :: Alignment,
    -- | Message Header.
    InAppMessageHeaderConfig -> Text
header :: Prelude.Text,
    -- | The text color.
    InAppMessageHeaderConfig -> Text
textColor :: Prelude.Text
  }
  deriving (InAppMessageHeaderConfig -> InAppMessageHeaderConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InAppMessageHeaderConfig -> InAppMessageHeaderConfig -> Bool
$c/= :: InAppMessageHeaderConfig -> InAppMessageHeaderConfig -> Bool
== :: InAppMessageHeaderConfig -> InAppMessageHeaderConfig -> Bool
$c== :: InAppMessageHeaderConfig -> InAppMessageHeaderConfig -> Bool
Prelude.Eq, ReadPrec [InAppMessageHeaderConfig]
ReadPrec InAppMessageHeaderConfig
Int -> ReadS InAppMessageHeaderConfig
ReadS [InAppMessageHeaderConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InAppMessageHeaderConfig]
$creadListPrec :: ReadPrec [InAppMessageHeaderConfig]
readPrec :: ReadPrec InAppMessageHeaderConfig
$creadPrec :: ReadPrec InAppMessageHeaderConfig
readList :: ReadS [InAppMessageHeaderConfig]
$creadList :: ReadS [InAppMessageHeaderConfig]
readsPrec :: Int -> ReadS InAppMessageHeaderConfig
$creadsPrec :: Int -> ReadS InAppMessageHeaderConfig
Prelude.Read, Int -> InAppMessageHeaderConfig -> ShowS
[InAppMessageHeaderConfig] -> ShowS
InAppMessageHeaderConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InAppMessageHeaderConfig] -> ShowS
$cshowList :: [InAppMessageHeaderConfig] -> ShowS
show :: InAppMessageHeaderConfig -> String
$cshow :: InAppMessageHeaderConfig -> String
showsPrec :: Int -> InAppMessageHeaderConfig -> ShowS
$cshowsPrec :: Int -> InAppMessageHeaderConfig -> ShowS
Prelude.Show, forall x.
Rep InAppMessageHeaderConfig x -> InAppMessageHeaderConfig
forall x.
InAppMessageHeaderConfig -> Rep InAppMessageHeaderConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InAppMessageHeaderConfig x -> InAppMessageHeaderConfig
$cfrom :: forall x.
InAppMessageHeaderConfig -> Rep InAppMessageHeaderConfig x
Prelude.Generic)

-- |
-- Create a value of 'InAppMessageHeaderConfig' 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:
--
-- 'alignment', 'inAppMessageHeaderConfig_alignment' - The alignment of the text. Valid values: LEFT, CENTER, RIGHT.
--
-- 'header', 'inAppMessageHeaderConfig_header' - Message Header.
--
-- 'textColor', 'inAppMessageHeaderConfig_textColor' - The text color.
newInAppMessageHeaderConfig ::
  -- | 'alignment'
  Alignment ->
  -- | 'header'
  Prelude.Text ->
  -- | 'textColor'
  Prelude.Text ->
  InAppMessageHeaderConfig
newInAppMessageHeaderConfig :: Alignment -> Text -> Text -> InAppMessageHeaderConfig
newInAppMessageHeaderConfig
  Alignment
pAlignment_
  Text
pHeader_
  Text
pTextColor_ =
    InAppMessageHeaderConfig'
      { $sel:alignment:InAppMessageHeaderConfig' :: Alignment
alignment = Alignment
pAlignment_,
        $sel:header:InAppMessageHeaderConfig' :: Text
header = Text
pHeader_,
        $sel:textColor:InAppMessageHeaderConfig' :: Text
textColor = Text
pTextColor_
      }

-- | The alignment of the text. Valid values: LEFT, CENTER, RIGHT.
inAppMessageHeaderConfig_alignment :: Lens.Lens' InAppMessageHeaderConfig Alignment
inAppMessageHeaderConfig_alignment :: Lens' InAppMessageHeaderConfig Alignment
inAppMessageHeaderConfig_alignment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InAppMessageHeaderConfig' {Alignment
alignment :: Alignment
$sel:alignment:InAppMessageHeaderConfig' :: InAppMessageHeaderConfig -> Alignment
alignment} -> Alignment
alignment) (\s :: InAppMessageHeaderConfig
s@InAppMessageHeaderConfig' {} Alignment
a -> InAppMessageHeaderConfig
s {$sel:alignment:InAppMessageHeaderConfig' :: Alignment
alignment = Alignment
a} :: InAppMessageHeaderConfig)

-- | Message Header.
inAppMessageHeaderConfig_header :: Lens.Lens' InAppMessageHeaderConfig Prelude.Text
inAppMessageHeaderConfig_header :: Lens' InAppMessageHeaderConfig Text
inAppMessageHeaderConfig_header = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InAppMessageHeaderConfig' {Text
header :: Text
$sel:header:InAppMessageHeaderConfig' :: InAppMessageHeaderConfig -> Text
header} -> Text
header) (\s :: InAppMessageHeaderConfig
s@InAppMessageHeaderConfig' {} Text
a -> InAppMessageHeaderConfig
s {$sel:header:InAppMessageHeaderConfig' :: Text
header = Text
a} :: InAppMessageHeaderConfig)

-- | The text color.
inAppMessageHeaderConfig_textColor :: Lens.Lens' InAppMessageHeaderConfig Prelude.Text
inAppMessageHeaderConfig_textColor :: Lens' InAppMessageHeaderConfig Text
inAppMessageHeaderConfig_textColor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InAppMessageHeaderConfig' {Text
textColor :: Text
$sel:textColor:InAppMessageHeaderConfig' :: InAppMessageHeaderConfig -> Text
textColor} -> Text
textColor) (\s :: InAppMessageHeaderConfig
s@InAppMessageHeaderConfig' {} Text
a -> InAppMessageHeaderConfig
s {$sel:textColor:InAppMessageHeaderConfig' :: Text
textColor = Text
a} :: InAppMessageHeaderConfig)

instance Data.FromJSON InAppMessageHeaderConfig where
  parseJSON :: Value -> Parser InAppMessageHeaderConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InAppMessageHeaderConfig"
      ( \Object
x ->
          Alignment -> Text -> Text -> InAppMessageHeaderConfig
InAppMessageHeaderConfig'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Alignment")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Header")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"TextColor")
      )

instance Prelude.Hashable InAppMessageHeaderConfig where
  hashWithSalt :: Int -> InAppMessageHeaderConfig -> Int
hashWithSalt Int
_salt InAppMessageHeaderConfig' {Text
Alignment
textColor :: Text
header :: Text
alignment :: Alignment
$sel:textColor:InAppMessageHeaderConfig' :: InAppMessageHeaderConfig -> Text
$sel:header:InAppMessageHeaderConfig' :: InAppMessageHeaderConfig -> Text
$sel:alignment:InAppMessageHeaderConfig' :: InAppMessageHeaderConfig -> Alignment
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Alignment
alignment
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
header
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
textColor

instance Prelude.NFData InAppMessageHeaderConfig where
  rnf :: InAppMessageHeaderConfig -> ()
rnf InAppMessageHeaderConfig' {Text
Alignment
textColor :: Text
header :: Text
alignment :: Alignment
$sel:textColor:InAppMessageHeaderConfig' :: InAppMessageHeaderConfig -> Text
$sel:header:InAppMessageHeaderConfig' :: InAppMessageHeaderConfig -> Text
$sel:alignment:InAppMessageHeaderConfig' :: InAppMessageHeaderConfig -> Alignment
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Alignment
alignment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
header
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
textColor

instance Data.ToJSON InAppMessageHeaderConfig where
  toJSON :: InAppMessageHeaderConfig -> Value
toJSON InAppMessageHeaderConfig' {Text
Alignment
textColor :: Text
header :: Text
alignment :: Alignment
$sel:textColor:InAppMessageHeaderConfig' :: InAppMessageHeaderConfig -> Text
$sel:header:InAppMessageHeaderConfig' :: InAppMessageHeaderConfig -> Text
$sel:alignment:InAppMessageHeaderConfig' :: InAppMessageHeaderConfig -> Alignment
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"Alignment" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Alignment
alignment),
            forall a. a -> Maybe a
Prelude.Just (Key
"Header" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
header),
            forall a. a -> Maybe a
Prelude.Just (Key
"TextColor" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
textColor)
          ]
      )