{-# 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.DefaultButtonConfiguration
-- 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.DefaultButtonConfiguration 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.ButtonAction
import qualified Amazonka.Prelude as Prelude

-- | Default button configuration.
--
-- /See:/ 'newDefaultButtonConfiguration' smart constructor.
data DefaultButtonConfiguration = DefaultButtonConfiguration'
  { -- | The background color of the button.
    DefaultButtonConfiguration -> Maybe Text
backgroundColor :: Prelude.Maybe Prelude.Text,
    -- | The border radius of the button.
    DefaultButtonConfiguration -> Maybe Int
borderRadius :: Prelude.Maybe Prelude.Int,
    -- | Button destination.
    DefaultButtonConfiguration -> Maybe Text
link :: Prelude.Maybe Prelude.Text,
    -- | The text color of the button.
    DefaultButtonConfiguration -> Maybe Text
textColor :: Prelude.Maybe Prelude.Text,
    -- | Action triggered by the button.
    DefaultButtonConfiguration -> ButtonAction
buttonAction :: ButtonAction,
    -- | Button text.
    DefaultButtonConfiguration -> Text
text :: Prelude.Text
  }
  deriving (DefaultButtonConfiguration -> DefaultButtonConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DefaultButtonConfiguration -> DefaultButtonConfiguration -> Bool
$c/= :: DefaultButtonConfiguration -> DefaultButtonConfiguration -> Bool
== :: DefaultButtonConfiguration -> DefaultButtonConfiguration -> Bool
$c== :: DefaultButtonConfiguration -> DefaultButtonConfiguration -> Bool
Prelude.Eq, ReadPrec [DefaultButtonConfiguration]
ReadPrec DefaultButtonConfiguration
Int -> ReadS DefaultButtonConfiguration
ReadS [DefaultButtonConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DefaultButtonConfiguration]
$creadListPrec :: ReadPrec [DefaultButtonConfiguration]
readPrec :: ReadPrec DefaultButtonConfiguration
$creadPrec :: ReadPrec DefaultButtonConfiguration
readList :: ReadS [DefaultButtonConfiguration]
$creadList :: ReadS [DefaultButtonConfiguration]
readsPrec :: Int -> ReadS DefaultButtonConfiguration
$creadsPrec :: Int -> ReadS DefaultButtonConfiguration
Prelude.Read, Int -> DefaultButtonConfiguration -> ShowS
[DefaultButtonConfiguration] -> ShowS
DefaultButtonConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DefaultButtonConfiguration] -> ShowS
$cshowList :: [DefaultButtonConfiguration] -> ShowS
show :: DefaultButtonConfiguration -> String
$cshow :: DefaultButtonConfiguration -> String
showsPrec :: Int -> DefaultButtonConfiguration -> ShowS
$cshowsPrec :: Int -> DefaultButtonConfiguration -> ShowS
Prelude.Show, forall x.
Rep DefaultButtonConfiguration x -> DefaultButtonConfiguration
forall x.
DefaultButtonConfiguration -> Rep DefaultButtonConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DefaultButtonConfiguration x -> DefaultButtonConfiguration
$cfrom :: forall x.
DefaultButtonConfiguration -> Rep DefaultButtonConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DefaultButtonConfiguration' 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:
--
-- 'backgroundColor', 'defaultButtonConfiguration_backgroundColor' - The background color of the button.
--
-- 'borderRadius', 'defaultButtonConfiguration_borderRadius' - The border radius of the button.
--
-- 'link', 'defaultButtonConfiguration_link' - Button destination.
--
-- 'textColor', 'defaultButtonConfiguration_textColor' - The text color of the button.
--
-- 'buttonAction', 'defaultButtonConfiguration_buttonAction' - Action triggered by the button.
--
-- 'text', 'defaultButtonConfiguration_text' - Button text.
newDefaultButtonConfiguration ::
  -- | 'buttonAction'
  ButtonAction ->
  -- | 'text'
  Prelude.Text ->
  DefaultButtonConfiguration
newDefaultButtonConfiguration :: ButtonAction -> Text -> DefaultButtonConfiguration
newDefaultButtonConfiguration ButtonAction
pButtonAction_ Text
pText_ =
  DefaultButtonConfiguration'
    { $sel:backgroundColor:DefaultButtonConfiguration' :: Maybe Text
backgroundColor =
        forall a. Maybe a
Prelude.Nothing,
      $sel:borderRadius:DefaultButtonConfiguration' :: Maybe Int
borderRadius = forall a. Maybe a
Prelude.Nothing,
      $sel:link:DefaultButtonConfiguration' :: Maybe Text
link = forall a. Maybe a
Prelude.Nothing,
      $sel:textColor:DefaultButtonConfiguration' :: Maybe Text
textColor = forall a. Maybe a
Prelude.Nothing,
      $sel:buttonAction:DefaultButtonConfiguration' :: ButtonAction
buttonAction = ButtonAction
pButtonAction_,
      $sel:text:DefaultButtonConfiguration' :: Text
text = Text
pText_
    }

-- | The background color of the button.
defaultButtonConfiguration_backgroundColor :: Lens.Lens' DefaultButtonConfiguration (Prelude.Maybe Prelude.Text)
defaultButtonConfiguration_backgroundColor :: Lens' DefaultButtonConfiguration (Maybe Text)
defaultButtonConfiguration_backgroundColor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultButtonConfiguration' {Maybe Text
backgroundColor :: Maybe Text
$sel:backgroundColor:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
backgroundColor} -> Maybe Text
backgroundColor) (\s :: DefaultButtonConfiguration
s@DefaultButtonConfiguration' {} Maybe Text
a -> DefaultButtonConfiguration
s {$sel:backgroundColor:DefaultButtonConfiguration' :: Maybe Text
backgroundColor = Maybe Text
a} :: DefaultButtonConfiguration)

