{-# 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.TemplateVersionResponse
-- 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.TemplateVersionResponse where

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

-- | Provides information about a specific version of a message template.
--
-- /See:/ 'newTemplateVersionResponse' smart constructor.
data TemplateVersionResponse = TemplateVersionResponse'
  { -- | The custom description of the version of the message template.
    TemplateVersionResponse -> Maybe Text
templateDescription :: Prelude.Maybe Prelude.Text,
    -- | A JSON object that specifies the default values that are used for
    -- message variables in the version of the message template. This object is
    -- a set of key-value pairs. Each key defines a message variable in the
    -- template. The corresponding value defines the default value for that
    -- variable.
    TemplateVersionResponse -> Maybe Text
defaultSubstitutions :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the version of the message template. This
    -- value is an integer that Amazon Pinpoint automatically increments and
    -- assigns to each new version of a template.
    TemplateVersionResponse -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The date, in ISO 8601 format, when the version of the message template
    -- was last modified.
    TemplateVersionResponse -> Text
lastModifiedDate :: Prelude.Text,
    -- | The date, in ISO 8601 format, when the version of the message template
    -- was created.
    TemplateVersionResponse -> Text
creationDate :: Prelude.Text,
    -- | The name of the message template.
    TemplateVersionResponse -> Text
templateName :: Prelude.Text,
    -- | The type of channel that the message template is designed for. Possible
    -- values are: EMAIL, PUSH, SMS, and VOICE.
    TemplateVersionResponse -> Text
templateType :: Prelude.Text
  }
  deriving (TemplateVersionResponse -> TemplateVersionResponse -> Bool
(TemplateVersionResponse -> TemplateVersionResponse -> Bool)
-> (TemplateVersionResponse -> TemplateVersionResponse -> Bool)
-> Eq TemplateVersionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateVersionResponse -> TemplateVersionResponse -> Bool
$c/= :: TemplateVersionResponse -> TemplateVersionResponse -> Bool
== :: TemplateVersionResponse -> TemplateVersionResponse -> Bool
$c== :: TemplateVersionResponse -> TemplateVersionResponse -> Bool
Prelude.Eq, ReadPrec [TemplateVersionResponse]
ReadPrec TemplateVersionResponse
Int -> ReadS TemplateVersionResponse
ReadS [TemplateVersionResponse]
(Int -> ReadS TemplateVersionResponse)
-> ReadS [TemplateVersionResponse]
-> ReadPrec TemplateVersionResponse
-> ReadPrec [TemplateVersionResponse]
-> Read TemplateVersionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TemplateVersionResponse]
$creadListPrec :: ReadPrec [TemplateVersionResponse]
readPrec :: ReadPrec TemplateVersionResponse
$creadPrec :: ReadPrec TemplateVersionResponse
readList :: ReadS [TemplateVersionResponse]
$creadList :: ReadS [TemplateVersionResponse]
readsPrec :: Int -> ReadS TemplateVersionResponse
$creadsPrec :: Int -> ReadS TemplateVersionResponse
Prelude.Read, Int -> TemplateVersionResponse -> ShowS
[TemplateVersionResponse] -> ShowS
TemplateVersionResponse -> String
(Int -> TemplateVersionResponse -> ShowS)
-> (TemplateVersionResponse -> String)
-> ([TemplateVersionResponse] -> ShowS)
-> Show TemplateVersionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateVersionResponse] -> ShowS
$cshowList :: [TemplateVersionResponse] -> ShowS
show :: TemplateVersionResponse -> String
$cshow :: TemplateVersionResponse -> String
showsPrec :: Int -> TemplateVersionResponse -> ShowS
$cshowsPrec :: Int -> TemplateVersionResponse -> ShowS
Prelude.Show, (forall x.
 TemplateVersionResponse -> Rep TemplateVersionResponse x)
-> (forall x.
    Rep TemplateVersionResponse x -> TemplateVersionResponse)
