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

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

-- | Specifies the settings for a one-time voice message that\'s sent
-- directly to an endpoint through the voice channel.
--
-- /See:/ 'newVoiceMessage' smart constructor.
data VoiceMessage = VoiceMessage'
  { -- | The default message variables to use in the voice message. You can
    -- override the default variables with individual address variables.
    VoiceMessage -> Maybe (HashMap Text [Text])
substitutions :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
    -- | The code for the language to use when synthesizing the text of the
    -- message script. For a list of supported languages and the code for each
    -- one, see the
    -- <https://docs.aws.amazon.com/polly/latest/dg/what-is.html Amazon Polly Developer Guide>.
    VoiceMessage -> Maybe Text
languageCode :: Prelude.Maybe Prelude.Text,
    -- | The long code to send the voice 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
    -- in E.164 format, for example +12065550100, to ensure prompt and accurate
    -- delivery of the message.
    VoiceMessage -> Maybe Text
originationNumber :: Prelude.Maybe Prelude.Text,
    -- | The text of the script to use for the voice message.
    VoiceMessage -> Maybe Text
body :: Prelude.Maybe Prelude.Text,
    -- | The name of the voice to use when delivering the message. For a list of
    -- supported voices, see the
    -- <https://docs.aws.amazon.com/polly/latest/dg/what-is.html Amazon Polly Developer Guide>.
    VoiceMessage -> Maybe Text
voiceId :: Prelude.Maybe Prelude.Text
  }
  deriving (VoiceMessage -> VoiceMessage -> Bool
(VoiceMessage -> VoiceMessage -> Bool)
-> (VoiceMessage -> VoiceMessage -> Bool) -> Eq VoiceMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VoiceMessage -> VoiceMessage -> Bool
$c/= :: VoiceMessage -> VoiceMessage -> Bool
== :: VoiceMessage -> VoiceMessage -> Bool
$c== :: VoiceMessage -> VoiceMessage -> Bool
Prelude.Eq, ReadPrec [VoiceMessage]
ReadPrec VoiceMessage
Int -> ReadS VoiceMessage
ReadS [VoiceMessage]
(Int -> ReadS VoiceMessage)
-> ReadS [VoiceMessage]
-> ReadPrec VoiceMessage
-> ReadPrec [VoiceMessage]
-> Read VoiceMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VoiceMessage]
$creadListPrec :: ReadPrec [VoiceMessage]
readPrec :: ReadPrec VoiceMessage
$creadPrec :: ReadPrec VoiceMessage
readList :: ReadS [VoiceMessage]
$creadList :: ReadS [VoiceMessage]
readsPrec :: Int -> ReadS VoiceMessage
$creadsPrec :: Int -> ReadS VoiceMessage
Prelude.Read, Int -> VoiceMessage -> ShowS
[VoiceMessage] -> ShowS
VoiceMessage -> String
(Int -> VoiceMessage -> ShowS)
-> (VoiceMessage -> String)
-> ([VoiceMessage] -> ShowS)
-> Show VoiceMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VoiceMessage] -> ShowS
$cshowList :: [VoiceMessage] -> ShowS
show :: VoiceMessage -> String
$cshow :: VoiceMessage -> String
showsPrec :: Int -> VoiceMessage -> ShowS
$cshowsPrec :: Int -> VoiceMessage -> ShowS
Prelude.Show, (forall x. VoiceMessage -> Rep VoiceMessage x)
-> (forall x. Rep VoiceMessage x -> VoiceMessage)
-> Generic VoiceMessage
forall x. Rep VoiceMessage x -> VoiceMessage
forall x. VoiceMessage -> Rep VoiceMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VoiceMessage x -> VoiceMessage
$cfrom :: forall x. VoiceMessage -> Rep VoiceMessage x
Prelude.Generic)

