{-# 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.Polly.Types.Voice
-- 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.Polly.Types.Voice where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Polly.Types.Engine
import Amazonka.Polly.Types.Gender
import Amazonka.Polly.Types.LanguageCode
import Amazonka.Polly.Types.VoiceId
import qualified Amazonka.Prelude as Prelude

-- | Description of the voice.
--
-- /See:/ 'newVoice' smart constructor.
data Voice = Voice'
  { -- | Language code of the voice.
    Voice -> Maybe LanguageCode
languageCode :: Prelude.Maybe LanguageCode,
    -- | Human readable name of the language in English.
    Voice -> Maybe Text
languageName :: Prelude.Maybe Prelude.Text,
    -- | Gender of the voice.
    Voice -> Maybe Gender
gender :: Prelude.Maybe Gender,
    -- | Name of the voice (for example, Salli, Kendra, etc.). This provides a
    -- human readable voice name that you might display in your application.
    Voice -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Amazon Polly assigned voice ID. This is the ID that you specify when
    -- calling the @SynthesizeSpeech@ operation.
    Voice -> Maybe VoiceId
id :: Prelude.Maybe VoiceId,
    -- | Additional codes for languages available for the specified voice in
    -- addition to its default language.
    --
    -- For example, the default language for Aditi is Indian English (en-IN)
    -- because it was first used for that language. Since Aditi is bilingual
    -- and fluent in both Indian English and Hindi, this parameter would show
    -- the code @hi-IN@.
    Voice -> Maybe [LanguageCode]
additionalLanguageCodes :: Prelude.Maybe [LanguageCode],
    -- | Specifies which engines (@standard@ or @neural@) that are supported by a
    -- given voice.
    Voice -> Maybe [Engine]
supportedEngines :: Prelude.Maybe [Engine]
  }
  deriving (Voice -> Voice -> Bool
(Voice -> Voice -> Bool) -> (Voice -> Voice -> Bool) -> Eq Voice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Voice -> Voice -> Bool
$c/= :: Voice -> Voice -> Bool
== :: Voice -> Voice -> Bool
$c== :: Voice -> Voice -> Bool
Prelude.Eq, ReadPrec [Voice]
ReadPrec Voice
Int -> ReadS Voice
ReadS [Voice]
(Int -> ReadS Voice)
-> ReadS [Voice]
-> ReadPrec Voice
-> ReadPrec [Voice]
-> Read Voice
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Voice]
$creadListPrec :: ReadPrec [Voice]
readPrec :: ReadPrec Voice
$creadPrec :: ReadPrec Voice
readList :: ReadS [Voice]
$creadList :: ReadS [Voice]
readsPrec :: Int -> ReadS Voice
$creadsPrec :: Int -> ReadS Voice
Prelude.Read, Int -> Voice -> ShowS
[Voice] -> ShowS
Voice -> String
(Int -> Voice -> ShowS)
-> (Voice -> String) -> ([Voice] -> ShowS) -> Show Voice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Voice] -> ShowS
$cshowList :: [Voice] -> ShowS
show :: Voice -> String
$cshow :: Voice -> String
showsPrec :: Int -> Voice -> ShowS
$cshowsPrec :: Int -> Voice -> ShowS
Prelude.Show, (forall x. Voice -> Rep Voice x)
-> (forall x. Rep Voice x -> Voice) -> Generic Voice
forall x. Rep Voice x -> Voice
forall x. Voice -> Rep Voice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Voice x -> Voice
$cfrom :: forall x. Voice -> Rep Voice x
Prelude.Generic)

-- |
-- Create a value of 'Voice' 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', 'voice_languageCode' - Language code of the voice.
--
-- 'languageName', 'voice_languageName' - Human readable name of the language in English.
--
-- 'gender', 'voice_gender' - Gender of the voice.
--
-- 'name', 'voice_name' - Name of the voice (for example, Salli, Kendra, etc.). This provides a
-- human readable voice name that you might display in your application.
--
-- 'id', 'voice_id' - Amazon Polly assigned voice ID. This is the ID that you specify when
-- calling the @SynthesizeSpeech@ operation.
--
-- 'additionalLanguageCodes', 'voice_additionalLanguageCodes' - Additional codes for languages available for the specified voice in
-- addition to its default language.
--
-- For example, the default language for Aditi is Indian English (en-IN)
-- because it was first used for that language. Since Aditi is bilingual
-- and fluent in both Indian English and Hindi, this parameter would show
-- the code @hi-IN@.
--
-- 'supportedEngines', 'voice_supportedEngines' - Specifies which engines (@standard@ or @neural@) that are supported by a
-- given voice.
newVoice ::
  Voice
