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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 custom description of the message template.
    SMSTemplateRequest -> Maybe Text
templateDescription :: 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 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
(SMSTemplateRequest -> SMSTemplateRequest -> Bool)
-> (SMSTemplateRequest -> SMSTemplateRequest -> Bool)
-> Eq SMSTemplateRequest
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]
(Int -> ReadS SMSTemplateRequest)
-> ReadS [SMSTemplateRequest]
-> ReadPrec SMSTemplateRequest
-> ReadPrec [SMSTemplateRequest]
-> Read 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
(Int -> SMSTemplateRequest -> ShowS)
-> (SMSTemplateRequest -> String)
-> ([SMSTemplateRequest] -> ShowS)
-> Show SMSTemplateRequest
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. SMSTemplateRequest -> Rep SMSTemplateRequest x)
-> (forall x. Rep SMSTemplateRequest x -> SMSTemplateRequest)
-> Generic SMSTemplateRequest
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.
--
-- 'templateDescription', 'sMSTemplateRequest_templateDescription' - A custom description of 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.
--
-- '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' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> SMSTemplateRequest
SMSTemplateRequest'
    { $sel:body:SMSTemplateRequest' :: Maybe Text
body = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:templateDescription:SMSTemplateRequest' :: Maybe Text
templateDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultSubstitutions:SMSTemplateRequest' :: Maybe Text
defaultSubstitutions = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recommenderId:SMSTemplateRequest' :: Maybe Text
recommenderId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:SMSTemplateRequest' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
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 :: (Maybe Text -> f (Maybe Text))
-> SMSTemplateRequest -> f SMSTemplateRequest
sMSTemplateRequest_body = (SMSTemplateRequest -> Maybe Text)
-> (SMSTemplateRequest -> Maybe Text -> SMSTemplateRequest)
-> Lens
     SMSTemplateRequest SMSTemplateRequest (Maybe Text) (Maybe Text)
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 custom description of the message template.
sMSTemplateRequest_templateDescription :: Lens.Lens' SMSTemplateRequest (Prelude.Maybe Prelude.Text)
sMSTemplateRequest_templateDescription :: (Maybe Text -> f (Maybe Text))
-> SMSTemplateRequest -> f SMSTemplateRequest
sMSTemplateRequest_templateDescription = (SMSTemplateRequest -> Maybe Text)
-> (SMSTemplateRequest -> Maybe Text -> SMSTemplateRequest)
-> Lens
     SMSTemplateRequest SMSTemplateRequest (Maybe Text) (Maybe Text)
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 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 :: (Maybe Text -> f (Maybe Text))
-> SMSTemplateRequest -> f SMSTemplateRequest
sMSTemplateRequest_defaultSubstitutions = (SMSTemplateRequest -> Maybe Text)
-> (SMSTemplateRequest -> Maybe Text -> SMSTemplateRequest)
-> Lens
     SMSTemplateRequest SMSTemplateRequest (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> SMSTemplateRequest -> f SMSTemplateRequest
sMSTemplateRequest_recommenderId = (SMSTemplateRequest -> Maybe Text)
-> (SMSTemplateRequest -> Maybe Text -> SMSTemplateRequest)
-> Lens
     SMSTemplateRequest SMSTemplateRequest (Maybe Text) (Maybe Text)
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 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 :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> SMSTemplateRequest -> f SMSTemplateRequest
sMSTemplateRequest_tags = (SMSTemplateRequest -> Maybe (HashMap Text Text))
-> (SMSTemplateRequest
    -> Maybe (HashMap Text Text) -> SMSTemplateRequest)
-> Lens
     SMSTemplateRequest
     SMSTemplateRequest
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> SMSTemplateRequest -> f SMSTemplateRequest)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> SMSTemplateRequest
-> f SMSTemplateRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable SMSTemplateRequest

instance Prelude.NFData SMSTemplateRequest

instance Core.ToJSON SMSTemplateRequest where
  toJSON :: SMSTemplateRequest -> Value
toJSON SMSTemplateRequest' {Maybe Text
Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
recommenderId :: Maybe Text
defaultSubstitutions :: Maybe Text
templateDescription :: Maybe Text
body :: Maybe Text
$sel:tags:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe (HashMap Text Text)
$sel:recommenderId:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
$sel:defaultSubstitutions:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
$sel:templateDescription:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
$sel:body:SMSTemplateRequest' :: SMSTemplateRequest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Body" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
body,
            (Text
"TemplateDescription" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
templateDescription,
            (Text
"DefaultSubstitutions" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
defaultSubstitutions,
            (Text
"RecommenderId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
recommenderId,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags
          ]
      )