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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.MessageType
import qualified Amazonka.Prelude as Prelude

-- | Specifies the sender ID and message type for an SMS message that\'s sent
-- to participants in a journey.
--
-- /See:/ 'newJourneySMSMessage' smart constructor.
data JourneySMSMessage = JourneySMSMessage'
  { -- | The long code to send the SMS message from. This value should be one of
    -- the dedicated long codes that\'s assigned to your AWS account. Although
    -- it isn\'t required, we recommend that you specify the long code using an
    -- E.164 format to ensure prompt and accurate delivery of the message. For
    -- example, +12065550100.
    JourneySMSMessage -> Maybe Text
originationNumber :: Prelude.Maybe Prelude.Text,
    -- | The template ID received from the regulatory body for sending SMS in
    -- your country.
    JourneySMSMessage -> Maybe Text
templateId :: Prelude.Maybe Prelude.Text,
    -- | The SMS message type. Valid values are TRANSACTIONAL (for messages that
    -- are critical or time-sensitive, such as a one-time passwords) and
    -- PROMOTIONAL (for messsages that aren\'t critical or time-sensitive, such
    -- as marketing messages).
    JourneySMSMessage -> Maybe MessageType
messageType :: Prelude.Maybe MessageType,
    -- | The sender ID to display as the sender of the message on a recipient\'s
    -- device. Support for sender IDs varies by country or region. For more
    -- information, see
    -- <https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms-countries.html Supported Countries and Regions>
    -- in the Amazon Pinpoint User Guide.
    JourneySMSMessage -> Maybe Text
senderId :: Prelude.Maybe Prelude.Text,
    -- | The entity ID or Principal Entity (PE) id received from the regulatory
    -- body for sending SMS in your country.
    JourneySMSMessage -> Maybe Text
entityId :: Prelude.Maybe Prelude.Text
  }
  deriving (JourneySMSMessage -> JourneySMSMessage -> Bool
(JourneySMSMessage -> JourneySMSMessage -> Bool)
-> (JourneySMSMessage -> JourneySMSMessage -> Bool)
-> Eq JourneySMSMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JourneySMSMessage -> JourneySMSMessage -> Bool
$c/= :: JourneySMSMessage -> JourneySMSMessage -> Bool
== :: JourneySMSMessage -> JourneySMSMessage -> Bool
$c== :: JourneySMSMessage -> JourneySMSMessage -> Bool
Prelude.Eq, ReadPrec [JourneySMSMessage]
ReadPrec JourneySMSMessage
Int -> ReadS JourneySMSMessage
ReadS [JourneySMSMessage]
(Int -> ReadS JourneySMSMessage)
-> ReadS [JourneySMSMessage]
-> ReadPrec JourneySMSMessage
-> ReadPrec [JourneySMSMessage]
-> Read JourneySMSMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JourneySMSMessage]
$creadListPrec :: ReadPrec [JourneySMSMessage]
readPrec :: ReadPrec JourneySMSMessage
$creadPrec :: ReadPrec JourneySMSMessage
readList :: ReadS [JourneySMSMessage]
$creadList :: ReadS [JourneySMSMessage]
readsPrec :: Int -> ReadS JourneySMSMessage
$creadsPrec :: Int -> ReadS JourneySMSMessage
Prelude.Read, Int -> JourneySMSMessage -> ShowS
[JourneySMSMessage] -> ShowS
JourneySMSMessage -> String
(Int -> JourneySMSMessage -> ShowS)
-> (JourneySMSMessage -> String)
-> ([JourneySMSMessage] -> ShowS)
-> Show JourneySMSMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JourneySMSMessage] -> ShowS
$cshowList :: [JourneySMSMessage] -> ShowS
show :: JourneySMSMessage -> String
$cshow :: JourneySMSMessage -> String
showsPrec :: Int -> JourneySMSMessage -> ShowS
$cshowsPrec :: Int -> JourneySMSMessage -> ShowS
Prelude.Show, (forall x. JourneySMSMessage -> Rep JourneySMSMessage x)
-> (forall x. Rep JourneySMSMessage x -> JourneySMSMessage)
-> Generic JourneySMSMessage
forall x. Rep JourneySMSMessage x -> JourneySMSMessage
forall x. JourneySMSMessage -> Rep JourneySMSMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JourneySMSMessage x -> JourneySMSMessage
$cfrom :: forall x. JourneySMSMessage -> Rep JourneySMSMessage x
Prelude.Generic)

