{-# 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-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.Transcribe.Types.VocabularyInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Transcribe.Types.LanguageCode
import Amazonka.Transcribe.Types.VocabularyState

-- | Provides information about a custom vocabulary.
--
-- /See:/ 'newVocabularyInfo' smart constructor.
data VocabularyInfo = VocabularyInfo'
  { -- | The language code of the vocabulary entries.
    VocabularyInfo -> Maybe LanguageCode
languageCode :: Prelude.Maybe LanguageCode,
    -- | The name of the vocabulary.
    VocabularyInfo -> Maybe Text
vocabularyName :: Prelude.Maybe Prelude.Text,
    -- | The date and time that the vocabulary was last modified.
    VocabularyInfo -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Core.POSIX,
    -- | The processing state of the vocabulary. If the state is @READY@ you can
    -- use the vocabulary in a @StartTranscriptionJob@ request.
    VocabularyInfo -> Maybe VocabularyState
vocabularyState :: Prelude.Maybe VocabularyState
  }
  deriving (VocabularyInfo -> VocabularyInfo -> Bool
(VocabularyInfo -> VocabularyInfo -> Bool)
-> (VocabularyInfo -> VocabularyInfo -> Bool) -> Eq VocabularyInfo
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]
(Int -> ReadS VocabularyInfo)
-> ReadS [VocabularyInfo]
-> ReadPrec VocabularyInfo
-> ReadPrec [VocabularyInfo]
-> Read 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
(Int -> VocabularyInfo -> ShowS)
-> (VocabularyInfo -> String)
-> ([VocabularyInfo] -> ShowS)
-> Show VocabularyInfo
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. VocabularyInfo -> Rep VocabularyInfo x)
-> (forall x. Rep VocabularyInfo x -> VocabularyInfo)
-> Generic VocabularyInfo
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 of the vocabulary entries.
--
-- 'vocabularyName', 'vocabularyInfo_vocabularyName' - The name of the vocabulary.
--
-- 'lastModifiedTime', 'vocabularyInfo_lastModifiedTime' - The date and time that the vocabulary was last modified.
--
-- 'vocabularyState', 'vocabularyInfo_vocabularyState' - The processing state of the vocabulary. If the state is @READY@ you can
-- use the vocabulary in a @StartTranscriptionJob@ request.
newVocabularyInfo ::
  VocabularyInfo
newVocabularyInfo :: VocabularyInfo
newVocabularyInfo =
  VocabularyInfo' :: Maybe LanguageCode
-> Maybe Text
-> Maybe POSIX
-> Maybe VocabularyState
-> VocabularyInfo
VocabularyInfo'
    { $sel:languageCode:VocabularyInfo' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
forall a. Maybe a
Prelude.Nothing,
      $sel:vocabularyName:VocabularyInfo' :: Maybe Text
vocabularyName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTime:VocabularyInfo' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:vocabularyState:VocabularyInfo' :: Maybe VocabularyState
vocabularyState = Maybe VocabularyState
forall a. Maybe a
Prelude.Nothing
    }

-- | The language code of the vocabulary entries.
vocabularyInfo_languageCode :: Lens.Lens' VocabularyInfo (Prelude.Maybe LanguageCode)
vocabularyInfo_languageCode :: (Maybe LanguageCode -> f (Maybe LanguageCode))
-> VocabularyInfo -> f VocabularyInfo
vocabularyInfo_languageCode = (VocabularyInfo -> Maybe LanguageCode)
-> (VocabularyInfo -> Maybe LanguageCode -> VocabularyInfo)
-> Lens
     VocabularyInfo
     VocabularyInfo
     (Maybe LanguageCode)
     (Maybe 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 name of the vocabulary.
vocabularyInfo_vocabularyName :: Lens.Lens' VocabularyInfo (Prelude.Maybe Prelude.Text)
vocabularyInfo_vocabularyName :: (Maybe Text -> f (Maybe Text))
-> VocabularyInfo -> f VocabularyInfo
vocabularyInfo_vocabularyName = (VocabularyInfo -> Maybe Text)
-> (VocabularyInfo -> Maybe Text -> VocabularyInfo)
-> Lens VocabularyInfo VocabularyInfo (Maybe Text) (Maybe Text)
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 date and time that the vocabulary was last modified.
vocabularyInfo_lastModifiedTime :: Lens.Lens' VocabularyInfo (Prelude.Maybe Prelude.UTCTime)
vocabularyInfo_lastModifiedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> VocabularyInfo -> f VocabularyInfo
vocabularyInfo_lastModifiedTime = (VocabularyInfo -> Maybe POSIX)
-> (VocabularyInfo -> Maybe POSIX -> VocabularyInfo)
-> Lens VocabularyInfo VocabularyInfo (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> VocabularyInfo -> f VocabularyInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> VocabularyInfo
-> f VocabularyInfo
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 processing state of the vocabulary. If the state is @READY@ you can
-- use the vocabulary in a @StartTranscriptionJob@ request.
vocabularyInfo_vocabularyState :: Lens.Lens' VocabularyInfo (Prelude.Maybe VocabularyState)
vocabularyInfo_vocabularyState :: (Maybe VocabularyState -> f (Maybe VocabularyState))
-> VocabularyInfo -> f VocabularyInfo
vocabularyInfo_vocabularyState = (VocabularyInfo -> Maybe VocabularyState)
-> (VocabularyInfo -> Maybe VocabularyState -> VocabularyInfo)
-> Lens
     VocabularyInfo
     VocabularyInfo
     (Maybe VocabularyState)
     (Maybe 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 Core.FromJSON VocabularyInfo where
  parseJSON :: Value -> Parser VocabularyInfo
parseJSON =
    String
-> (Object -> Parser VocabularyInfo)
-> Value
-> Parser VocabularyInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VocabularyInfo"
      ( \Object
x ->
          Maybe LanguageCode
-> Maybe Text
-> Maybe POSIX
-> Maybe VocabularyState
-> VocabularyInfo
VocabularyInfo'
            (Maybe LanguageCode
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe VocabularyState
 -> VocabularyInfo)
-> Parser (Maybe LanguageCode)
-> Parser
     (Maybe Text
      -> Maybe POSIX -> Maybe VocabularyState -> VocabularyInfo)
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 POSIX -> Maybe VocabularyState -> VocabularyInfo)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe VocabularyState -> VocabularyInfo)
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
"VocabularyName")
            Parser (Maybe POSIX -> Maybe VocabularyState -> VocabularyInfo)
-> Parser (Maybe POSIX)
-> Parser (Maybe VocabularyState -> VocabularyInfo)
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
"LastModifiedTime")
            Parser (Maybe VocabularyState -> VocabularyInfo)
-> Parser (Maybe VocabularyState) -> Parser VocabularyInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VocabularyState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VocabularyState")
      )

instance Prelude.Hashable VocabularyInfo

instance Prelude.NFData VocabularyInfo