-> Generic TemplateVersionResponse
forall x. Rep TemplateVersionResponse x -> TemplateVersionResponse
forall x. TemplateVersionResponse -> Rep TemplateVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TemplateVersionResponse x -> TemplateVersionResponse
$cfrom :: forall x. TemplateVersionResponse -> Rep TemplateVersionResponse x
Prelude.Generic)

-- |
-- Create a value of 'TemplateVersionResponse' 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:
--
-- 'templateDescription', 'templateVersionResponse_templateDescription' - The custom description of the version of the message template.
--
-- 'defaultSubstitutions', 'templateVersionResponse_defaultSubstitutions' - A JSON object that specifies the default values that are used for
-- message variables in the version of the message template. This object is
-- a set of key-value pairs. Each key defines a message variable in the
-- template. The corresponding value defines the default value for that
-- variable.
--
-- 'version', 'templateVersionResponse_version' - The unique identifier for the version of the message template. This
-- value is an integer that Amazon Pinpoint automatically increments and
-- assigns to each new version of a template.
--
-- 'lastModifiedDate', 'templateVersionResponse_lastModifiedDate' - The date, in ISO 8601 format, when the version of the message template
-- was last modified.
--
-- 'creationDate', 'templateVersionResponse_creationDate' - The date, in ISO 8601 format, when the version of the message template
-- was created.
--
-- 'templateName', 'templateVersionResponse_templateName' - The name of the message template.
--
-- 'templateType', 'templateVersionResponse_templateType' - The type of channel that the message template is designed for. Possible
-- values are: EMAIL, PUSH, SMS, and VOICE.
newTemplateVersionResponse ::
  -- | 'lastModifiedDate'
  Prelude.Text ->
  -- | 'creationDate'
  Prelude.Text ->
  -- | 'templateName'
  Prelude.Text ->
  -- | 'templateType'
  Prelude.Text ->
  TemplateVersionResponse
newTemplateVersionResponse :: Text -> Text -> Text -> Text -> TemplateVersionResponse
newTemplateVersionResponse
  Text
pLastModifiedDate_
  Text
pCreationDate_
  Text
pTemplateName_
  Text
pTemplateType_ =
    TemplateVersionResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> Text
-> TemplateVersionResponse
TemplateVersionResponse'
      { $sel:templateDescription:TemplateVersionResponse' :: Maybe Text
templateDescription =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:defaultSubstitutions:TemplateVersionResponse' :: Maybe Text
defaultSubstitutions = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:version:TemplateVersionResponse' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:lastModifiedDate:TemplateVersionResponse' :: Text
lastModifiedDate = Text
pLastModifiedDate_,
        $sel:creationDate:TemplateVersionResponse' :: Text
creationDate = Text
pCreationDate_,
        $sel:templateName:TemplateVersionResponse' :: Text
templateName = Text
pTemplateName_,
        $sel:templateType:TemplateVersionResponse' :: Text
templateType = Text
pTemplateType_
      }

-- | The custom description of the version of the message template.
templateVersionResponse_templateDescription :: Lens.Lens' TemplateVersionResponse (Prelude.Maybe Prelude.Text)
templateVersionResponse_templateDescription :: (Maybe Text -> f (Maybe Text))
-> TemplateVersionResponse -> f TemplateVersionResponse
templateVersionResponse_templateDescription = (TemplateVersionResponse -> Maybe Text)
-> (TemplateVersionResponse
    -> Maybe Text -> TemplateVersionResponse)
-> Lens
     TemplateVersionResponse
     TemplateVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionResponse' {Maybe Text
templateDescription :: Maybe Text
$sel:templateDescription:TemplateVersionResponse' :: TemplateVersionResponse -> Maybe Text
templateDescription} -> Maybe Text
templateDescription) (\s :: TemplateVersionResponse
s@TemplateVersionResponse' {} Maybe Text
a -> TemplateVersionResponse
s {$sel:templateDescription:TemplateVersionResponse' :: Maybe Text
templateDescription = Maybe Text
a} :: TemplateVersionResponse)