newVoice :: Voice
newVoice =
  Voice' :: Maybe LanguageCode
-> Maybe Text
-> Maybe Gender
-> Maybe Text
-> Maybe VoiceId
-> Maybe [LanguageCode]
-> Maybe [Engine]
-> Voice
Voice'
    { $sel:languageCode:Voice' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
forall a. Maybe a
Prelude.Nothing,
      $sel:languageName:Voice' :: Maybe Text
languageName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gender:Voice' :: Maybe Gender
gender = Maybe Gender
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Voice' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:Voice' :: Maybe VoiceId
id = Maybe VoiceId
forall a. Maybe a
Prelude.Nothing,
      $sel:additionalLanguageCodes:Voice' :: Maybe [LanguageCode]
additionalLanguageCodes = Maybe [LanguageCode]
forall a. Maybe a
Prelude.Nothing,
      $sel:supportedEngines:Voice' :: Maybe [Engine]
supportedEngines = Maybe [Engine]
forall a. Maybe a
Prelude.Nothing
    }

-- | Language code of the voice.
voice_languageCode :: Lens.Lens' Voice (Prelude.Maybe LanguageCode)
voice_languageCode :: (Maybe LanguageCode -> f (Maybe LanguageCode)) -> Voice -> f Voice
voice_languageCode = (Voice -> Maybe LanguageCode)
-> (Voice -> Maybe LanguageCode -> Voice)
-> Lens Voice Voice (Maybe LanguageCode) (Maybe LanguageCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Voice' {Maybe LanguageCode
languageCode :: Maybe LanguageCode
$sel:languageCode:Voice' :: Voice -> Maybe LanguageCode
languageCode} -> Maybe LanguageCode
languageCode) (\s :: Voice
s@Voice' {} Maybe LanguageCode
a -> Voice
s {$sel:languageCode:Voice' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
a} :: Voice)

-- | Human readable name of the language in English.
voice_languageName :: Lens.Lens' Voice (Prelude.Maybe Prelude.Text)
voice_languageName :: (Maybe Text -> f (Maybe Text)) -> Voice -> f Voice
voice_languageName = (Voice -> Maybe Text)
-> (Voice -> Maybe Text -> Voice)
-> Lens Voice Voice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Voice' {Maybe Text
languageName :: Maybe Text
$sel:languageName:Voice' :: Voice -> Maybe Text
languageName} -> Maybe Text
languageName) (\s :: Voice
s@Voice' {} Maybe Text
a -> Voice
s {$sel:languageName:Voice' :: Maybe Text
languageName = Maybe Text
a} :: Voice)

-- | Gender of the voice.
voice_gender :: Lens.Lens' Voice (Prelude.Maybe Gender)
voice_gender :: (Maybe Gender -> f (Maybe Gender)) -> Voice -> f Voice
voice_gender = (Voice -> Maybe Gender)
-> (Voice -> Maybe Gender -> Voice)
-> Lens Voice Voice (Maybe Gender) (Maybe Gender)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Voice' {Maybe Gender
gender :: Maybe Gender
$sel:gender:Voice' :: Voice -> Maybe Gender
gender} -> Maybe Gender
gender) (\s :: Voice
s@Voice' {} Maybe Gender
a -> Voice
s {$sel:gender:Voice' :: Maybe Gender
gender = Maybe Gender
a} :: Voice)

