{-# 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.AlexaBusiness.Types.Ssml
-- 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.AlexaBusiness.Types.Ssml where

import Amazonka.AlexaBusiness.Types.Locale
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The SSML message. For more information, see
-- <https://developer.amazon.com/docs/custom-skills/speech-synthesis-markup-language-ssml-reference.html SSML Reference>.
--
-- /See:/ 'newSsml' smart constructor.
data Ssml = Ssml'
  { -- | The locale of the SSML message. Currently, en-US is supported.
    Ssml -> Locale
locale :: Locale,
    -- | The value of the SSML message in the correct SSML format. The audio tag
    -- is not supported.
    Ssml -> Text
value :: Prelude.Text
  }
  deriving (Ssml -> Ssml -> Bool
(Ssml -> Ssml -> Bool) -> (Ssml -> Ssml -> Bool) -> Eq Ssml
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Ssml -> Ssml -> Bool
$c/= :: Ssml -> Ssml -> Bool
== :: Ssml -> Ssml -> Bool
$c== :: Ssml -> Ssml -> Bool
Prelude.Eq, ReadPrec [Ssml]
ReadPrec Ssml
Int -> ReadS Ssml
ReadS [Ssml]
(Int -> ReadS Ssml)
-> ReadS [Ssml] -> ReadPrec Ssml -> ReadPrec [Ssml] -> Read Ssml
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Ssml]
$creadListPrec :: ReadPrec [Ssml]
readPrec :: ReadPrec Ssml
$creadPrec :: ReadPrec Ssml
readList :: ReadS [Ssml]
$creadList :: ReadS [Ssml]
readsPrec :: Int -> ReadS Ssml
$creadsPrec :: Int -> ReadS Ssml
Prelude.Read, Int -> Ssml -> ShowS
[Ssml] -> ShowS
Ssml -> String
(Int -> Ssml -> ShowS)
-> (Ssml -> String) -> ([Ssml] -> ShowS) -> Show Ssml
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Ssml] -> ShowS
$cshowList :: [Ssml] -> ShowS
show :: Ssml -> String
$cshow :: Ssml -> String
showsPrec :: Int -> Ssml -> ShowS
$cshowsPrec :: Int -> Ssml -> ShowS
Prelude.Show, (forall x. Ssml -> Rep Ssml x)
-> (forall x. Rep Ssml x -> Ssml) -> Generic Ssml
forall x. Rep Ssml x -> Ssml
forall x. Ssml -> Rep Ssml x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Ssml x -> Ssml
$cfrom :: forall x. Ssml -> Rep Ssml x
Prelude.Generic)

-- |
-- Create a value of 'Ssml' 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:
--
-- 'locale', 'ssml_locale' - The locale of the SSML message. Currently, en-US is supported.
--
-- 'value', 'ssml_value' - The value of the SSML message in the correct SSML format. The audio tag
-- is not supported.
newSsml ::
  -- | 'locale'
  Locale ->
  -- | 'value'
  Prelude.Text ->
  Ssml
newSsml :: Locale -> Text -> Ssml
newSsml Locale
pLocale_ Text
pValue_ =
  Ssml' :: Locale -> Text -> Ssml
Ssml' {$sel:locale:Ssml' :: Locale
locale = Locale
pLocale_, $sel:value:Ssml' :: Text
value = Text
pValue_}

-- | The locale of the SSML message. Currently, en-US is supported.
ssml_locale :: Lens.Lens' Ssml Locale
ssml_locale :: (Locale -> f Locale) -> Ssml -> f Ssml
ssml_locale = (Ssml -> Locale)
-> (Ssml -> Locale -> Ssml) -> Lens Ssml Ssml Locale Locale
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ssml' {Locale
locale :: Locale
$sel:locale:Ssml' :: Ssml -> Locale
locale} -> Locale
locale) (\s :: Ssml
s@Ssml' {} Locale
a -> Ssml
s {$sel:locale:Ssml' :: Locale
locale = Locale
a} :: Ssml)

-- | The value of the SSML message in the correct SSML format. The audio tag
-- is not supported.
ssml_value :: Lens.Lens' Ssml Prelude.Text
ssml_value :: (Text -> f Text) -> Ssml -> f Ssml
ssml_value = (Ssml -> Text)
-> (Ssml -> Text -> Ssml) -> Lens Ssml Ssml Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ssml' {Text
value :: Text
$sel:value:Ssml' :: Ssml -> Text
value} -> Text
value) (\s :: Ssml
s@Ssml' {} Text
a -> Ssml
s {$sel:value:Ssml' :: Text
value = Text
a} :: Ssml)

instance Prelude.Hashable Ssml

instance Prelude.NFData Ssml

instance Core.ToJSON Ssml where
  toJSON :: Ssml -> Value
toJSON Ssml' {Text
Locale
value :: Text
locale :: Locale
$sel:value:Ssml' :: Ssml -> Text
$sel:locale:Ssml' :: Ssml -> Locale
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Locale" Text -> Locale -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Locale
locale),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
value)
          ]
      )