{-# 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.VoiceSettings
-- 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.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

-- | Defines settings for using an Amazon Polly voice to communicate with a
-- user.
--
-- /See:/ 'newVoiceSettings' smart constructor.
data VoiceSettings = VoiceSettings'
  { -- | Indicates the type of Amazon Polly voice that Amazon Lex should use for
    -- voice interaction with the user. For more information, see the
    -- <https://docs.aws.amazon.com/polly/latest/dg/API_SynthesizeSpeech.html#polly-SynthesizeSpeech-request-Engine engine parameter of the SynthesizeSpeech operation>
    -- in the /Amazon Polly developer guide/.
    --
    -- If you do not specify a value, the default is @standard@.
    VoiceSettings -> Maybe VoiceEngine
engine :: Prelude.Maybe VoiceEngine,
    -- | The identifier of the Amazon Polly voice to use.
    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)

-- |
-- Create a value of 'VoiceSettings' 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:
--
-- 'engine', 'voiceSettings_engine' - Indicates the type of Amazon Polly voice that Amazon Lex should use for
-- voice interaction with the user. For more information, see the
-- <https://docs.aws.amazon.com/polly/latest/dg/API_SynthesizeSpeech.html#polly-SynthesizeSpeech-request-Engine engine parameter of the SynthesizeSpeech operation>
-- in the /Amazon Polly developer guide/.
--
-- If you do not specify a value, the default is @standard@.
--
-- 'voiceId', 'voiceSettings_voiceId' - The identifier of the Amazon Polly voice to use.
newVoiceSettings ::
  -- | 'voiceId'
  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_
    }

-- | Indicates the type of Amazon Polly voice that Amazon Lex should use for
-- voice interaction with the user. For more information, see the
-- <https://docs.aws.amazon.com/polly/latest/dg/API_SynthesizeSpeech.html#polly-SynthesizeSpeech-request-Engine engine parameter of the SynthesizeSpeech operation>
-- in the /Amazon Polly developer guide/.
--
-- If you do not specify a value, the default is @standard@.
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)

-- | The identifier of the Amazon Polly voice to use.
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)
          ]
      )