{-# 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.SES.Types.CustomVerificationEmailTemplate
-- 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.SES.Types.CustomVerificationEmailTemplate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a custom verification email template.
--
-- /See:/ 'newCustomVerificationEmailTemplate' smart constructor.
data CustomVerificationEmailTemplate = CustomVerificationEmailTemplate'
  { -- | The email address that the custom verification email is sent from.
    CustomVerificationEmailTemplate -> Maybe Text
fromEmailAddress :: Prelude.Maybe Prelude.Text,
    -- | The name of the custom verification email template.
    CustomVerificationEmailTemplate -> Maybe Text
templateName :: Prelude.Maybe Prelude.Text,
    -- | The URL that the recipient of the verification email is sent to if his
    -- or her address is not successfully verified.
    CustomVerificationEmailTemplate -> Maybe Text
failureRedirectionURL :: Prelude.Maybe Prelude.Text,
    -- | The subject line of the custom verification email.
    CustomVerificationEmailTemplate -> Maybe Text
templateSubject :: Prelude.Maybe Prelude.Text,
    -- | The URL that the recipient of the verification email is sent to if his
    -- or her address is successfully verified.
    CustomVerificationEmailTemplate -> Maybe Text
successRedirectionURL :: Prelude.Maybe Prelude.Text
  }
  deriving (CustomVerificationEmailTemplate
-> CustomVerificationEmailTemplate -> Bool
(CustomVerificationEmailTemplate
 -> CustomVerificationEmailTemplate -> Bool)
-> (CustomVerificationEmailTemplate
    -> CustomVerificationEmailTemplate -> Bool)
-> Eq CustomVerificationEmailTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomVerificationEmailTemplate
-> CustomVerificationEmailTemplate -> Bool
$c/= :: CustomVerificationEmailTemplate
-> CustomVerificationEmailTemplate -> Bool
== :: CustomVerificationEmailTemplate
-> CustomVerificationEmailTemplate -> Bool
$c== :: CustomVerificationEmailTemplate
-> CustomVerificationEmailTemplate -> Bool
Prelude.Eq, ReadPrec [CustomVerificationEmailTemplate]
ReadPrec CustomVerificationEmailTemplate
Int -> ReadS CustomVerificationEmailTemplate
ReadS [CustomVerificationEmailTemplate]
(Int -> ReadS CustomVerificationEmailTemplate)
-> ReadS [CustomVerificationEmailTemplate]
-> ReadPrec CustomVerificationEmailTemplate
-> ReadPrec [CustomVerificationEmailTemplate]
-> Read CustomVerificationEmailTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomVerificationEmailTemplate]
$creadListPrec :: ReadPrec [CustomVerificationEmailTemplate]
readPrec :: ReadPrec CustomVerificationEmailTemplate
$creadPrec :: ReadPrec CustomVerificationEmailTemplate
readList :: ReadS [CustomVerificationEmailTemplate]
$creadList :: ReadS [CustomVerificationEmailTemplate]
readsPrec :: Int -> ReadS CustomVerificationEmailTemplate
$creadsPrec :: Int -> ReadS CustomVerificationEmailTemplate
Prelude.Read, Int -> CustomVerificationEmailTemplate -> ShowS
[CustomVerificationEmailTemplate] -> ShowS
CustomVerificationEmailTemplate -> String
(Int -> CustomVerificationEmailTemplate -> ShowS)
-> (CustomVerificationEmailTemplate -> String)
-> ([CustomVerificationEmailTemplate] -> ShowS)
-> Show CustomVerificationEmailTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomVerificationEmailTemplate] -> ShowS
$cshowList :: [CustomVerificationEmailTemplate] -> ShowS
show :: CustomVerificationEmailTemplate -> String
$cshow :: CustomVerificationEmailTemplate -> String
showsPrec :: Int -> CustomVerificationEmailTemplate -> ShowS
$cshowsPrec :: Int -> CustomVerificationEmailTemplate -> ShowS
Prelude.Show, (forall x.
 CustomVerificationEmailTemplate
 -> Rep CustomVerificationEmailTemplate x)
-> (forall x.
    Rep CustomVerificationEmailTemplate x
    -> CustomVerificationEmailTemplate)
-> Generic CustomVerificationEmailTemplate
forall x.
Rep CustomVerificationEmailTemplate x
-> CustomVerificationEmailTemplate
forall x.
CustomVerificationEmailTemplate
-> Rep CustomVerificationEmailTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomVerificationEmailTemplate x
-> CustomVerificationEmailTemplate
$cfrom :: forall x.
CustomVerificationEmailTemplate
-> Rep CustomVerificationEmailTemplate x
Prelude.Generic)