-- | A JSON object that specifies the default values that are used for
-- message variables in the version of the message template. This object is
-- a set of key-value pairs. Each key defines a message variable in the
-- template. The corresponding value defines the default value for that
-- variable.
templateVersionResponse_defaultSubstitutions :: Lens.Lens' TemplateVersionResponse (Prelude.Maybe Prelude.Text)
templateVersionResponse_defaultSubstitutions :: (Maybe Text -> f (Maybe Text))
-> TemplateVersionResponse -> f TemplateVersionResponse
templateVersionResponse_defaultSubstitutions = (TemplateVersionResponse -> Maybe Text)
-> (TemplateVersionResponse
    -> Maybe Text -> TemplateVersionResponse)
-> Lens
     TemplateVersionResponse
     TemplateVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionResponse' {Maybe Text
defaultSubstitutions :: Maybe Text
$sel:defaultSubstitutions:TemplateVersionResponse' :: TemplateVersionResponse -> Maybe Text
defaultSubstitutions} -> Maybe Text
defaultSubstitutions) (\s :: TemplateVersionResponse
s@TemplateVersionResponse' {} Maybe Text
a -> TemplateVersionResponse
s {$sel:defaultSubstitutions:TemplateVersionResponse' :: Maybe Text
defaultSubstitutions = Maybe Text
a} :: TemplateVersionResponse)

-- | The unique identifier for the version of the message template. This
-- value is an integer that Amazon Pinpoint automatically increments and
-- assigns to each new version of a template.
templateVersionResponse_version :: Lens.Lens' TemplateVersionResponse (Prelude.Maybe Prelude.Text)
templateVersionResponse_version :: (Maybe Text -> f (Maybe Text))
-> TemplateVersionResponse -> f TemplateVersionResponse
templateVersionResponse_version = (TemplateVersionResponse -> Maybe Text)
-> (TemplateVersionResponse
    -> Maybe Text -> TemplateVersionResponse)
-> Lens
     TemplateVersionResponse
     TemplateVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionResponse' {Maybe Text
version :: Maybe Text
$sel:version:TemplateVersionResponse' :: TemplateVersionResponse -> Maybe Text
version} -> Maybe Text
version) (\s :: TemplateVersionResponse
s@TemplateVersionResponse' {} Maybe Text
a -> TemplateVersionResponse
s {$sel:version:TemplateVersionResponse' :: Maybe Text
version = Maybe Text
a} :: TemplateVersionResponse)

-- | The date, in ISO 8601 format, when the version of the message template
-- was last modified.
templateVersionResponse_lastModifiedDate :: Lens.Lens' TemplateVersionResponse Prelude.Text
templateVersionResponse_lastModifiedDate :: (Text -> f Text)
-> TemplateVersionResponse -> f TemplateVersionResponse
templateVersionResponse_lastModifiedDate = (TemplateVersionResponse -> Text)
-> (TemplateVersionResponse -> Text -> TemplateVersionResponse)
-> Lens TemplateVersionResponse TemplateVersionResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionResponse' {Text
lastModifiedDate :: Text
$sel:lastModifiedDate:TemplateVersionResponse' :: TemplateVersionResponse -> Text
lastModifiedDate} -> Text
lastModifiedDate) (\s :: TemplateVersionResponse
s@TemplateVersionResponse' {} Text
a -> TemplateVersionResponse
s {$sel:lastModifiedDate:TemplateVersionResponse' :: Text
lastModifiedDate = Text
a} :: TemplateVersionResponse)

