{-# 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.VoiceId.Types.Speaker
-- 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.VoiceId.Types.Speaker where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.VoiceId.Types.SpeakerStatus

-- | Contains all the information about a speaker.
--
-- /See:/ 'newSpeaker' smart constructor.
data Speaker = Speaker'
  { -- | The current status of the speaker.
    Speaker -> Maybe SpeakerStatus
status :: Prelude.Maybe SpeakerStatus,
    -- | The client-provided identifier for the speaker.
    Speaker -> Maybe (Sensitive Text)
customerSpeakerId :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | A timestamp showing when the speaker is created.
    Speaker -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The identifier of the domain that contains the speaker.
    Speaker -> Maybe Text
domainId :: Prelude.Maybe Prelude.Text,
    -- | A timestamp showing the speaker\'s last update.
    Speaker -> Maybe POSIX
updatedAt :: Prelude.Maybe Core.POSIX,
    -- | The service-generated identifier for the speaker.
    Speaker -> Maybe Text
generatedSpeakerId :: Prelude.Maybe Prelude.Text
  }
  deriving (Speaker -> Speaker -> Bool
(Speaker -> Speaker -> Bool)
-> (Speaker -> Speaker -> Bool) -> Eq Speaker
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Speaker -> Speaker -> Bool
$c/= :: Speaker -> Speaker -> Bool
== :: Speaker -> Speaker -> Bool
$c== :: Speaker -> Speaker -> Bool
Prelude.Eq, Int -> Speaker -> ShowS
[Speaker] -> ShowS
Speaker -> String
(Int -> Speaker -> ShowS)
-> (Speaker -> String) -> ([Speaker] -> ShowS) -> Show Speaker
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Speaker] -> ShowS
$cshowList :: [Speaker] -> ShowS
show :: Speaker -> String
$cshow :: Speaker -> String
showsPrec :: Int -> Speaker -> ShowS
$cshowsPrec :: Int -> Speaker -> ShowS
Prelude.Show, (forall x. Speaker -> Rep Speaker x)
-> (forall x. Rep Speaker x -> Speaker) -> Generic Speaker
forall x. Rep Speaker x -> Speaker
forall x. Speaker -> Rep Speaker x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Speaker x -> Speaker
$cfrom :: forall x. Speaker -> Rep Speaker x
Prelude.Generic)

-- |
-- Create a value of 'Speaker' 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:
--
-- 'status', 'speaker_status' - The current status of the speaker.
--
-- 'customerSpeakerId', 'speaker_customerSpeakerId' - The client-provided identifier for the speaker.
--
-- 'createdAt', 'speaker_createdAt' - A timestamp showing when the speaker is created.
--
-- 'domainId', 'speaker_domainId' - The identifier of the domain that contains the speaker.
--
-- 'updatedAt', 'speaker_updatedAt' - A timestamp showing the speaker\'s last update.
--
-- 'generatedSpeakerId', 'speaker_generatedSpeakerId' - The service-generated identifier for the speaker.
newSpeaker ::
  Speaker
newSpeaker :: Speaker
newSpeaker =
  Speaker' :: Maybe SpeakerStatus
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Speaker
Speaker'
    { $sel:status:Speaker' :: Maybe SpeakerStatus
status = Maybe SpeakerStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:customerSpeakerId:Speaker' :: Maybe (Sensitive Text)
customerSpeakerId = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:Speaker' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:domainId:Speaker' :: Maybe Text
domainId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:Speaker' :: Maybe POSIX
updatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:generatedSpeakerId:Speaker' :: Maybe Text
generatedSpeakerId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The current status of the speaker.
speaker_status :: Lens.Lens' Speaker (Prelude.Maybe SpeakerStatus)
speaker_status :: (Maybe SpeakerStatus -> f (Maybe SpeakerStatus))
-> Speaker -> f Speaker
speaker_status = (Speaker -> Maybe SpeakerStatus)
-> (Speaker -> Maybe SpeakerStatus -> Speaker)
-> Lens Speaker Speaker (Maybe SpeakerStatus) (Maybe SpeakerStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Speaker' {Maybe SpeakerStatus
status :: Maybe SpeakerStatus
$sel:status:Speaker' :: Speaker -> Maybe SpeakerStatus
status} -> Maybe SpeakerStatus
status) (\s :: Speaker
s@Speaker' {} Maybe SpeakerStatus
a -> Speaker
s {$sel:status:Speaker' :: Maybe SpeakerStatus
status = Maybe SpeakerStatus
a} :: Speaker)