-- |
-- Create a value of 'CustomVerificationEmailTemplate' 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:
--
-- 'fromEmailAddress', 'customVerificationEmailTemplate_fromEmailAddress' - The email address that the custom verification email is sent from.
--
-- 'templateName', 'customVerificationEmailTemplate_templateName' - The name of the custom verification email template.
--
-- 'failureRedirectionURL', 'customVerificationEmailTemplate_failureRedirectionURL' - The URL that the recipient of the verification email is sent to if his
-- or her address is not successfully verified.
--
-- 'templateSubject', 'customVerificationEmailTemplate_templateSubject' - The subject line of the custom verification email.
--
-- 'successRedirectionURL', 'customVerificationEmailTemplate_successRedirectionURL' - The URL that the recipient of the verification email is sent to if his
-- or her address is successfully verified.
newCustomVerificationEmailTemplate ::
  CustomVerificationEmailTemplate
newCustomVerificationEmailTemplate :: CustomVerificationEmailTemplate
newCustomVerificationEmailTemplate =
  CustomVerificationEmailTemplate' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> CustomVerificationEmailTemplate
CustomVerificationEmailTemplate'
    { $sel:fromEmailAddress:CustomVerificationEmailTemplate' :: Maybe Text
fromEmailAddress =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:templateName:CustomVerificationEmailTemplate' :: Maybe Text
templateName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:failureRedirectionURL:CustomVerificationEmailTemplate' :: Maybe Text
failureRedirectionURL = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:templateSubject:CustomVerificationEmailTemplate' :: Maybe Text
templateSubject = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:successRedirectionURL:CustomVerificationEmailTemplate' :: Maybe Text
successRedirectionURL = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The email address that the custom verification email is sent from.
customVerificationEmailTemplate_fromEmailAddress :: Lens.Lens' CustomVerificationEmailTemplate (Prelude.Maybe Prelude.Text)
customVerificationEmailTemplate_fromEmailAddress :: (Maybe Text -> f (Maybe Text))
-> CustomVerificationEmailTemplate
-> f CustomVerificationEmailTemplate
customVerificationEmailTemplate_fromEmailAddress = (CustomVerificationEmailTemplate -> Maybe Text)
-> (CustomVerificationEmailTemplate
    -> Maybe Text -> CustomVerificationEmailTemplate)
-> Lens
     CustomVerificationEmailTemplate
     CustomVerificationEmailTemplate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomVerificationEmailTemplate' {Maybe Text
fromEmailAddress :: Maybe Text
$sel:fromEmailAddress:CustomVerificationEmailTemplate' :: CustomVerificationEmailTemplate -> Maybe Text
fromEmailAddress} -> Maybe Text
fromEmailAddress) (\s :: CustomVerificationEmailTemplate
s@CustomVerificationEmailTemplate' {} Maybe Text
a -> CustomVerificationEmailTemplate
s {$sel:fromEmailAddress:CustomVerificationEmailTemplate' :: Maybe Text
fromEmailAddress = Maybe Text
a} :: CustomVerificationEmailTemplate)

-- | The name of the custom verification email template.
customVerificationEmailTemplate_templateName :: Lens.Lens' CustomVerificationEmailTemplate (Prelude.Maybe Prelude.Text)
customVerificationEmailTemplate_templateName :: (Maybe Text -> f (Maybe Text))
-> CustomVerificationEmailTemplate
-> f CustomVerificationEmailTemplate
customVerificationEmailTemplate_templateName = (CustomVerificationEmailTemplate -> Maybe Text)
-> (CustomVerificationEmailTemplate
    -> Maybe Text -> CustomVerificationEmailTemplate)
-> Lens
     CustomVerificationEmailTemplate
     CustomVerificationEmailTemplate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomVerificationEmailTemplate' {Maybe Text
templateName :: Maybe Text
$sel:templateName:CustomVerificationEmailTemplate' :: CustomVerificationEmailTemplate -> Maybe Text
templateName} -> Maybe Text
templateName) (\s :: CustomVerificationEmailTemplate
s@CustomVerificationEmailTemplate' {} Maybe Text
a -> CustomVerificationEmailTemplate
s {$sel:templateName:CustomVerificationEmailTemplate' :: Maybe Text
templateName = Maybe Text
a} :: CustomVerificationEmailTemplate)

-- | The URL that the recipient of the verification email is sent to if his
-- or her address is not successfully verified.
customVerificationEmailTemplate_failureRedirectionURL :: Lens.Lens' CustomVerificationEmailTemplate (Prelude.Maybe Prelude.Text)
customVerificationEmailTemplate_failureRedirectionURL :: (Maybe Text -> f (Maybe Text))
-> CustomVerificationEmailTemplate
-> f CustomVerificationEmailTemplate
customVerificationEmailTemplate_failureRedirectionURL = (CustomVerificationEmailTemplate -> Maybe Text)
-> (CustomVerificationEmailTemplate
    -> Maybe Text -> CustomVerificationEmailTemplate)
