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

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

-- | Provides information about a specific version of a message template.
--
-- /See:/ 'newTemplateVersionResponse' smart constructor.
data TemplateVersionResponse = 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 -> Maybe Text
defaultSubstitutions :: Prelude.Maybe Prelude.Text,
    -- | The custom description of the version of the message template.
    TemplateVersionResponse -> Maybe Text
templateDescription :: 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
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]
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
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. 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:
--
-- '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.
--
-- 'templateDescription', 'templateVersionResponse_templateDescription' - The custom description of the version of the message template.
--
-- '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'
      { $sel:defaultSubstitutions:TemplateVersionResponse' :: Maybe Text
defaultSubstitutions =
          forall a. Maybe a
Prelude.Nothing,
        $sel:templateDescription:TemplateVersionResponse' :: Maybe Text
templateDescription = forall a. Maybe a
Prelude.Nothing,
        $sel:version:TemplateVersionResponse' :: Maybe Text
version = 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_
      }

-- | 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 :: Lens' TemplateVersionResponse (Maybe Text)
templateVersionResponse_defaultSubstitutions = 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 custom description of the version of the message template.
templateVersionResponse_templateDescription :: Lens.Lens' TemplateVersionResponse (Prelude.Maybe Prelude.Text)
templateVersionResponse_templateDescription :: Lens' TemplateVersionResponse (Maybe Text)
templateVersionResponse_templateDescription = 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)

-- | 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 :: Lens' TemplateVersionResponse (Maybe Text)
templateVersionResponse_version = 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 :: Lens' TemplateVersionResponse Text
templateVersionResponse_lastModifiedDate = 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 :: Lens' TemplateVersionResponse Text
templateVersionResponse_creationDate = 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 :: Lens' TemplateVersionResponse Text
templateVersionResponse_templateName = 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 :: Lens' TemplateVersionResponse Text
templateVersionResponse_templateType = 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 Data.FromJSON TemplateVersionResponse where
  parseJSON :: Value -> Parser TemplateVersionResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TemplateVersionResponse"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> Text
-> TemplateVersionResponse
TemplateVersionResponse'
            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
"DefaultSubstitutions")
            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
"TemplateDescription")
            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
"Version")
            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
"LastModifiedDate")
            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
"CreationDate")
            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
"TemplateName")
            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
"TemplateType")
      )

instance Prelude.Hashable TemplateVersionResponse where
  hashWithSalt :: Int -> TemplateVersionResponse -> Int
hashWithSalt Int
_salt TemplateVersionResponse' {Maybe Text
Text
templateType :: Text
templateName :: Text
creationDate :: Text
lastModifiedDate :: Text
version :: Maybe Text
templateDescription :: Maybe Text
defaultSubstitutions :: Maybe Text
$sel:templateType:TemplateVersionResponse' :: TemplateVersionResponse -> Text
$sel:templateName:TemplateVersionResponse' :: TemplateVersionResponse -> Text
$sel:creationDate:TemplateVersionResponse' :: TemplateVersionResponse -> Text
$sel:lastModifiedDate:TemplateVersionResponse' :: TemplateVersionResponse -> Text
$sel:version:TemplateVersionResponse' :: TemplateVersionResponse -> Maybe Text
$sel:templateDescription:TemplateVersionResponse' :: TemplateVersionResponse -> Maybe Text
$sel:defaultSubstitutions:TemplateVersionResponse' :: TemplateVersionResponse -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultSubstitutions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
templateDescription
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
version
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
lastModifiedDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
templateName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
templateType

instance Prelude.NFData TemplateVersionResponse where
  rnf :: TemplateVersionResponse -> ()
rnf TemplateVersionResponse' {Maybe Text
Text
templateType :: Text
templateName :: Text
creationDate :: Text
lastModifiedDate :: Text
version :: Maybe Text
templateDescription :: Maybe Text
defaultSubstitutions :: Maybe Text
$sel:templateType:TemplateVersionResponse' :: TemplateVersionResponse -> Text
$sel:templateName:TemplateVersionResponse' :: TemplateVersionResponse -> Text
$sel:creationDate:TemplateVersionResponse' :: TemplateVersionResponse -> Text
$sel:lastModifiedDate:TemplateVersionResponse' :: TemplateVersionResponse -> Text
$sel:version:TemplateVersionResponse' :: TemplateVersionResponse -> Maybe Text
$sel:templateDescription:TemplateVersionResponse' :: TemplateVersionResponse -> Maybe Text
$sel:defaultSubstitutions:TemplateVersionResponse' :: TemplateVersionResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
defaultSubstitutions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
templateDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
version
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
lastModifiedDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
creationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
templateName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
templateType