{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Pinpoint.Types.InAppMessageHeaderConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(InAppMessageHeaderConfig -> InAppMessageHeaderConfig -> Bool)
-> (InAppMessageHeaderConfig -> InAppMessageHeaderConfig -> Bool)
-> Eq InAppMessageHeaderConfig
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]
(Int -> ReadS InAppMessageHeaderConfig)
-> ReadS [InAppMessageHeaderConfig]
-> ReadPrec InAppMessageHeaderConfig
-> ReadPrec [InAppMessageHeaderConfig]
-> Read 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
(Int -> InAppMessageHeaderConfig -> ShowS)
-> (InAppMessageHeaderConfig -> String)
-> ([InAppMessageHeaderConfig] -> ShowS)
-> Show InAppMessageHeaderConfig
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.
 InAppMessageHeaderConfig -> Rep InAppMessageHeaderConfig x)
-> (forall x.
    Rep InAppMessageHeaderConfig x -> InAppMessageHeaderConfig)
-> Generic InAppMessageHeaderConfig
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' :: Alignment -> Text -> Text -> InAppMessageHeaderConfig
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 :: (Alignment -> f Alignment)
-> InAppMessageHeaderConfig -> f InAppMessageHeaderConfig
inAppMessageHeaderConfig_alignment = (InAppMessageHeaderConfig -> Alignment)
-> (InAppMessageHeaderConfig
    -> Alignment -> InAppMessageHeaderConfig)
-> Lens
     InAppMessageHeaderConfig
     InAppMessageHeaderConfig
     Alignment
     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 :: (Text -> f Text)
-> InAppMessageHeaderConfig -> f InAppMessageHeaderConfig
inAppMessageHeaderConfig_header = (InAppMessageHeaderConfig -> Text)
-> (InAppMessageHeaderConfig -> Text -> InAppMessageHeaderConfig)
-> Lens InAppMessageHeaderConfig InAppMessageHeaderConfig Text Text
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 :: (Text -> f Text)
-> InAppMessageHeaderConfig -> f InAppMessageHeaderConfig
inAppMessageHeaderConfig_textColor = (InAppMessageHeaderConfig -> Text)
-> (InAppMessageHeaderConfig -> Text -> InAppMessageHeaderConfig)
-> Lens InAppMessageHeaderConfig InAppMessageHeaderConfig Text Text
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 Core.FromJSON InAppMessageHeaderConfig where
  parseJSON :: Value -> Parser InAppMessageHeaderConfig
parseJSON =
    String
-> (Object -> Parser InAppMessageHeaderConfig)
-> Value
-> Parser InAppMessageHeaderConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InAppMessageHeaderConfig"
      ( \Object
x ->
          Alignment -> Text -> Text -> InAppMessageHeaderConfig
InAppMessageHeaderConfig'
            (Alignment -> Text -> Text -> InAppMessageHeaderConfig)
-> Parser Alignment
-> Parser (Text -> Text -> InAppMessageHeaderConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Alignment
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Alignment")
            Parser (Text -> Text -> InAppMessageHeaderConfig)
-> Parser Text -> Parser (Text -> InAppMessageHeaderConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Header")
            Parser (Text -> InAppMessageHeaderConfig)
-> Parser Text -> Parser InAppMessageHeaderConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TextColor")
      )

instance Prelude.Hashable InAppMessageHeaderConfig

instance Prelude.NFData InAppMessageHeaderConfig

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Alignment" Text -> Alignment -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Alignment
alignment),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Header" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
header),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TextColor" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
textColor)
          ]
      )