-- | Name of the voice (for example, Salli, Kendra, etc.). This provides a
-- human readable voice name that you might display in your application.
voice_name :: Lens.Lens' Voice (Prelude.Maybe Prelude.Text)
voice_name :: (Maybe Text -> f (Maybe Text)) -> Voice -> f Voice
voice_name = (Voice -> Maybe Text)
-> (Voice -> Maybe Text -> Voice)
-> Lens Voice Voice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Voice' {Maybe Text
name :: Maybe Text
$sel:name:Voice' :: Voice -> Maybe Text
name} -> Maybe Text
name) (\s :: Voice
s@Voice' {} Maybe Text
a -> Voice
s {$sel:name:Voice' :: Maybe Text
name = Maybe Text
a} :: Voice)

-- | Amazon Polly assigned voice ID. This is the ID that you specify when
-- calling the @SynthesizeSpeech@ operation.
voice_id :: Lens.Lens' Voice (Prelude.Maybe VoiceId)
voice_id :: (Maybe VoiceId -> f (Maybe VoiceId)) -> Voice -> f Voice
voice_id = (Voice -> Maybe VoiceId)
-> (Voice -> Maybe VoiceId -> Voice)
-> Lens Voice Voice (Maybe VoiceId) (Maybe VoiceId)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Voice' {Maybe VoiceId
id :: Maybe VoiceId
$sel:id:Voice' :: Voice -> Maybe VoiceId
id} -> Maybe VoiceId
id) (\s :: Voice
s@Voice' {} Maybe VoiceId
a -> Voice
s {$sel:id:Voice' :: Maybe VoiceId
id = Maybe VoiceId
a} :: Voice)

-- | Additional codes for languages available for the specified voice in
-- addition to its default language.
--
-- For example, the default language for Aditi is Indian English (en-IN)
-- because it was first used for that language. Since Aditi is bilingual
-- and fluent in both Indian English and Hindi, this parameter would show
-- the code @hi-IN@.
voice_additionalLanguageCodes :: Lens.Lens' Voice (Prelude.Maybe [LanguageCode])
voice_additionalLanguageCodes :: (Maybe [LanguageCode] -> f (Maybe [LanguageCode]))
-> Voice -> f Voice
voice_additionalLanguageCodes = (Voice -> Maybe [LanguageCode])
-> (Voice -> Maybe [LanguageCode] -> Voice)
-> Lens Voice Voice (Maybe [LanguageCode]) (Maybe [LanguageCode])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Voice' {Maybe [LanguageCode]
additionalLanguageCodes :: Maybe [LanguageCode]
$sel:additionalLanguageCodes:Voice' :: Voice -> Maybe [LanguageCode]
additionalLanguageCodes} -> Maybe [LanguageCode]
additionalLanguageCodes) (\s :: Voice
s@Voice' {} Maybe [LanguageCode]
a -> Voice
s {$sel:additionalLanguageCodes:Voice' :: Maybe [LanguageCode]
additionalLanguageCodes = Maybe [LanguageCode]
a} :: Voice) ((Maybe [LanguageCode] -> f (Maybe [LanguageCode]))
 -> Voice -> f Voice)
-> ((Maybe [LanguageCode] -> f (Maybe [LanguageCode]))
    -> Maybe [LanguageCode] -> f (Maybe [LanguageCode]))
-> (Maybe [LanguageCode] -> f (Maybe [LanguageCode]))
-> Voice
-> f Voice
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [LanguageCode] [LanguageCode] [LanguageCode] [LanguageCode]
-> Iso
     (Maybe [LanguageCode])
     (Maybe [LanguageCode])
     (Maybe [LanguageCode])
     (Maybe [LanguageCode])
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 [LanguageCode] [LanguageCode] [LanguageCode] [LanguageCode]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies which engines (@standard@ or @neural@) that are supported by a
-- given voice.
voice_supportedEngines :: Lens.Lens' Voice (Prelude.Maybe [Engine])
voice_supportedEngines :: (Maybe [Engine] -> f (Maybe [Engine])) -> Voice -> f Voice
voice_supportedEngines = (Voice -> Maybe [Engine])
-> (Voice -> Maybe [Engine] -> Voice)
-> Lens Voice Voice (Maybe [Engine]) (Maybe [Engine])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Voice' {Maybe [Engine]
supportedEngines :: Maybe [Engine]
$sel:supportedEngines:Voice' :: Voice -> Maybe [Engine]
supportedEngines} -> Maybe [Engine]
supportedEngines) (\s :: Voice
s@Voice' {} Maybe [Engine]
a -> Voice
s {$sel:supportedEngines:Voice' :: Maybe [Engine]
supportedEngines = Maybe [Engine]
a} :: Voice) ((Maybe [Engine] -> f (Maybe [Engine])) -> Voice -> f Voice)
-> ((Maybe [Engine] -> f (Maybe [Engine]))
    -> Maybe [Engine] -> f (Maybe [Engine]))