-- | The border radius of the button.
defaultButtonConfiguration_borderRadius :: Lens.Lens' DefaultButtonConfiguration (Prelude.Maybe Prelude.Int)
defaultButtonConfiguration_borderRadius :: Lens' DefaultButtonConfiguration (Maybe Int)
defaultButtonConfiguration_borderRadius = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultButtonConfiguration' {Maybe Int
borderRadius :: Maybe Int
$sel:borderRadius:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Int
borderRadius} -> Maybe Int
borderRadius) (\s :: DefaultButtonConfiguration
s@DefaultButtonConfiguration' {} Maybe Int
a -> DefaultButtonConfiguration
s {$sel:borderRadius:DefaultButtonConfiguration' :: Maybe Int
borderRadius = Maybe Int
a} :: DefaultButtonConfiguration)

-- | Button destination.
defaultButtonConfiguration_link :: Lens.Lens' DefaultButtonConfiguration (Prelude.Maybe Prelude.Text)
defaultButtonConfiguration_link :: Lens' DefaultButtonConfiguration (Maybe Text)
defaultButtonConfiguration_link = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultButtonConfiguration' {Maybe Text
link :: Maybe Text
$sel:link:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
link} -> Maybe Text
link) (\s :: DefaultButtonConfiguration
s@DefaultButtonConfiguration' {} Maybe Text
a -> DefaultButtonConfiguration
s {$sel:link:DefaultButtonConfiguration' :: Maybe Text
link = Maybe Text
a} :: DefaultButtonConfiguration)

-- | The text color of the button.
defaultButtonConfiguration_textColor :: Lens.Lens' DefaultButtonConfiguration (Prelude.Maybe Prelude.Text)
defaultButtonConfiguration_textColor :: Lens' DefaultButtonConfiguration (Maybe Text)
defaultButtonConfiguration_textColor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultButtonConfiguration' {Maybe Text
textColor :: Maybe Text
$sel:textColor:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
textColor} -> Maybe Text
textColor) (\s :: DefaultButtonConfiguration
s@DefaultButtonConfiguration' {} Maybe Text
a -> DefaultButtonConfiguration
s {$sel:textColor:DefaultButtonConfiguration' :: Maybe Text
textColor = Maybe Text
a} :: DefaultButtonConfiguration)