-- |
-- Create a value of 'VoiceMessage' 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:
--
-- 'substitutions', 'voiceMessage_substitutions' - The default message variables to use in the voice message. You can
-- override the default variables with individual address variables.
--
-- 'languageCode', 'voiceMessage_languageCode' - The code for the language to use when synthesizing the text of the
-- message script. For a list of supported languages and the code for each
-- one, see the
-- <https://docs.aws.amazon.com/polly/latest/dg/what-is.html Amazon Polly Developer Guide>.
--
-- 'originationNumber', 'voiceMessage_originationNumber' - The long code to send the voice 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
-- in E.164 format, for example +12065550100, to ensure prompt and accurate
-- delivery of the message.
--
-- 'body', 'voiceMessage_body' - The text of the script to use for the voice message.
--
-- 'voiceId', 'voiceMessage_voiceId' - The name of the voice to use when delivering the message. For a list of
-- supported voices, see the
-- <https://docs.aws.amazon.com/polly/latest/dg/what-is.html Amazon Polly Developer Guide>.
newVoiceMessage ::
  VoiceMessage
newVoiceMessage :: VoiceMessage
newVoiceMessage =
  VoiceMessage' :: Maybe (HashMap Text [Text])
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> VoiceMessage
VoiceMessage'
    { $sel:substitutions:VoiceMessage' :: Maybe (HashMap Text [Text])
substitutions = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
      $sel:languageCode:VoiceMessage' :: Maybe Text
languageCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:originationNumber:VoiceMessage' :: Maybe Text
originationNumber = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:body:VoiceMessage' :: Maybe Text
body = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:voiceId:VoiceMessage' :: Maybe Text
voiceId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The default message variables to use in the voice message. You can
-- override the default variables with individual address variables.
voiceMessage_substitutions :: Lens.Lens' VoiceMessage (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
voiceMessage_substitutions :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> VoiceMessage -> f VoiceMessage
voiceMessage_substitutions = (VoiceMessage -> Maybe (HashMap Text [Text]))
-> (VoiceMessage -> Maybe (HashMap Text [Text]) -> VoiceMessage)
-> Lens
     VoiceMessage
     VoiceMessage
     (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 (\VoiceMessage' {Maybe (HashMap Text [Text])
substitutions :: Maybe (HashMap Text [Text])
$sel:substitutions:VoiceMessage' :: VoiceMessage -> Maybe (HashMap Text [Text])
substitutions} -> Maybe (HashMap Text [Text])
substitutions) (\s :: VoiceMessage
s@VoiceMessage' {} Maybe (HashMap Text [Text])
a -> VoiceMessage
s {$sel:substitutions:VoiceMessage' :: Maybe (HashMap Text [Text])
substitutions = Maybe (HashMap Text [Text])
a} :: VoiceMessage) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
 -> VoiceMessage -> f VoiceMessage)
-> ((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])))
-> VoiceMessage
-> f VoiceMessage
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

-- | The code for the language to use when synthesizing the text of the
-- message script. For a list of supported languages and the code for each
-- one, see the
-- <https://docs.aws.amazon.com/polly/latest/dg/what-is.html Amazon Polly Developer Guide>.
voiceMessage_languageCode :: Lens.Lens' VoiceMessage (Prelude.Maybe Prelude.Text)
voiceMessage_languageCode :: (Maybe Text -> f (Maybe Text)) -> VoiceMessage -> f VoiceMessage
voiceMessage_languageCode = (VoiceMessage -> Maybe Text)
-> (VoiceMessage -> Maybe Text -> VoiceMessage)
-> Lens VoiceMessage VoiceMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VoiceMessage' {Maybe Text
languageCode :: Maybe Text
$sel:languageCode:VoiceMessage' :: VoiceMessage -> Maybe Text
languageCode} -> Maybe Text
languageCode) (\s :: VoiceMessage
s@VoiceMessage' {} Maybe Text
a -> VoiceMessage
s {$sel:languageCode:VoiceMessage' :: Maybe Text
languageCode = Maybe Text
a} :: VoiceMessage)

