{-# 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.Transcribe.Types.VocabularyInfo
-- 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.Transcribe.Types.VocabularyInfo 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
import Amazonka.Transcribe.Types.LanguageCode
import Amazonka.Transcribe.Types.VocabularyState

-- | Provides information about a custom vocabulary, including the language
-- of the custom vocabulary, when it was last modified, its name, and the
-- processing state.
--
-- /See:/ 'newVocabularyInfo' smart constructor.
data VocabularyInfo = VocabularyInfo'
  { -- | The language code used to create your custom vocabulary. Each custom
    -- vocabulary must contain terms in only one language.
    --
    -- A custom vocabulary can only be used to transcribe files in the same
    -- language as the custom vocabulary. For example, if you create a custom
    -- vocabulary using US English (@en-US@), you can only apply this custom
    -- vocabulary to files that contain English audio.
    VocabularyInfo -> Maybe LanguageCode
languageCode :: Prelude.Maybe LanguageCode,
    -- | The date and time the specified custom vocabulary was last modified.
    --
    -- Timestamps are in the format @YYYY-MM-DD\'T\'HH:MM:SS.SSSSSS-UTC@. For
    -- example, @2022-05-04T12:32:58.761000-07:00@ represents 12:32 PM UTC-7 on
    -- May 4, 2022.
    VocabularyInfo -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Data.POSIX,
    -- | A unique name, chosen by you, for your custom vocabulary. This name is
    -- case sensitive, cannot contain spaces, and must be unique within an
    -- Amazon Web Services account.
    VocabularyInfo -> Maybe Text
vocabularyName :: Prelude.Maybe Prelude.Text,
    -- | The processing state of your custom vocabulary. If the state is @READY@,
    -- you can use the custom vocabulary in a @StartTranscriptionJob@ request.
    VocabularyInfo -> Maybe VocabularyState
vocabularyState :: Prelude.Maybe VocabularyState
  }
  deriving (VocabularyInfo -> VocabularyInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VocabularyInfo -> VocabularyInfo -> Bool
$c/= :: VocabularyInfo -> VocabularyInfo -> Bool
== :: VocabularyInfo -> VocabularyInfo -> Bool
$c== :: VocabularyInfo -> VocabularyInfo -> Bool
Prelude.Eq, ReadPrec [VocabularyInfo]
ReadPrec VocabularyInfo
Int -> ReadS VocabularyInfo
ReadS [VocabularyInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VocabularyInfo]
$creadListPrec :: ReadPrec [VocabularyInfo]
readPrec :: ReadPrec VocabularyInfo
$creadPrec :: ReadPrec VocabularyInfo
readList :: ReadS [VocabularyInfo]
$creadList :: ReadS [VocabularyInfo]
readsPrec :: Int -> ReadS VocabularyInfo
$creadsPrec :: Int -> ReadS VocabularyInfo
Prelude.Read, Int -> VocabularyInfo -> ShowS
[VocabularyInfo] -> ShowS
VocabularyInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VocabularyInfo] -> ShowS
$cshowList :: [VocabularyInfo] -> ShowS
show :: VocabularyInfo -> String
$cshow :: VocabularyInfo -> String
showsPrec :: Int -> VocabularyInfo -> ShowS
$cshowsPrec :: Int -> VocabularyInfo -> ShowS
Prelude.Show, forall x. Rep VocabularyInfo x -> VocabularyInfo
forall x. VocabularyInfo -> Rep VocabularyInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VocabularyInfo x -> VocabularyInfo
$cfrom :: forall x. VocabularyInfo -> Rep VocabularyInfo x
Prelude.Generic)

