{-# 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.VoiceTemplateRequest
-- 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.VoiceTemplateRequest 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 messages that are sent through the voice channel.
--
-- /See:/ 'newVoiceTemplateRequest' smart constructor.
data VoiceTemplateRequest = VoiceTemplateRequest'
  { -- | The code for the language to use when synthesizing the text of the
    -- script in messages that are based on the message template. 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>.
    VoiceTemplateRequest -> Maybe Text
languageCode :: Prelude.Maybe Prelude.Text,
    -- | The text of the script to use in messages that are based on the message
    -- template, in plain text format.
    VoiceTemplateRequest -> Maybe Text
body :: Prelude.Maybe Prelude.Text,
    -- | A custom description of the message template.
    VoiceTemplateRequest -> 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.
    VoiceTemplateRequest -> Maybe Text
defaultSubstitutions :: Prelude.Maybe Prelude.Text,
    -- | The name of the voice to use when delivering messages that are based on
    -- the message template. For a list of supported voices, see the
    -- <https://docs.aws.amazon.com/polly/latest/dg/what-is.html Amazon Polly Developer Guide>.
    VoiceTemplateRequest -> Maybe Text
voiceId :: 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.
    VoiceTemplateRequest -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (VoiceTemplateRequest -> VoiceTemplateRequest -> Bool
(VoiceTemplateRequest -> VoiceTemplateRequest -> Bool)
-> (VoiceTemplateRequest -> VoiceTemplateRequest -> Bool)
-> Eq VoiceTemplateRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VoiceTemplateRequest -> VoiceTemplateRequest -> Bool
$c/= :: VoiceTemplateRequest -> VoiceTemplateRequest -> Bool
== :: VoiceTemplateRequest -> VoiceTemplateRequest -> Bool
$c== :: VoiceTemplateRequest -> VoiceTemplateRequest -> Bool
Prelude.Eq, ReadPrec [VoiceTemplateRequest]
ReadPrec VoiceTemplateRequest
Int -> ReadS VoiceTemplateRequest
ReadS [VoiceTemplateRequest]
(Int -> ReadS VoiceTemplateRequest)
-> ReadS [VoiceTemplateRequest]
-> ReadPrec VoiceTemplateRequest
-> ReadPrec [VoiceTemplateRequest]
-> Read VoiceTemplateRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VoiceTemplateRequest]
$creadListPrec :: ReadPrec [VoiceTemplateRequest]
readPrec :: ReadPrec VoiceTemplateRequest
$creadPrec :: ReadPrec VoiceTemplateRequest
readList :: ReadS [VoiceTemplateRequest]
$creadList :: ReadS [VoiceTemplateRequest]
readsPrec :: Int -> ReadS VoiceTemplateRequest
$creadsPrec :: Int -> ReadS VoiceTemplateRequest
Prelude.Read, Int -> VoiceTemplateRequest -> ShowS
[VoiceTemplateRequest] -> ShowS
VoiceTemplateRequest -> String
(Int -> VoiceTemplateRequest -> ShowS)
-> (VoiceTemplateRequest -> String)
-> ([VoiceTemplateRequest] -> ShowS)
-> Show VoiceTemplateRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VoiceTemplateRequest] -> ShowS
$cshowList :: [VoiceTemplateRequest] -> ShowS
show :: VoiceTemplateRequest -> String
$cshow :: VoiceTemplateRequest -> String
showsPrec :: Int -> VoiceTemplateRequest -> ShowS
$cshowsPrec :: Int -> VoiceTemplateRequest -> ShowS
Prelude.Show, (forall x. VoiceTemplateRequest -> Rep VoiceTemplateRequest x)
-> (forall x. Rep VoiceTemplateRequest x -> VoiceTemplateRequest)
-> Generic VoiceTemplateRequest
forall x. Rep VoiceTemplateRequest x -> VoiceTemplateRequest
forall x. VoiceTemplateRequest -> Rep VoiceTemplateRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VoiceTemplateRequest x -> VoiceTemplateRequest
$cfrom :: forall x. VoiceTemplateRequest -> Rep VoiceTemplateRequest x
Prelude.Generic)

-- |
-- Create a value of 'VoiceTemplateRequest' 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:
--
-- 'languageCode', 'voiceTemplateRequest_languageCode' - The code for the language to use when synthesizing the text of the
-- script in messages that are based on the message template. 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>.
--
-- 'body', 'voiceTemplateRequest_body' - The text of the script to use in messages that are based on the message
-- template, in plain text format.
--
-- 'templateDescription', 'voiceTemplateRequest_templateDescription' - A custom description of the message template.
--
-- 'defaultSubstitutions', 'voiceTemplateRequest_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.
--
-- 'voiceId', 'voiceTemplateRequest_voiceId' - The name of the voice to use when delivering messages that are based on
-- the message template. For a list of supported voices, see the
-- <https://docs.aws.amazon.com/polly/latest/dg/what-is.html Amazon Polly Developer Guide>.
--
-- 'tags', 'voiceTemplateRequest_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.
newVoiceTemplateRequest ::
  VoiceTemplateRequest
newVoiceTemplateRequest :: VoiceTemplateRequest
newVoiceTemplateRequest =
  VoiceTemplateRequest' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> VoiceTemplateRequest