-- | The long code to send the voice 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
-- in E.164 format, for example +12065550100, to ensure prompt and accurate
-- delivery of the message.
voiceMessage_originationNumber :: Lens.Lens' VoiceMessage (Prelude.Maybe Prelude.Text)
voiceMessage_originationNumber :: (Maybe Text -> f (Maybe Text)) -> VoiceMessage -> f VoiceMessage
voiceMessage_originationNumber = (VoiceMessage -> Maybe Text)
-> (VoiceMessage -> Maybe Text -> VoiceMessage)
-> Lens VoiceMessage VoiceMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VoiceMessage' {Maybe Text
originationNumber :: Maybe Text
$sel:originationNumber:VoiceMessage' :: VoiceMessage -> Maybe Text
originationNumber} -> Maybe Text
originationNumber) (\s :: VoiceMessage
s@VoiceMessage' {} Maybe Text
a -> VoiceMessage
s {$sel:originationNumber:VoiceMessage' :: Maybe Text
originationNumber = Maybe Text
a} :: VoiceMessage)

-- | The text of the script to use for the voice message.
voiceMessage_body :: Lens.Lens' VoiceMessage (Prelude.Maybe Prelude.Text)
voiceMessage_body :: (Maybe Text -> f (Maybe Text)) -> VoiceMessage -> f VoiceMessage
voiceMessage_body = (VoiceMessage -> Maybe Text)
-> (VoiceMessage -> Maybe Text -> VoiceMessage)
-> Lens VoiceMessage VoiceMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VoiceMessage' {Maybe Text
body :: Maybe Text
$sel:body:VoiceMessage' :: VoiceMessage -> Maybe Text
body} -> Maybe Text
body) (\s :: VoiceMessage
s@VoiceMessage' {} Maybe Text
a -> VoiceMessage
s {$sel:body:VoiceMessage' :: Maybe Text
body = Maybe Text
a} :: VoiceMessage)

-- | The name of the voice to use when delivering the message. For a list of
-- supported voices, see the
-- <https://docs.aws.amazon.com/polly/latest/dg/what-is.html Amazon Polly Developer Guide>.
voiceMessage_voiceId :: Lens.Lens' VoiceMessage (Prelude.Maybe Prelude.Text)
voiceMessage_voiceId :: (Maybe Text -> f (Maybe Text)) -> VoiceMessage -> f VoiceMessage
voiceMessage_voiceId = (VoiceMessage -> Maybe Text)
-> (VoiceMessage -> Maybe Text -> VoiceMessage)
-> Lens VoiceMessage VoiceMessage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VoiceMessage' {Maybe Text
voiceId :: Maybe Text
$sel:voiceId:VoiceMessage' :: VoiceMessage -> Maybe Text
voiceId} -> Maybe Text
voiceId) (\s :: VoiceMessage
s@VoiceMessage' {} Maybe Text
a -> VoiceMessage
s {$sel:voiceId:VoiceMessage' :: Maybe Text
voiceId = Maybe Text
a} :: VoiceMessage)

instance Prelude.Hashable VoiceMessage

instance Prelude.NFData VoiceMessage

instance Core.ToJSON VoiceMessage where
  toJSON :: VoiceMessage -> Value
toJSON VoiceMessage' {Maybe Text
Maybe (HashMap Text [Text])
voiceId :: Maybe Text
body :: Maybe Text
originationNumber :: Maybe Text
languageCode :: Maybe Text
substitutions :: Maybe (HashMap Text [Text])
$sel:voiceId:VoiceMessage' :: VoiceMessage -> Maybe Text
$sel:body:VoiceMessage' :: VoiceMessage -> Maybe Text
$sel:originationNumber:VoiceMessage' :: VoiceMessage -> Maybe Text
$sel:languageCode:VoiceMessage' :: VoiceMessage -> Maybe Text
$sel:substitutions:VoiceMessage' :: VoiceMessage -> Maybe (HashMap Text [Text])
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Substitutions" 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])
substitutions,
            (Text
"LanguageCode" 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
languageCode,
            (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
"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
"VoiceId" 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
voiceId
          ]
      )