-- |
-- Create a value of 'VocabularyInfo' 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', 'vocabularyInfo_languageCode' - The language code used to create your custom vocabulary. Each custom
-- vocabulary must contain terms in only one language.
--
-- A custom vocabulary can only be used to transcribe files in the same
-- language as the custom vocabulary. For example, if you create a custom
-- vocabulary using US English (@en-US@), you can only apply this custom
-- vocabulary to files that contain English audio.
--
-- 'lastModifiedTime', 'vocabularyInfo_lastModifiedTime' - The date and time the specified custom vocabulary was last modified.
--
-- Timestamps are in the format @YYYY-MM-DD\'T\'HH:MM:SS.SSSSSS-UTC@. For
-- example, @2022-05-04T12:32:58.761000-07:00@ represents 12:32 PM UTC-7 on
-- May 4, 2022.
--
-- 'vocabularyName', 'vocabularyInfo_vocabularyName' - A unique name, chosen by you, for your custom vocabulary. This name is
-- case sensitive, cannot contain spaces, and must be unique within an
-- Amazon Web Services account.
--
-- 'vocabularyState', 'vocabularyInfo_vocabularyState' - The processing state of your custom vocabulary. If the state is @READY@,
-- you can use the custom vocabulary in a @StartTranscriptionJob@ request.
newVocabularyInfo ::
  VocabularyInfo
newVocabularyInfo :: VocabularyInfo
newVocabularyInfo =
  VocabularyInfo'
    { $sel:languageCode:VocabularyInfo' :: Maybe LanguageCode
languageCode = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTime:VocabularyInfo' :: Maybe POSIX
lastModifiedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:vocabularyName:VocabularyInfo' :: Maybe Text
vocabularyName = forall a. Maybe a
Prelude.Nothing,
      $sel:vocabularyState:VocabularyInfo' :: Maybe VocabularyState
vocabularyState = forall a. Maybe a
Prelude.Nothing
    }

-- | The language code used to create your custom vocabulary. Each custom
-- vocabulary must contain terms in only one language.
--
-- A custom vocabulary can only be used to transcribe files in the same
-- language as the custom vocabulary. For example, if you create a custom
-- vocabulary using US English (@en-US@), you can only apply this custom
-- vocabulary to files that contain English audio.
vocabularyInfo_languageCode :: Lens.Lens' VocabularyInfo (Prelude.Maybe LanguageCode)
vocabularyInfo_languageCode :: Lens' VocabularyInfo (Maybe LanguageCode)
vocabularyInfo_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VocabularyInfo' {Maybe LanguageCode
languageCode :: Maybe LanguageCode
$sel:languageCode:VocabularyInfo' :: VocabularyInfo -> Maybe LanguageCode
languageCode} -> Maybe LanguageCode
languageCode) (\s :: VocabularyInfo
s@VocabularyInfo' {} Maybe LanguageCode
a -> VocabularyInfo
s {$sel:languageCode:VocabularyInfo' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
a} :: VocabularyInfo)

-- | The date and time the specified custom vocabulary was last modified.
--
-- Timestamps are in the format @YYYY-MM-DD\'T\'HH:MM:SS.SSSSSS-UTC@. For
-- example, @2022-05-04T12:32:58.761000-07:00@ represents 12:32 PM UTC-7 on
-- May 4, 2022.
vocabularyInfo_lastModifiedTime :: Lens.Lens' VocabularyInfo (Prelude.Maybe Prelude.UTCTime)
vocabularyInfo_lastModifiedTime :: Lens' VocabularyInfo (Maybe UTCTime)
vocabularyInfo_lastModifiedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VocabularyInfo' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:VocabularyInfo' :: VocabularyInfo -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: VocabularyInfo
s@VocabularyInfo' {} Maybe POSIX
a -> VocabularyInfo
s {$sel:lastModifiedTime:VocabularyInfo' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: VocabularyInfo) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A unique name, chosen by you, for your custom vocabulary. This name is
-- case sensitive, cannot contain spaces, and must be unique within an
-- Amazon Web Services account.
vocabularyInfo_vocabularyName :: Lens.Lens' VocabularyInfo (Prelude.Maybe Prelude.Text)
vocabularyInfo_vocabularyName :: Lens' VocabularyInfo (Maybe Text)
vocabularyInfo_vocabularyName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VocabularyInfo' {Maybe Text
vocabularyName :: Maybe Text
$sel:vocabularyName:VocabularyInfo' :: VocabularyInfo -> Maybe Text
vocabularyName} -> Maybe Text
vocabularyName) (\s :: VocabularyInfo
s@VocabularyInfo' {} Maybe Text
a -> VocabularyInfo
s {$sel:vocabularyName:VocabularyInfo' :: Maybe Text
vocabularyName = Maybe Text
a} :: VocabularyInfo)