-- |
-- Create a value of 'JourneySMSMessage' 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:
--
-- 'originationNumber', 'journeySMSMessage_originationNumber' - The long code to send the SMS message from. This value should be one of
-- the dedicated long codes that\'s assigned to your AWS account. Although
-- it isn\'t required, we recommend that you specify the long code using an
-- E.164 format to ensure prompt and accurate delivery of the message. For
-- example, +12065550100.
--
-- 'templateId', 'journeySMSMessage_templateId' - The template ID received from the regulatory body for sending SMS in
-- your country.
--
-- 'messageType', 'journeySMSMessage_messageType' - The SMS message type. Valid values are TRANSACTIONAL (for messages that
-- are critical or time-sensitive, such as a one-time passwords) and
-- PROMOTIONAL (for messsages that aren\'t critical or time-sensitive, such
-- as marketing messages).
--
-- 'senderId', 'journeySMSMessage_senderId' - The sender ID to display as the sender of the message on a recipient\'s
-- device. Support for sender IDs varies by country or region. For more
-- information, see
-- <https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms-countries.html Supported Countries and Regions>
-- in the Amazon Pinpoint User Guide.
--
-- 'entityId', 'journeySMSMessage_entityId' - The entity ID or Principal Entity (PE) id received from the regulatory
-- body for sending SMS in your country.
newJourneySMSMessage ::
  JourneySMSMessage
newJourneySMSMessage :: JourneySMSMessage
newJourneySMSMessage =
  JourneySMSMessage' :: Maybe Text
-> Maybe Text
-> Maybe MessageType
-> Maybe Text
-> Maybe Text
-> JourneySMSMessage
JourneySMSMessage'
    { $sel:originationNumber:JourneySMSMessage' :: Maybe Text
originationNumber =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:templateId:JourneySMSMessage' :: Maybe Text
templateId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:messageType:JourneySMSMessage' :: Maybe MessageType
messageType = Maybe MessageType
forall a. Maybe a
Prelude.Nothing,
      $sel:senderId:JourneySMSMessage' :: Maybe Text
senderId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:entityId:JourneySMSMessage' :: Maybe Text
entityId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The long code to send the SMS message from. This value should be one of
-- the dedicated long codes that\'s assigned to your AWS account. Although
-- it isn\'t required, we recommend that you specify the long code using an
-- E.164 format to ensure prompt and accurate delivery of the message. For
-- example, +12065550100.
journeySMSMessage_originationNumber :: Lens.Lens' JourneySMSMessage (Prelude.Maybe Prelude.Text)
journeySMSMessage_originationNumber :: (Maybe Text -> f (Maybe Text))
-> JourneySMSMessage -> f JourneySMSMessage
journeySMSMessage_originationNumber = (JourneySMSMessage -> Maybe Text)
-> (JourneySMSMessage -> Maybe Text -> JourneySMSMessage)
-> Lens
     JourneySMSMessage JourneySMSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneySMSMessage' {Maybe Text
originationNumber :: Maybe Text
$sel:originationNumber:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
originationNumber} -> Maybe Text
originationNumber) (\s :: JourneySMSMessage
s@JourneySMSMessage' {} Maybe Text
a -> JourneySMSMessage
s {$sel:originationNumber:JourneySMSMessage' :: Maybe Text
originationNumber = Maybe Text
a} :: JourneySMSMessage)

-- | The template ID received from the regulatory body for sending SMS in
-- your country.
journeySMSMessage_templateId :: Lens.Lens' JourneySMSMessage (Prelude.Maybe Prelude.Text)
journeySMSMessage_templateId :: (Maybe Text -> f (Maybe Text))
-> JourneySMSMessage -> f JourneySMSMessage
journeySMSMessage_templateId = (JourneySMSMessage -> Maybe Text)
-> (JourneySMSMessage -> Maybe Text -> JourneySMSMessage)
-> Lens
     JourneySMSMessage JourneySMSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneySMSMessage' {Maybe Text
templateId :: Maybe Text
$sel:templateId:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
templateId} -> Maybe Text
templateId) (\s :: JourneySMSMessage
s@JourneySMSMessage' {} Maybe Text
a -> JourneySMSMessage
s {$sel:templateId:JourneySMSMessage' :: Maybe Text
templateId = Maybe Text
a} :: JourneySMSMessage)

-- | The SMS message type. Valid values are TRANSACTIONAL (for messages that
-- are critical or time-sensitive, such as a one-time passwords) and
-- PROMOTIONAL (for messsages that aren\'t critical or time-sensitive, such
-- as marketing messages).
journeySMSMessage_messageType :: Lens.Lens' JourneySMSMessage (Prelude.Maybe MessageType)
journeySMSMessage_messageType :: (Maybe MessageType -> f (Maybe MessageType))
-> JourneySMSMessage -> f JourneySMSMessage
journeySMSMessage_messageType = (JourneySMSMessage -> Maybe MessageType)
-> (JourneySMSMessage -> Maybe MessageType -> JourneySMSMessage)
-> Lens
     JourneySMSMessage
     JourneySMSMessage
     (Maybe MessageType)
     (Maybe MessageType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneySMSMessage' {Maybe MessageType
messageType :: Maybe MessageType
$sel:messageType:JourneySMSMessage' :: JourneySMSMessage -> Maybe MessageType
messageType} -> Maybe MessageType
messageType) (\s :: JourneySMSMessage
s@JourneySMSMessage' {} Maybe MessageType
a -> JourneySMSMessage
s {$sel:messageType:JourneySMSMessage' :: Maybe MessageType
messageType = Maybe MessageType
a} :: JourneySMSMessage)

