{-# 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.SMSTemplateRequest
-- 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.SMSTemplateRequest 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

-- | Specifies the content and settings for a message template that can be
-- used in text messages that are sent through the SMS channel.
--
-- /See:/ 'newSMSTemplateRequest' smart constructor.
data SMSTemplateRequest = SMSTemplateRequest'
  { -- | The message body to use in text messages that are based on the message
    -- template.
    SMSTemplateRequest -> Maybe Text
body :: Prelude.Maybe Prelude.Text,
    -- | A JSON object that specifies the default values to use for message
    -- variables in 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. When
    -- you create a message that\'s based on the template, you can override
    -- these defaults with message-specific and address-specific variables and
    -- values.
    SMSTemplateRequest -> Maybe Text
defaultSubstitutions :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the recommender model to use for the message
    -- template. Amazon Pinpoint uses this value to determine how to retrieve
    -- and process data from a recommender model when it sends messages that
    -- use the template, if the template contains message variables for
    -- recommendation data.
    SMSTemplateRequest -> Maybe Text
recommenderId :: Prelude.Maybe Prelude.Text,
    -- | A custom description of the message template.
    SMSTemplateRequest -> Maybe Text
templateDescription :: Prelude.Maybe Prelude.Text,
    -- | A string-to-string map of key-value pairs that defines the tags to
    -- associate with the message template. Each tag consists of a required tag
    -- key and an associated tag value.
    SMSTemplateRequest -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (SMSTemplateRequest -> SMSTemplateRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SMSTemplateRequest -> SMSTemplateRequest -> Bool
$c/= :: SMSTemplateRequest -> SMSTemplateRequest -> Bool
== :: SMSTemplateRequest -> SMSTemplateRequest -> Bool
$c== :: SMSTemplateRequest -> SMSTemplateRequest -> Bool
Prelude.Eq, ReadPrec [SMSTemplateRequest]
ReadPrec SMSTemplateRequest
Int -> ReadS SMSTemplateRequest
ReadS [SMSTemplateRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SMSTemplateRequest]
$creadListPrec :: ReadPrec [SMSTemplateRequest]
readPrec :: ReadPrec SMSTemplateRequest
$creadPrec :: ReadPrec SMSTemplateRequest
readList :: ReadS [SMSTemplateRequest]
$creadList :: ReadS [SMSTemplateRequest]
readsPrec :: Int -> ReadS SMSTemplateRequest
$creadsPrec :: Int -> ReadS SMSTemplateRequest
Prelude.Read, Int -> SMSTemplateRequest -> ShowS
[SMSTemplateRequest] -> ShowS
SMSTemplateRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SMSTemplateRequest] -> ShowS
$cshowList :: [SMSTemplateRequest] -> ShowS
show :: SMSTemplateRequest -> String
$cshow :: SMSTemplateRequest -> String
showsPrec :: Int -> SMSTemplateRequest -> ShowS
$cshowsPrec :: Int -> SMSTemplateRequest -> ShowS
Prelude.Show, forall x. Rep SMSTemplateRequest x -> SMSTemplateRequest
forall x. SMSTemplateRequest -> Rep SMSTemplateRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SMSTemplateRequest x -> SMSTemplateRequest
$cfrom :: forall x. SMSTemplateRequest -> Rep SMSTemplateRequest x
Prelude.Generic)

-- |
-- Create a value of 'SMSTemplateRequest' 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:
--
-- 'body', 'sMSTemplateRequest_body' - The message body to use in text messages that are based on the message
-- template.
--
-- 'defaultSubstitutions', 'sMSTemplateRequest_defaultSubstitutions' - A JSON object that specifies the default values to use for message
-- variables in 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. When
-- you create a message that\'s based on the template, you can override
-- these defaults with message-specific and address-specific variables and
-- values.
--
-- 'recommenderId', 'sMSTemplateRequest_recommenderId' - The unique identifier for the recommender model to use for the message
-- template. Amazon Pinpoint uses this value to determine how to retrieve
-- and process data from a recommender model when it sends messages that
-- use the template, if the template contains message variables for
-- recommendation data.
--
-- 'templateDescription', 'sMSTemplateRequest_templateDescription' - A custom description of the message template.
--
-- 'tags', 'sMSTemplateRequest_tags' - A string-to-string map of key-value pairs that defines the tags to
-- associate with the message template. Each tag consists of a required tag
-- key and an associated tag value.
newSMSTemplateRequest ::
  SMSTemplateRequest
newSMSTemplateRequest :: SMSTemplateRequest
newSMSTemplateRequest =
  SMSTemplateRequest'
    { $sel:body:SMSTemplateRequest' :: Maybe Text
body = forall a. Maybe a
Prelude.Nothing,
      $sel:defaultSubstitutions:SMSTemplateRequest' :: Maybe Text
defaultSubstitutions = forall a. Maybe a
Prelude.Nothing,
      $sel:recommenderId:SMSTemplateRequest' :: Maybe Text
recommenderId = forall a. Maybe a
Prelude.Nothing,
      $sel:templateDescription:SMSTemplateRequest' :: Maybe Text
templateDescription = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:SMSTemplateRequest' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The message body to use in text messages that are based on the message
-- template.
sMSTemplateRequest_body :: Lens.Lens' SMSTemplateRequest (Prelude.Maybe Prelude.Text)
sMSTemplateRequest_body :: Lens' SMSTemplateRequest (Maybe Text)
sMSTemplateRequest_body = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SMSTemplateRequest' {Maybe Text
body :: Maybe Text
$sel:body:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
body} -> Maybe Text
body) (\s :: SMSTemplateRequest
s@SMSTemplateRequest' {} Maybe Text
a -> SMSTemplateRequest
s {$sel:body:SMSTemplateRequest' :: Maybe Text
body = Maybe Text
a} :: SMSTemplateRequest)