-- | The processing state of your custom vocabulary. If the state is @READY@,
-- you can use the custom vocabulary in a @StartTranscriptionJob@ request.
vocabularyInfo_vocabularyState :: Lens.Lens' VocabularyInfo (Prelude.Maybe VocabularyState)
vocabularyInfo_vocabularyState :: Lens' VocabularyInfo (Maybe VocabularyState)
vocabularyInfo_vocabularyState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VocabularyInfo' {Maybe VocabularyState
vocabularyState :: Maybe VocabularyState
$sel:vocabularyState:VocabularyInfo' :: VocabularyInfo -> Maybe VocabularyState
vocabularyState} -> Maybe VocabularyState
vocabularyState) (\s :: VocabularyInfo
s@VocabularyInfo' {} Maybe VocabularyState
a -> VocabularyInfo
s {$sel:vocabularyState:VocabularyInfo' :: Maybe VocabularyState
vocabularyState = Maybe VocabularyState
a} :: VocabularyInfo)

instance Data.FromJSON VocabularyInfo where
  parseJSON :: Value -> Parser VocabularyInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VocabularyInfo"
      ( \Object
x ->
          Maybe LanguageCode
-> Maybe POSIX
-> Maybe Text
-> Maybe VocabularyState
-> VocabularyInfo
VocabularyInfo'
            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
"LanguageCode")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LastModifiedTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"VocabularyName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"VocabularyState")
      )

instance Prelude.Hashable VocabularyInfo where
  hashWithSalt :: Int -> VocabularyInfo -> Int
hashWithSalt Int
_salt VocabularyInfo' {Maybe Text
Maybe POSIX
Maybe LanguageCode
Maybe VocabularyState
vocabularyState :: Maybe VocabularyState
vocabularyName :: Maybe Text
lastModifiedTime :: Maybe POSIX
languageCode :: Maybe LanguageCode
$sel:vocabularyState:VocabularyInfo' :: VocabularyInfo -> Maybe VocabularyState
$sel:vocabularyName:VocabularyInfo' :: VocabularyInfo -> Maybe Text
$sel:lastModifiedTime:VocabularyInfo' :: VocabularyInfo -> Maybe POSIX
$sel:languageCode:VocabularyInfo' :: VocabularyInfo -> Maybe LanguageCode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LanguageCode
languageCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModifiedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vocabularyName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VocabularyState
vocabularyState

instance Prelude.NFData VocabularyInfo where
  rnf :: VocabularyInfo -> ()
rnf VocabularyInfo' {Maybe Text
Maybe POSIX
Maybe LanguageCode
Maybe VocabularyState
vocabularyState :: Maybe VocabularyState
vocabularyName :: Maybe Text
lastModifiedTime :: Maybe POSIX
languageCode :: Maybe LanguageCode
$sel:vocabularyState:VocabularyInfo' :: VocabularyInfo -> Maybe VocabularyState
$sel:vocabularyName:VocabularyInfo' :: VocabularyInfo -> Maybe Text
$sel:lastModifiedTime:VocabularyInfo' :: VocabularyInfo -> Maybe POSIX
$sel:languageCode:VocabularyInfo' :: VocabularyInfo -> Maybe LanguageCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LanguageCode
languageCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vocabularyName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VocabularyState
vocabularyState