-- | Action triggered by the button.
defaultButtonConfiguration_buttonAction :: Lens.Lens' DefaultButtonConfiguration ButtonAction
defaultButtonConfiguration_buttonAction :: Lens' DefaultButtonConfiguration ButtonAction
defaultButtonConfiguration_buttonAction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultButtonConfiguration' {ButtonAction
buttonAction :: ButtonAction
$sel:buttonAction:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> ButtonAction
buttonAction} -> ButtonAction
buttonAction) (\s :: DefaultButtonConfiguration
s@DefaultButtonConfiguration' {} ButtonAction
a -> DefaultButtonConfiguration
s {$sel:buttonAction:DefaultButtonConfiguration' :: ButtonAction
buttonAction = ButtonAction
a} :: DefaultButtonConfiguration)

-- | Button text.
defaultButtonConfiguration_text :: Lens.Lens' DefaultButtonConfiguration Prelude.Text
defaultButtonConfiguration_text :: Lens' DefaultButtonConfiguration Text
defaultButtonConfiguration_text = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultButtonConfiguration' {Text
text :: Text
$sel:text:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Text
text} -> Text
text) (\s :: DefaultButtonConfiguration
s@DefaultButtonConfiguration' {} Text
a -> DefaultButtonConfiguration
s {$sel:text:DefaultButtonConfiguration' :: Text
text = Text
a} :: DefaultButtonConfiguration)

instance Data.FromJSON DefaultButtonConfiguration where
  parseJSON :: Value -> Parser DefaultButtonConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DefaultButtonConfiguration"
      ( \Object
x ->
          Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> ButtonAction
-> Text
-> DefaultButtonConfiguration
DefaultButtonConfiguration'
            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
"BackgroundColor")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"BorderRadius")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Link")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TextColor")
            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
"ButtonAction")
            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
"Text")
      )

instance Prelude.Hashable DefaultButtonConfiguration where
  hashWithSalt :: Int -> DefaultButtonConfiguration -> Int
hashWithSalt Int
_salt DefaultButtonConfiguration' {Maybe Int
Maybe Text
Text
ButtonAction
text :: Text
buttonAction :: ButtonAction
textColor :: Maybe Text
link :: Maybe Text
borderRadius :: Maybe Int
backgroundColor :: Maybe Text
$sel:text:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Text
$sel:buttonAction:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> ButtonAction
$sel:textColor:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
$sel:link:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
$sel:borderRadius:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Int
$sel:backgroundColor:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
backgroundColor
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
borderRadius
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
link
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
textColor
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ButtonAction
buttonAction
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
text

instance Prelude.NFData DefaultButtonConfiguration where
  rnf :: DefaultButtonConfiguration -> ()
rnf DefaultButtonConfiguration' {Maybe Int
Maybe Text
Text
ButtonAction
text :: Text
buttonAction :: ButtonAction
textColor :: Maybe Text
link :: Maybe Text
borderRadius :: Maybe Int
backgroundColor :: Maybe Text
$sel:text:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Text
$sel:buttonAction:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> ButtonAction
$sel:textColor:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
$sel:link:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
$sel:borderRadius:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Int
$sel:backgroundColor:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
backgroundColor
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
borderRadius
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
link
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
textColor
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ButtonAction
buttonAction
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
text

instance Data.ToJSON DefaultButtonConfiguration where
  toJSON :: DefaultButtonConfiguration -> Value
toJSON DefaultButtonConfiguration' {Maybe Int
Maybe Text
Text
ButtonAction
text :: Text
buttonAction :: ButtonAction
textColor :: Maybe Text
link :: Maybe Text
borderRadius :: Maybe Int
backgroundColor :: Maybe Text
$sel:text:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Text
$sel:buttonAction:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> ButtonAction
$sel:textColor:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
$sel:link:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
$sel:borderRadius:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Int
$sel:backgroundColor:DefaultButtonConfiguration' :: DefaultButtonConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"BackgroundColor" 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
backgroundColor,
            (Key
"BorderRadius" 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 Int
borderRadius,
            (Key
"Link" 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
link,
            (Key
"TextColor" 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
textColor,
            forall a. a -> Maybe a
Prelude.Just (Key
"ButtonAction" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ButtonAction
buttonAction),
            forall a. a -> Maybe a
Prelude.Just (Key
"Text" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
text)
          ]
      )