VoiceTemplateRequest'
    { $sel:languageCode:VoiceTemplateRequest' :: Maybe Text
languageCode =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:body:VoiceTemplateRequest' :: Maybe Text
body = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:templateDescription:VoiceTemplateRequest' :: Maybe Text
templateDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultSubstitutions:VoiceTemplateRequest' :: Maybe Text
defaultSubstitutions = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:voiceId:VoiceTemplateRequest' :: Maybe Text
voiceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:VoiceTemplateRequest' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The code for the language to use when synthesizing the text of the
-- script in messages that are based on the message template. 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>.
voiceTemplateRequest_languageCode :: Lens.Lens' VoiceTemplateRequest (Prelude.Maybe Prelude.Text)
voiceTemplateRequest_languageCode :: (Maybe Text -> f (Maybe Text))
-> VoiceTemplateRequest -> f VoiceTemplateRequest
voiceTemplateRequest_languageCode = (VoiceTemplateRequest -> Maybe Text)
-> (VoiceTemplateRequest -> Maybe Text -> VoiceTemplateRequest)
-> Lens
     VoiceTemplateRequest VoiceTemplateRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VoiceTemplateRequest' {Maybe Text
languageCode :: Maybe Text
$sel:languageCode:VoiceTemplateRequest' :: VoiceTemplateRequest -> Maybe Text
languageCode} -> Maybe Text
languageCode) (\s :: VoiceTemplateRequest
s@VoiceTemplateRequest' {} Maybe Text
a -> VoiceTemplateRequest
s {$sel:languageCode:VoiceTemplateRequest' :: Maybe Text
languageCode = Maybe Text
a} :: VoiceTemplateRequest)

-- | The text of the script to use in messages that are based on the message
-- template, in plain text format.
voiceTemplateRequest_body :: Lens.Lens' VoiceTemplateRequest (Prelude.Maybe Prelude.Text)
voiceTemplateRequest_body :: (Maybe Text -> f (Maybe Text))
-> VoiceTemplateRequest -> f VoiceTemplateRequest
voiceTemplateRequest_body = (VoiceTemplateRequest -> Maybe Text)
-> (VoiceTemplateRequest -> Maybe Text -> VoiceTemplateRequest)
-> Lens
     VoiceTemplateRequest VoiceTemplateRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VoiceTemplateRequest' {Maybe Text
body :: Maybe Text
$sel:body:VoiceTemplateRequest' :: VoiceTemplateRequest -> Maybe Text
body} -> Maybe Text
body) (\s :: VoiceTemplateRequest
s@VoiceTemplateRequest' {} Maybe Text
a -> VoiceTemplateRequest
s {$sel:body:VoiceTemplateRequest' :: Maybe Text
body = Maybe Text
a} :: VoiceTemplateRequest)

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

-- | 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.
voiceTemplateRequest_defaultSubstitutions :: Lens.Lens' VoiceTemplateRequest (Prelude.Maybe Prelude.Text)
voiceTemplateRequest_defaultSubstitutions :: (Maybe Text -> f (Maybe Text))
-> VoiceTemplateRequest -> f VoiceTemplateRequest
voiceTemplateRequest_defaultSubstitutions = (VoiceTemplateRequest -> Maybe Text)
-> (VoiceTemplateRequest -> Maybe Text -> VoiceTemplateRequest)
-> Lens
     VoiceTemplateRequest VoiceTemplateRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VoiceTemplateRequest' {Maybe Text
defaultSubstitutions :: Maybe Text
$sel:defaultSubstitutions:VoiceTemplateRequest' :: VoiceTemplateRequest -> Maybe Text
defaultSubstitutions} -> Maybe Text
defaultSubstitutions) (\s :: VoiceTemplateRequest
s@VoiceTemplateRequest' {} Maybe Text
a -> VoiceTemplateRequest
s {$sel:defaultSubstitutions:VoiceTemplateRequest' :: Maybe Text
defaultSubstitutions = Maybe Text
a} :: VoiceTemplateRequest)

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

-- | 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.
voiceTemplateRequest_tags :: Lens.Lens' VoiceTemplateRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
voiceTemplateRequest_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> VoiceTemplateRequest -> f VoiceTemplateRequest
voiceTemplateRequest_tags = (VoiceTemplateRequest -> Maybe (HashMap Text Text))
-> (VoiceTemplateRequest
    -> Maybe (HashMap Text Text) -> VoiceTemplateRequest)
-> Lens
     VoiceTemplateRequest
     VoiceTemplateRequest
     (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 (\VoiceTemplateRequest' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:VoiceTemplateRequest' :: VoiceTemplateRequest -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: VoiceTemplateRequest
s@VoiceTemplateRequest' {} Maybe (HashMap Text Text)
a -> VoiceTemplateRequest
s {$sel:tags:VoiceTemplateRequest' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: VoiceTemplateRequest) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> VoiceTemplateRequest -> f VoiceTemplateRequest)
-> ((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)))
-> VoiceTemplateRequest
-> f VoiceTemplateRequest
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 VoiceTemplateRequest

instance Prelude.NFData VoiceTemplateRequest

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