-- | The date, in ISO 8601 format, when the version of the message template
-- was created.
templateVersionResponse_creationDate :: Lens.Lens' TemplateVersionResponse Prelude.Text
templateVersionResponse_creationDate :: (Text -> f Text)
-> TemplateVersionResponse -> f TemplateVersionResponse
templateVersionResponse_creationDate = (TemplateVersionResponse -> Text)
-> (TemplateVersionResponse -> Text -> TemplateVersionResponse)
-> Lens TemplateVersionResponse TemplateVersionResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionResponse' {Text
creationDate :: Text
$sel:creationDate:TemplateVersionResponse' :: TemplateVersionResponse -> Text
creationDate} -> Text
creationDate) (\s :: TemplateVersionResponse
s@TemplateVersionResponse' {} Text
a -> TemplateVersionResponse
s {$sel:creationDate:TemplateVersionResponse' :: Text
creationDate = Text
a} :: TemplateVersionResponse)

-- | The name of the message template.
templateVersionResponse_templateName :: Lens.Lens' TemplateVersionResponse Prelude.Text
templateVersionResponse_templateName :: (Text -> f Text)
-> TemplateVersionResponse -> f TemplateVersionResponse
templateVersionResponse_templateName = (TemplateVersionResponse -> Text)
-> (TemplateVersionResponse -> Text -> TemplateVersionResponse)
-> Lens TemplateVersionResponse TemplateVersionResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionResponse' {Text
templateName :: Text
$sel:templateName:TemplateVersionResponse' :: TemplateVersionResponse -> Text
templateName} -> Text
templateName) (\s :: TemplateVersionResponse
s@TemplateVersionResponse' {} Text
a -> TemplateVersionResponse
s {$sel:templateName:TemplateVersionResponse' :: Text
templateName = Text
a} :: TemplateVersionResponse)

-- | The type of channel that the message template is designed for. Possible
-- values are: EMAIL, PUSH, SMS, and VOICE.
templateVersionResponse_templateType :: Lens.Lens' TemplateVersionResponse Prelude.Text
templateVersionResponse_templateType :: (Text -> f Text)
-> TemplateVersionResponse -> f TemplateVersionResponse
templateVersionResponse_templateType = (TemplateVersionResponse -> Text)
-> (TemplateVersionResponse -> Text -> TemplateVersionResponse)
-> Lens TemplateVersionResponse TemplateVersionResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionResponse' {Text
templateType :: Text
$sel:templateType:TemplateVersionResponse' :: TemplateVersionResponse -> Text
templateType} -> Text
templateType) (\s :: TemplateVersionResponse
s@TemplateVersionResponse' {} Text
a -> TemplateVersionResponse
s {$sel:templateType:TemplateVersionResponse' :: Text
templateType = Text
a} :: TemplateVersionResponse)

instance Core.FromJSON TemplateVersionResponse where
  parseJSON :: Value -> Parser TemplateVersionResponse
parseJSON =
    String
-> (Object -> Parser TemplateVersionResponse)
-> Value
-> Parser TemplateVersionResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TemplateVersionResponse"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> Text
-> TemplateVersionResponse
TemplateVersionResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Text
 -> Text
 -> Text
 -> Text
 -> TemplateVersionResponse)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> Text
      -> Text
      -> TemplateVersionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TemplateDescription")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> Text
   -> Text
   -> TemplateVersionResponse)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Text -> Text -> Text -> Text -> TemplateVersionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DefaultSubstitutions")
            Parser
  (Maybe Text
   -> Text -> Text -> Text -> Text -> TemplateVersionResponse)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> Text -> Text -> TemplateVersionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Version")
            Parser (Text -> Text -> Text -> Text -> TemplateVersionResponse)
-> Parser Text
-> Parser (Text -> Text -> Text -> TemplateVersionResponse)
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
"LastModifiedDate")
            Parser (Text -> Text -> Text -> TemplateVersionResponse)
-> Parser Text -> Parser (Text -> Text -> TemplateVersionResponse)
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
"CreationDate")
            Parser (Text -> Text -> TemplateVersionResponse)
-> Parser Text -> Parser (Text -> TemplateVersionResponse)
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
"TemplateName")
            Parser (Text -> TemplateVersionResponse)
-> Parser Text -> Parser TemplateVersionResponse
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
"TemplateType")
      )

instance Prelude.Hashable TemplateVersionResponse

instance Prelude.NFData TemplateVersionResponse