-> (Maybe [Engine] -> f (Maybe [Engine]))
-> Voice
-> f Voice
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Engine] [Engine] [Engine] [Engine]
-> Iso
     (Maybe [Engine]) (Maybe [Engine]) (Maybe [Engine]) (Maybe [Engine])
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 [Engine] [Engine] [Engine] [Engine]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON Voice where
  parseJSON :: Value -> Parser Voice
parseJSON =
    String -> (Object -> Parser Voice) -> Value -> Parser Voice
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Voice"
      ( \Object
x ->
          Maybe LanguageCode
-> Maybe Text
-> Maybe Gender
-> Maybe Text
-> Maybe VoiceId
-> Maybe [LanguageCode]
-> Maybe [Engine]
-> Voice
Voice'
            (Maybe LanguageCode
 -> Maybe Text
 -> Maybe Gender
 -> Maybe Text
 -> Maybe VoiceId
 -> Maybe [LanguageCode]
 -> Maybe [Engine]
 -> Voice)
-> Parser (Maybe LanguageCode)
-> Parser
     (Maybe Text
      -> Maybe Gender
      -> Maybe Text
      -> Maybe VoiceId
      -> Maybe [LanguageCode]
      -> Maybe [Engine]
      -> Voice)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LanguageCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LanguageCode")
            Parser
  (Maybe Text
   -> Maybe Gender
   -> Maybe Text
   -> Maybe VoiceId
   -> Maybe [LanguageCode]
   -> Maybe [Engine]
   -> Voice)
-> Parser (Maybe Text)
-> Parser
     (Maybe Gender
      -> Maybe Text
      -> Maybe VoiceId
      -> Maybe [LanguageCode]
      -> Maybe [Engine]
      -> Voice)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LanguageName")
            Parser
  (Maybe Gender
   -> Maybe Text
   -> Maybe VoiceId
   -> Maybe [LanguageCode]
   -> Maybe [Engine]
   -> Voice)
-> Parser (Maybe Gender)
-> Parser
     (Maybe Text
      -> Maybe VoiceId
      -> Maybe [LanguageCode]
      -> Maybe [Engine]
      -> Voice)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Gender)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Gender")
            Parser
  (Maybe Text
   -> Maybe VoiceId
   -> Maybe [LanguageCode]
   -> Maybe [Engine]
   -> Voice)
-> Parser (Maybe Text)
-> Parser
     (Maybe VoiceId -> Maybe [LanguageCode] -> Maybe [Engine] -> Voice)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser
  (Maybe VoiceId -> Maybe [LanguageCode] -> Maybe [Engine] -> Voice)
-> Parser (Maybe VoiceId)
-> Parser (Maybe [LanguageCode] -> Maybe [Engine] -> Voice)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VoiceId)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Id")
            Parser (Maybe [LanguageCode] -> Maybe [Engine] -> Voice)
-> Parser (Maybe [LanguageCode])
-> Parser (Maybe [Engine] -> Voice)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [LanguageCode]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AdditionalLanguageCodes"
                            Parser (Maybe (Maybe [LanguageCode]))
-> Maybe [LanguageCode] -> Parser (Maybe [LanguageCode])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [LanguageCode]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe [Engine] -> Voice)
-> Parser (Maybe [Engine]) -> Parser Voice
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Engine]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SupportedEngines"
                            Parser (Maybe (Maybe [Engine]))
-> Maybe [Engine] -> Parser (Maybe [Engine])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Engine]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable Voice

instance Prelude.NFData Voice