-- | The client-provided identifier for the speaker.
speaker_customerSpeakerId :: Lens.Lens' Speaker (Prelude.Maybe Prelude.Text)
speaker_customerSpeakerId :: (Maybe Text -> f (Maybe Text)) -> Speaker -> f Speaker
speaker_customerSpeakerId = (Speaker -> Maybe (Sensitive Text))
-> (Speaker -> Maybe (Sensitive Text) -> Speaker)
-> Lens
     Speaker Speaker (Maybe (Sensitive Text)) (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Speaker' {Maybe (Sensitive Text)
customerSpeakerId :: Maybe (Sensitive Text)
$sel:customerSpeakerId:Speaker' :: Speaker -> Maybe (Sensitive Text)
customerSpeakerId} -> Maybe (Sensitive Text)
customerSpeakerId) (\s :: Speaker
s@Speaker' {} Maybe (Sensitive Text)
a -> Speaker
s {$sel:customerSpeakerId:Speaker' :: Maybe (Sensitive Text)
customerSpeakerId = Maybe (Sensitive Text)
a} :: Speaker) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> Speaker -> f Speaker)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Speaker
-> f Speaker
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | A timestamp showing when the speaker is created.
speaker_createdAt :: Lens.Lens' Speaker (Prelude.Maybe Prelude.UTCTime)
speaker_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Speaker -> f Speaker
speaker_createdAt = (Speaker -> Maybe POSIX)
-> (Speaker -> Maybe POSIX -> Speaker)
-> Lens Speaker Speaker (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Speaker' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:Speaker' :: Speaker -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: Speaker
s@Speaker' {} Maybe POSIX
a -> Speaker
s {$sel:createdAt:Speaker' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: Speaker) ((Maybe POSIX -> f (Maybe POSIX)) -> Speaker -> f Speaker)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Speaker
-> f Speaker
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The identifier of the domain that contains the speaker.
speaker_domainId :: Lens.Lens' Speaker (Prelude.Maybe Prelude.Text)
speaker_domainId :: (Maybe Text -> f (Maybe Text)) -> Speaker -> f Speaker
speaker_domainId = (Speaker -> Maybe Text)
-> (Speaker -> Maybe Text -> Speaker)
-> Lens Speaker Speaker (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Speaker' {Maybe Text
domainId :: Maybe Text
$sel:domainId:Speaker' :: Speaker -> Maybe Text
domainId} -> Maybe Text
domainId) (\s :: Speaker
s@Speaker' {} Maybe Text
a -> Speaker
s {$sel:domainId:Speaker' :: Maybe Text
domainId = Maybe Text
a} :: Speaker)

-- | A timestamp showing the speaker\'s last update.
speaker_updatedAt :: Lens.Lens' Speaker (Prelude.Maybe Prelude.UTCTime)
speaker_updatedAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Speaker -> f Speaker
speaker_updatedAt = (Speaker -> Maybe POSIX)
-> (Speaker -> Maybe POSIX -> Speaker)
-> Lens Speaker Speaker (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Speaker' {Maybe POSIX
updatedAt :: Maybe POSIX
$sel:updatedAt:Speaker' :: Speaker -> Maybe POSIX
updatedAt} -> Maybe POSIX
updatedAt) (\s :: Speaker
s@Speaker' {} Maybe POSIX
a -> Speaker
s {$sel:updatedAt:Speaker' :: Maybe POSIX
updatedAt = Maybe POSIX
a} :: Speaker) ((Maybe POSIX -> f (Maybe POSIX)) -> Speaker -> f Speaker)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Speaker
-> f Speaker
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The service-generated identifier for the speaker.
speaker_generatedSpeakerId :: Lens.Lens' Speaker (Prelude.Maybe Prelude.Text)
speaker_generatedSpeakerId :: (Maybe Text -> f (Maybe Text)) -> Speaker -> f Speaker
speaker_generatedSpeakerId = (Speaker -> Maybe Text)
-> (Speaker -> Maybe Text -> Speaker)
-> Lens Speaker Speaker (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Speaker' {Maybe Text
generatedSpeakerId :: Maybe Text
$sel:generatedSpeakerId:Speaker' :: Speaker -> Maybe Text
generatedSpeakerId} -> Maybe Text
generatedSpeakerId) (\s :: Speaker
s@Speaker' {} Maybe Text
a -> Speaker
s {$sel:generatedSpeakerId:Speaker' :: Maybe Text
generatedSpeakerId = Maybe Text
a} :: Speaker)

instance Core.FromJSON Speaker where
  parseJSON :: Value -> Parser Speaker
parseJSON =
    String -> (Object -> Parser Speaker) -> Value -> Parser Speaker
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Speaker"
      ( \Object
x ->
          Maybe SpeakerStatus
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Speaker
Speaker'
            (Maybe SpeakerStatus
 -> Maybe (Sensitive Text)
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Speaker)
-> Parser (Maybe SpeakerStatus)
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Speaker)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SpeakerStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe (Sensitive Text)
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Speaker)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe POSIX -> Maybe Text -> Maybe POSIX -> Maybe Text -> Speaker)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CustomerSpeakerId")
            Parser
  (Maybe POSIX -> Maybe Text -> Maybe POSIX -> Maybe Text -> Speaker)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe POSIX -> Maybe Text -> Speaker)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreatedAt")
            Parser (Maybe Text -> Maybe POSIX -> Maybe Text -> Speaker)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> Speaker)
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
"DomainId")
            Parser (Maybe POSIX -> Maybe Text -> Speaker)
-> Parser (Maybe POSIX) -> Parser (Maybe Text -> Speaker)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UpdatedAt")
            Parser (Maybe Text -> Speaker)
-> Parser (Maybe Text) -> Parser Speaker
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
"GeneratedSpeakerId")
      )

instance Prelude.Hashable Speaker

instance Prelude.NFData Speaker