-> Lens
     CustomVerificationEmailTemplate
     CustomVerificationEmailTemplate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomVerificationEmailTemplate' {Maybe Text
failureRedirectionURL :: Maybe Text
$sel:failureRedirectionURL:CustomVerificationEmailTemplate' :: CustomVerificationEmailTemplate -> Maybe Text
failureRedirectionURL} -> Maybe Text
failureRedirectionURL) (\s :: CustomVerificationEmailTemplate
s@CustomVerificationEmailTemplate' {} Maybe Text
a -> CustomVerificationEmailTemplate
s {$sel:failureRedirectionURL:CustomVerificationEmailTemplate' :: Maybe Text
failureRedirectionURL = Maybe Text
a} :: CustomVerificationEmailTemplate)

-- | The subject line of the custom verification email.
customVerificationEmailTemplate_templateSubject :: Lens.Lens' CustomVerificationEmailTemplate (Prelude.Maybe Prelude.Text)
customVerificationEmailTemplate_templateSubject :: (Maybe Text -> f (Maybe Text))
-> CustomVerificationEmailTemplate
-> f CustomVerificationEmailTemplate
customVerificationEmailTemplate_templateSubject = (CustomVerificationEmailTemplate -> Maybe Text)
-> (CustomVerificationEmailTemplate
    -> Maybe Text -> CustomVerificationEmailTemplate)
-> Lens
     CustomVerificationEmailTemplate
     CustomVerificationEmailTemplate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomVerificationEmailTemplate' {Maybe Text
templateSubject :: Maybe Text
$sel:templateSubject:CustomVerificationEmailTemplate' :: CustomVerificationEmailTemplate -> Maybe Text
templateSubject} -> Maybe Text
templateSubject) (\s :: CustomVerificationEmailTemplate
s@CustomVerificationEmailTemplate' {} Maybe Text
a -> CustomVerificationEmailTemplate
s {$sel:templateSubject:CustomVerificationEmailTemplate' :: Maybe Text
templateSubject = Maybe Text
a} :: CustomVerificationEmailTemplate)

-- | The URL that the recipient of the verification email is sent to if his
-- or her address is successfully verified.
customVerificationEmailTemplate_successRedirectionURL :: Lens.Lens' CustomVerificationEmailTemplate (Prelude.Maybe Prelude.Text)
customVerificationEmailTemplate_successRedirectionURL :: (Maybe Text -> f (Maybe Text))
-> CustomVerificationEmailTemplate
-> f CustomVerificationEmailTemplate
customVerificationEmailTemplate_successRedirectionURL = (CustomVerificationEmailTemplate -> Maybe Text)
-> (CustomVerificationEmailTemplate
    -> Maybe Text -> CustomVerificationEmailTemplate)
-> Lens
     CustomVerificationEmailTemplate
     CustomVerificationEmailTemplate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomVerificationEmailTemplate' {Maybe Text
successRedirectionURL :: Maybe Text
$sel:successRedirectionURL:CustomVerificationEmailTemplate' :: CustomVerificationEmailTemplate -> Maybe Text
successRedirectionURL} -> Maybe Text
successRedirectionURL) (\s :: CustomVerificationEmailTemplate
s@CustomVerificationEmailTemplate' {} Maybe Text
a -> CustomVerificationEmailTemplate
s {$sel:successRedirectionURL:CustomVerificationEmailTemplate' :: Maybe Text
successRedirectionURL = Maybe Text
a} :: CustomVerificationEmailTemplate)

instance Core.FromXML CustomVerificationEmailTemplate where
  parseXML :: [Node] -> Either String CustomVerificationEmailTemplate
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> CustomVerificationEmailTemplate
CustomVerificationEmailTemplate'
      (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> CustomVerificationEmailTemplate)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> CustomVerificationEmailTemplate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"FromEmailAddress")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> CustomVerificationEmailTemplate)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Text -> CustomVerificationEmailTemplate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TemplateName")
      Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Text -> CustomVerificationEmailTemplate)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Maybe Text -> CustomVerificationEmailTemplate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"FailureRedirectionURL")
      Either
  String
  (Maybe Text -> Maybe Text -> CustomVerificationEmailTemplate)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> CustomVerificationEmailTemplate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TemplateSubject")
      Either String (Maybe Text -> CustomVerificationEmailTemplate)
-> Either String (Maybe Text)
-> Either String CustomVerificationEmailTemplate
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SuccessRedirectionURL")

instance
  Prelude.Hashable
    CustomVerificationEmailTemplate

instance
  Prelude.NFData
    CustomVerificationEmailTemplate