{-# 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.LexV2Models.Types.SSMLMessage
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.LexV2Models.Types.SSMLMessage where

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

-- | Defines a Speech Synthesis Markup Language (SSML) prompt.
--
-- /See:/ 'newSSMLMessage' smart constructor.
data SSMLMessage = SSMLMessage'
  { -- | The SSML text that defines the prompt.
    SSMLMessage -> Text
value :: Prelude.Text
  }
  deriving (SSMLMessage -> SSMLMessage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SSMLMessage -> SSMLMessage -> Bool
$c/= :: SSMLMessage -> SSMLMessage -> Bool
== :: SSMLMessage -> SSMLMessage -> Bool
$c== :: SSMLMessage -> SSMLMessage -> Bool
Prelude.Eq, ReadPrec [SSMLMessage]
ReadPrec SSMLMessage
Int -> ReadS SSMLMessage
ReadS [SSMLMessage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SSMLMessage]
$creadListPrec :: ReadPrec [SSMLMessage]
readPrec :: ReadPrec SSMLMessage
$creadPrec :: ReadPrec SSMLMessage
readList :: ReadS [SSMLMessage]
$creadList :: ReadS [SSMLMessage]
readsPrec :: Int -> ReadS SSMLMessage
$creadsPrec :: Int -> ReadS SSMLMessage
Prelude.Read, Int -> SSMLMessage -> ShowS
[SSMLMessage] -> ShowS
SSMLMessage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SSMLMessage] -> ShowS
$cshowList :: [SSMLMessage] -> ShowS
show :: SSMLMessage -> String
$cshow :: SSMLMessage -> String
showsPrec :: Int -> SSMLMessage -> ShowS
$cshowsPrec :: Int -> SSMLMessage -> ShowS
Prelude.Show, forall x. Rep SSMLMessage x -> SSMLMessage
forall x. SSMLMessage -> Rep SSMLMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SSMLMessage x -> SSMLMessage
$cfrom :: forall x. SSMLMessage -> Rep SSMLMessage x
Prelude.Generic)

-- |
-- Create a value of 'SSMLMessage' 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:
--
-- 'value', 'sSMLMessage_value' - The SSML text that defines the prompt.
newSSMLMessage ::
  -- | 'value'
  Prelude.Text ->
  SSMLMessage
newSSMLMessage :: Text -> SSMLMessage
newSSMLMessage Text
pValue_ =
  SSMLMessage' {$sel:value:SSMLMessage' :: Text
value = Text
pValue_}

-- | The SSML text that defines the prompt.
sSMLMessage_value :: Lens.Lens' SSMLMessage Prelude.Text
sSMLMessage_value :: Lens' SSMLMessage Text
sSMLMessage_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SSMLMessage' {Text
value :: Text
$sel:value:SSMLMessage' :: SSMLMessage -> Text
value} -> Text
value) (\s :: SSMLMessage
s@SSMLMessage' {} Text
a -> SSMLMessage
s {$sel:value:SSMLMessage' :: Text
value = Text
a} :: SSMLMessage)

instance Data.FromJSON SSMLMessage where
  parseJSON :: Value -> Parser SSMLMessage
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SSMLMessage"
      (\Object
x -> Text -> SSMLMessage
SSMLMessage' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"value"))

instance Prelude.Hashable SSMLMessage where
  hashWithSalt :: Int -> SSMLMessage -> Int
hashWithSalt Int
_salt SSMLMessage' {Text
value :: Text
$sel:value:SSMLMessage' :: SSMLMessage -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
value

instance Prelude.NFData SSMLMessage where
  rnf :: SSMLMessage -> ()
rnf SSMLMessage' {Text
value :: Text
$sel:value:SSMLMessage' :: SSMLMessage -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
value

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