{-# 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 #-}
module Amazonka.LexV2Models.Types.VoiceSettings where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexV2Models.Types.VoiceEngine
import qualified Amazonka.Prelude as Prelude
data VoiceSettings = VoiceSettings'
{
VoiceSettings -> Maybe VoiceEngine
engine :: Prelude.Maybe VoiceEngine,
VoiceSettings -> Text
voiceId :: Prelude.Text
}
deriving (VoiceSettings -> VoiceSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VoiceSettings -> VoiceSettings -> Bool
$c/= :: VoiceSettings -> VoiceSettings -> Bool
== :: VoiceSettings -> VoiceSettings -> Bool
$c== :: VoiceSettings -> VoiceSettings -> Bool
Prelude.Eq, ReadPrec [VoiceSettings]
ReadPrec VoiceSettings
Int -> ReadS VoiceSettings
ReadS [VoiceSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VoiceSettings]
$creadListPrec :: ReadPrec [VoiceSettings]
readPrec :: ReadPrec VoiceSettings
$creadPrec :: ReadPrec VoiceSettings
readList :: ReadS [VoiceSettings]
$creadList :: ReadS [VoiceSettings]
readsPrec :: Int -> ReadS VoiceSettings
$creadsPrec :: Int -> ReadS VoiceSettings
Prelude.Read, Int -> VoiceSettings -> ShowS
[VoiceSettings] -> ShowS
VoiceSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VoiceSettings] -> ShowS
$cshowList :: [VoiceSettings] -> ShowS
show :: VoiceSettings -> String
$cshow :: VoiceSettings -> String
showsPrec :: Int -> VoiceSettings -> ShowS
$cshowsPrec :: Int -> VoiceSettings -> ShowS
Prelude.Show, forall x. Rep VoiceSettings x -> VoiceSettings
forall x. VoiceSettings -> Rep VoiceSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VoiceSettings x -> VoiceSettings
$cfrom :: forall x. VoiceSettings -> Rep VoiceSettings x
Prelude.Generic)
newVoiceSettings ::
Prelude.Text ->
VoiceSettings
newVoiceSettings :: Text -> VoiceSettings
newVoiceSettings Text
pVoiceId_ =
VoiceSettings'
{ $sel:engine:VoiceSettings' :: Maybe VoiceEngine
engine = forall a. Maybe a
Prelude.Nothing,
$sel:voiceId:VoiceSettings' :: Text
voiceId = Text
pVoiceId_
}
voiceSettings_engine :: Lens.Lens' VoiceSettings (Prelude.Maybe VoiceEngine)
voiceSettings_engine :: Lens' VoiceSettings (Maybe VoiceEngine)
voiceSettings_engine = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VoiceSettings' {Maybe VoiceEngine
engine :: Maybe VoiceEngine
$sel:engine:VoiceSettings' :: VoiceSettings -> Maybe VoiceEngine
engine} -> Maybe VoiceEngine
engine) (\s :: VoiceSettings
s@VoiceSettings' {} Maybe VoiceEngine
a -> VoiceSettings
s {$sel:engine:VoiceSettings' :: Maybe VoiceEngine
engine = Maybe VoiceEngine
a} :: VoiceSettings)
voiceSettings_voiceId :: Lens.Lens' VoiceSettings Prelude.Text
voiceSettings_voiceId :: Lens' VoiceSettings Text
voiceSettings_voiceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VoiceSettings' {Text
voiceId :: Text
$sel:voiceId:VoiceSettings' :: VoiceSettings -> Text
voiceId} -> Text
voiceId) (\s :: VoiceSettings
s@VoiceSettings' {} Text
a -> VoiceSettings
s {$sel:voiceId:VoiceSettings' :: Text
voiceId = Text
a} :: VoiceSettings)
instance Data.FromJSON VoiceSettings where
parseJSON :: Value -> Parser VoiceSettings
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"VoiceSettings"
( \Object
x ->
Maybe VoiceEngine -> Text -> VoiceSettings
VoiceSettings'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"engine")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"voiceId")
)
instance Prelude.Hashable VoiceSettings where
hashWithSalt :: Int -> VoiceSettings -> Int
hashWithSalt Int
_salt VoiceSettings' {Maybe VoiceEngine
Text
voiceId :: Text
engine :: Maybe VoiceEngine
$sel:voiceId:VoiceSettings' :: VoiceSettings -> Text
$sel:engine:VoiceSettings' :: VoiceSettings -> Maybe VoiceEngine
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VoiceEngine
engine
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
voiceId
instance Prelude.NFData VoiceSettings where
rnf :: VoiceSettings -> ()
rnf VoiceSettings' {Maybe VoiceEngine
Text
voiceId :: Text
engine :: Maybe VoiceEngine
$sel:voiceId:VoiceSettings' :: VoiceSettings -> Text
$sel:engine:VoiceSettings' :: VoiceSettings -> Maybe VoiceEngine
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe VoiceEngine
engine
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
voiceId
instance Data.ToJSON VoiceSettings where
toJSON :: VoiceSettings -> Value
toJSON VoiceSettings' {Maybe VoiceEngine
Text
voiceId :: Text
engine :: Maybe VoiceEngine
$sel:voiceId:VoiceSettings' :: VoiceSettings -> Text
$sel:engine:VoiceSettings' :: VoiceSettings -> Maybe VoiceEngine
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"engine" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VoiceEngine
engine,
forall a. a -> Maybe a
Prelude.Just (Key
"voiceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
voiceId)
]
)