-- | The sender ID to display as the sender of the message on a recipient\'s
-- device. Support for sender IDs varies by country or region. For more
-- information, see
-- <https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms-countries.html Supported Countries and Regions>
-- in the Amazon Pinpoint User Guide.
journeySMSMessage_senderId :: Lens.Lens' JourneySMSMessage (Prelude.Maybe Prelude.Text)
journeySMSMessage_senderId :: (Maybe Text -> f (Maybe Text))
-> JourneySMSMessage -> f JourneySMSMessage
journeySMSMessage_senderId = (JourneySMSMessage -> Maybe Text)
-> (JourneySMSMessage -> Maybe Text -> JourneySMSMessage)
-> Lens
     JourneySMSMessage JourneySMSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneySMSMessage' {Maybe Text
senderId :: Maybe Text
$sel:senderId:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
senderId} -> Maybe Text
senderId) (\s :: JourneySMSMessage
s@JourneySMSMessage' {} Maybe Text
a -> JourneySMSMessage
s {$sel:senderId:JourneySMSMessage' :: Maybe Text
senderId = Maybe Text
a} :: JourneySMSMessage)

-- | The entity ID or Principal Entity (PE) id received from the regulatory
-- body for sending SMS in your country.
journeySMSMessage_entityId :: Lens.Lens' JourneySMSMessage (Prelude.Maybe Prelude.Text)
journeySMSMessage_entityId :: (Maybe Text -> f (Maybe Text))
-> JourneySMSMessage -> f JourneySMSMessage
journeySMSMessage_entityId = (JourneySMSMessage -> Maybe Text)
-> (JourneySMSMessage -> Maybe Text -> JourneySMSMessage)
-> Lens
     JourneySMSMessage JourneySMSMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JourneySMSMessage' {Maybe Text
entityId :: Maybe Text
$sel:entityId:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
entityId} -> Maybe Text
entityId) (\s :: JourneySMSMessage
s@JourneySMSMessage' {} Maybe Text
a -> JourneySMSMessage
s {$sel:entityId:JourneySMSMessage' :: Maybe Text
entityId = Maybe Text
a} :: JourneySMSMessage)

instance Core.FromJSON JourneySMSMessage where
  parseJSON :: Value -> Parser JourneySMSMessage
parseJSON =
    String
-> (Object -> Parser JourneySMSMessage)
-> Value
-> Parser JourneySMSMessage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JourneySMSMessage"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe MessageType
-> Maybe Text
-> Maybe Text
-> JourneySMSMessage
JourneySMSMessage'
            (Maybe Text
 -> Maybe Text
 -> Maybe MessageType
 -> Maybe Text
 -> Maybe Text
 -> JourneySMSMessage)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe MessageType
      -> Maybe Text
      -> Maybe Text
      -> JourneySMSMessage)
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
"OriginationNumber")
            Parser
  (Maybe Text
   -> Maybe MessageType
   -> Maybe Text
   -> Maybe Text
   -> JourneySMSMessage)
-> Parser (Maybe Text)
-> Parser
     (Maybe MessageType
      -> Maybe Text -> Maybe Text -> JourneySMSMessage)
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
"TemplateId")
            Parser
  (Maybe MessageType
   -> Maybe Text -> Maybe Text -> JourneySMSMessage)
-> Parser (Maybe MessageType)
-> Parser (Maybe Text -> Maybe Text -> JourneySMSMessage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MessageType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MessageType")
            Parser (Maybe Text -> Maybe Text -> JourneySMSMessage)
-> Parser (Maybe Text) -> Parser (Maybe Text -> JourneySMSMessage)
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
"SenderId")
            Parser (Maybe Text -> JourneySMSMessage)
-> Parser (Maybe Text) -> Parser JourneySMSMessage
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
"EntityId")
      )

instance Prelude.Hashable JourneySMSMessage

instance Prelude.NFData JourneySMSMessage

instance Core.ToJSON JourneySMSMessage where
  toJSON :: JourneySMSMessage -> Value
toJSON JourneySMSMessage' {Maybe Text
Maybe MessageType
entityId :: Maybe Text
senderId :: Maybe Text
messageType :: Maybe MessageType
templateId :: Maybe Text
originationNumber :: Maybe Text
$sel:entityId:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
$sel:senderId:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
$sel:messageType:JourneySMSMessage' :: JourneySMSMessage -> Maybe MessageType
$sel:templateId:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
$sel:originationNumber:JourneySMSMessage' :: JourneySMSMessage -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"OriginationNumber" 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
originationNumber,
            (Text
"TemplateId" 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
templateId,
            (Text
"MessageType" Text -> MessageType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MessageType -> Pair) -> Maybe MessageType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MessageType
messageType,
            (Text
"SenderId" 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
senderId,
            (Text
"EntityId" 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
entityId
          ]
      )