-- | A JSON object that specifies the default values to use for message
-- variables in 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. When
-- you create a message that\'s based on the template, you can override
-- these defaults with message-specific and address-specific variables and
-- values.
sMSTemplateRequest_defaultSubstitutions :: Lens.Lens' SMSTemplateRequest (Prelude.Maybe Prelude.Text)
sMSTemplateRequest_defaultSubstitutions :: Lens' SMSTemplateRequest (Maybe Text)
sMSTemplateRequest_defaultSubstitutions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SMSTemplateRequest' {Maybe Text
defaultSubstitutions :: Maybe Text
$sel:defaultSubstitutions:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
defaultSubstitutions} -> Maybe Text
defaultSubstitutions) (\s :: SMSTemplateRequest
s@SMSTemplateRequest' {} Maybe Text
a -> SMSTemplateRequest
s {$sel:defaultSubstitutions:SMSTemplateRequest' :: Maybe Text
defaultSubstitutions = Maybe Text
a} :: SMSTemplateRequest)

-- | The unique identifier for the recommender model to use for the message
-- template. Amazon Pinpoint uses this value to determine how to retrieve
-- and process data from a recommender model when it sends messages that
-- use the template, if the template contains message variables for
-- recommendation data.
sMSTemplateRequest_recommenderId :: Lens.Lens' SMSTemplateRequest (Prelude.Maybe Prelude.Text)
sMSTemplateRequest_recommenderId :: Lens' SMSTemplateRequest (Maybe Text)
sMSTemplateRequest_recommenderId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SMSTemplateRequest' {Maybe Text
recommenderId :: Maybe Text
$sel:recommenderId:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
recommenderId} -> Maybe Text
recommenderId) (\s :: SMSTemplateRequest
s@SMSTemplateRequest' {} Maybe Text
a -> SMSTemplateRequest
s {$sel:recommenderId:SMSTemplateRequest' :: Maybe Text
recommenderId = Maybe Text
a} :: SMSTemplateRequest)

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

-- | A string-to-string map of key-value pairs that defines the tags to
-- associate with the message template. Each tag consists of a required tag
-- key and an associated tag value.
sMSTemplateRequest_tags :: Lens.Lens' SMSTemplateRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
sMSTemplateRequest_tags :: Lens' SMSTemplateRequest (Maybe (HashMap Text Text))
sMSTemplateRequest_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SMSTemplateRequest' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: SMSTemplateRequest
s@SMSTemplateRequest' {} Maybe (HashMap Text Text)
a -> SMSTemplateRequest
s {$sel:tags:SMSTemplateRequest' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: SMSTemplateRequest) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable SMSTemplateRequest where
  hashWithSalt :: Int -> SMSTemplateRequest -> Int
hashWithSalt Int
_salt SMSTemplateRequest' {Maybe Text
Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
templateDescription :: Maybe Text
recommenderId :: Maybe Text
defaultSubstitutions :: Maybe Text
body :: Maybe Text
$sel:tags:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe (HashMap Text Text)
$sel:templateDescription:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
$sel:recommenderId:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
$sel:defaultSubstitutions:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
$sel:body:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
body
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultSubstitutions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
recommenderId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
templateDescription
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags

instance Prelude.NFData SMSTemplateRequest where
  rnf :: SMSTemplateRequest -> ()
rnf SMSTemplateRequest' {Maybe Text
Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
templateDescription :: Maybe Text
recommenderId :: Maybe Text
defaultSubstitutions :: Maybe Text
body :: Maybe Text
$sel:tags:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe (HashMap Text Text)
$sel:templateDescription:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
$sel:recommenderId:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
$sel:defaultSubstitutions:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
$sel:body:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
body
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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
recommenderId
      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 (HashMap Text Text)
tags

instance Data.ToJSON SMSTemplateRequest where
  toJSON :: SMSTemplateRequest -> Value
toJSON SMSTemplateRequest' {Maybe Text
Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
templateDescription :: Maybe Text
recommenderId :: Maybe Text
defaultSubstitutions :: Maybe Text
body :: Maybe Text
$sel:tags:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe (HashMap Text Text)
$sel:templateDescription:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
$sel:recommenderId:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
$sel:defaultSubstitutions:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
$sel:body:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Body" 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
body,
            (Key
"DefaultSubstitutions" 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
defaultSubstitutions,
            (Key
"RecommenderId" 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
recommenderId,
            (Key
"TemplateDescription" 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
templateDescription,
            (Key
"tags" 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 (HashMap Text Text)
tags
          ]
      )