{-# 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.Connect.Types.Vocabulary
-- 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.Connect.Types.Vocabulary where

import Amazonka.Connect.Types.VocabularyLanguageCode
import Amazonka.Connect.Types.VocabularyState
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

-- | Contains information about a custom vocabulary.
--
-- /See:/ 'newVocabulary' smart constructor.
data Vocabulary = Vocabulary'
  { -- | The content of the custom vocabulary in plain-text format with a table
    -- of values. Each row in the table represents a word or a phrase,
    -- described with @Phrase@, @IPA@, @SoundsLike@, and @DisplayAs@ fields.
    -- Separate the fields with TAB characters. For more information, see
    -- <https://docs.aws.amazon.com/transcribe/latest/dg/custom-vocabulary.html#create-vocabulary-table Create a custom vocabulary using a table>.
    Vocabulary -> Maybe Text
content :: Prelude.Maybe Prelude.Text,
    -- | The reason why the custom vocabulary was not created.
    Vocabulary -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The tags used to organize, track, or control access for this resource.
    -- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
    Vocabulary -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A unique name of the custom vocabulary.
    Vocabulary -> Text
name :: Prelude.Text,
    -- | The identifier of the custom vocabulary.
    Vocabulary -> Text
id :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the custom vocabulary.
    Vocabulary -> Text
arn :: Prelude.Text,
    -- | The language code of the vocabulary entries. For a list of languages and
    -- their corresponding language codes, see
    -- <https://docs.aws.amazon.com/transcribe/latest/dg/transcribe-whatis.html What is Amazon Transcribe?>
    Vocabulary -> VocabularyLanguageCode
languageCode :: VocabularyLanguageCode,
    -- | The current state of the custom vocabulary.
    Vocabulary -> VocabularyState
state :: VocabularyState,
    -- | The timestamp when the custom vocabulary was last modified.
    Vocabulary -> POSIX
lastModifiedTime :: Data.POSIX
  }
  deriving (Vocabulary -> Vocabulary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Vocabulary -> Vocabulary -> Bool
$c/= :: Vocabulary -> Vocabulary -> Bool
== :: Vocabulary -> Vocabulary -> Bool
$c== :: Vocabulary -> Vocabulary -> Bool
Prelude.Eq, ReadPrec [Vocabulary]
ReadPrec Vocabulary
Int -> ReadS Vocabulary
ReadS [Vocabulary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Vocabulary]
$creadListPrec :: ReadPrec [Vocabulary]
readPrec :: ReadPrec Vocabulary
$creadPrec :: ReadPrec Vocabulary
readList :: ReadS [Vocabulary]
$creadList :: ReadS [Vocabulary]
readsPrec :: Int -> ReadS Vocabulary
$creadsPrec :: Int -> ReadS Vocabulary
Prelude.Read, Int -> Vocabulary -> ShowS
[Vocabulary] -> ShowS
Vocabulary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Vocabulary] -> ShowS
$cshowList :: [Vocabulary] -> ShowS
show :: Vocabulary -> String
$cshow :: Vocabulary -> String
showsPrec :: Int -> Vocabulary -> ShowS
$cshowsPrec :: Int -> Vocabulary -> ShowS
Prelude.Show, forall x. Rep Vocabulary x -> Vocabulary
forall x. Vocabulary -> Rep Vocabulary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Vocabulary x -> Vocabulary
$cfrom :: forall x. Vocabulary -> Rep Vocabulary x
Prelude.Generic)

-- |
-- Create a value of 'Vocabulary' 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:
--
-- 'content', 'vocabulary_content' - The content of the custom vocabulary in plain-text format with a table
-- of values. Each row in the table represents a word or a phrase,
-- described with @Phrase@, @IPA@, @SoundsLike@, and @DisplayAs@ fields.
-- Separate the fields with TAB characters. For more information, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/custom-vocabulary.html#create-vocabulary-table Create a custom vocabulary using a table>.
--
-- 'failureReason', 'vocabulary_failureReason' - The reason why the custom vocabulary was not created.
--
-- 'tags', 'vocabulary_tags' - The tags used to organize, track, or control access for this resource.
-- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
--
-- 'name', 'vocabulary_name' - A unique name of the custom vocabulary.
--
-- 'id', 'vocabulary_id' - The identifier of the custom vocabulary.
--
-- 'arn', 'vocabulary_arn' - The Amazon Resource Name (ARN) of the custom vocabulary.
--
-- 'languageCode', 'vocabulary_languageCode' - The language code of the vocabulary entries. For a list of languages and
-- their corresponding language codes, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/transcribe-whatis.html What is Amazon Transcribe?>
--
-- 'state', 'vocabulary_state' - The current state of the custom vocabulary.
--
-- 'lastModifiedTime', 'vocabulary_lastModifiedTime' - The timestamp when the custom vocabulary was last modified.
newVocabulary ::
  -- | 'name'
  Prelude.Text ->
  -- | 'id'
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  -- | 'languageCode'
  VocabularyLanguageCode ->
  -- | 'state'
  VocabularyState ->
  -- | 'lastModifiedTime'
  Prelude.UTCTime ->
  Vocabulary
newVocabulary :: Text
-> Text
-> Text
-> VocabularyLanguageCode
-> VocabularyState
-> UTCTime
-> Vocabulary
newVocabulary
  Text
pName_
  Text
pId_
  Text
pArn_
  VocabularyLanguageCode
pLanguageCode_
  VocabularyState
pState_
  UTCTime
pLastModifiedTime_ =
    Vocabulary'
      { $sel:content:Vocabulary' :: Maybe Text
content = forall a. Maybe a
Prelude.Nothing,
        $sel:failureReason:Vocabulary' :: Maybe Text
failureReason = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:Vocabulary' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:name:Vocabulary' :: Text
name = Text
pName_,
        $sel:id:Vocabulary' :: Text
id = Text
pId_,
        $sel:arn:Vocabulary' :: Text
arn = Text
pArn_,
        $sel:languageCode:Vocabulary' :: VocabularyLanguageCode
languageCode = VocabularyLanguageCode
pLanguageCode_,
        $sel:state:Vocabulary' :: VocabularyState
state = VocabularyState
pState_,
        $sel:lastModifiedTime:Vocabulary' :: POSIX
lastModifiedTime =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastModifiedTime_
      }

-- | The content of the custom vocabulary in plain-text format with a table
-- of values. Each row in the table represents a word or a phrase,
-- described with @Phrase@, @IPA@, @SoundsLike@, and @DisplayAs@ fields.
-- Separate the fields with TAB characters. For more information, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/custom-vocabulary.html#create-vocabulary-table Create a custom vocabulary using a table>.
vocabulary_content :: Lens.Lens' Vocabulary (Prelude.Maybe Prelude.Text)
vocabulary_content :: Lens' Vocabulary (Maybe Text)
vocabulary_content = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Vocabulary' {Maybe Text
content :: Maybe Text
$sel:content:Vocabulary' :: Vocabulary -> Maybe Text
content} -> Maybe Text
content) (\s :: Vocabulary
s@Vocabulary' {} Maybe Text
a -> Vocabulary
s {$sel:content:Vocabulary' :: Maybe Text
content = Maybe Text
a} :: Vocabulary)

-- | The reason why the custom vocabulary was not created.
vocabulary_failureReason :: Lens.Lens' Vocabulary (Prelude.Maybe Prelude.Text)
vocabulary_failureReason :: Lens' Vocabulary (Maybe Text)
vocabulary_failureReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Vocabulary' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:Vocabulary' :: Vocabulary -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: Vocabulary
s@Vocabulary' {} Maybe Text
a -> Vocabulary
s {$sel:failureReason:Vocabulary' :: Maybe Text
failureReason = Maybe Text
a} :: Vocabulary)

-- | The tags used to organize, track, or control access for this resource.
-- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
vocabulary_tags :: Lens.Lens' Vocabulary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
vocabulary_tags :: Lens' Vocabulary (Maybe (HashMap Text Text))
vocabulary_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Vocabulary' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:Vocabulary' :: Vocabulary -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: Vocabulary
s@Vocabulary' {} Maybe (HashMap Text Text)
a -> Vocabulary
s {$sel:tags:Vocabulary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: Vocabulary) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A unique name of the custom vocabulary.
vocabulary_name :: Lens.Lens' Vocabulary Prelude.Text
vocabulary_name :: Lens' Vocabulary Text
vocabulary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Vocabulary' {Text
name :: Text
$sel:name:Vocabulary' :: Vocabulary -> Text
name} -> Text
name) (\s :: Vocabulary
s@Vocabulary' {} Text
a -> Vocabulary
s {$sel:name:Vocabulary' :: Text
name = Text
a} :: Vocabulary)

-- | The identifier of the custom vocabulary.
vocabulary_id :: Lens.Lens' Vocabulary Prelude.Text
vocabulary_id :: Lens' Vocabulary Text
vocabulary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Vocabulary' {Text
id :: Text
$sel:id:Vocabulary' :: Vocabulary -> Text
id} -> Text
id) (\s :: Vocabulary
s@Vocabulary' {} Text
a -> Vocabulary
s {$sel:id:Vocabulary' :: Text
id = Text
a} :: Vocabulary)

-- | The Amazon Resource Name (ARN) of the custom vocabulary.
vocabulary_arn :: Lens.Lens' Vocabulary Prelude.Text
vocabulary_arn :: Lens' Vocabulary Text
vocabulary_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Vocabulary' {Text
arn :: Text
$sel:arn:Vocabulary' :: Vocabulary -> Text
arn} -> Text
arn) (\s :: Vocabulary
s@Vocabulary' {} Text
a -> Vocabulary
s {$sel:arn:Vocabulary' :: Text
arn = Text
a} :: Vocabulary)

-- | The language code of the vocabulary entries. For a list of languages and
-- their corresponding language codes, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/transcribe-whatis.html What is Amazon Transcribe?>
vocabulary_languageCode :: Lens.Lens' Vocabulary VocabularyLanguageCode
vocabulary_languageCode :: Lens' Vocabulary VocabularyLanguageCode
vocabulary_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Vocabulary' {VocabularyLanguageCode
languageCode :: VocabularyLanguageCode
$sel:languageCode:Vocabulary' :: Vocabulary -> VocabularyLanguageCode
languageCode} -> VocabularyLanguageCode
languageCode) (\s :: Vocabulary
s@Vocabulary' {} VocabularyLanguageCode
a -> Vocabulary
s {$sel:languageCode:Vocabulary' :: VocabularyLanguageCode
languageCode = VocabularyLanguageCode
a} :: Vocabulary)

-- | The current state of the custom vocabulary.
vocabulary_state :: Lens.Lens' Vocabulary VocabularyState
vocabulary_state :: Lens' Vocabulary VocabularyState
vocabulary_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Vocabulary' {VocabularyState
state :: VocabularyState
$sel:state:Vocabulary' :: Vocabulary -> VocabularyState
state} -> VocabularyState
state) (\s :: Vocabulary
s@Vocabulary' {} VocabularyState
a -> Vocabulary
s {$sel:state:Vocabulary' :: VocabularyState
state = VocabularyState
a} :: Vocabulary)

-- | The timestamp when the custom vocabulary was last modified.
vocabulary_lastModifiedTime :: Lens.Lens' Vocabulary Prelude.UTCTime
vocabulary_lastModifiedTime :: Lens' Vocabulary UTCTime
vocabulary_lastModifiedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Vocabulary' {POSIX
lastModifiedTime :: POSIX
$sel:lastModifiedTime:Vocabulary' :: Vocabulary -> POSIX
lastModifiedTime} -> POSIX
lastModifiedTime) (\s :: Vocabulary
s@Vocabulary' {} POSIX
a -> Vocabulary
s {$sel:lastModifiedTime:Vocabulary' :: POSIX
lastModifiedTime = POSIX
a} :: Vocabulary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON Vocabulary where
  parseJSON :: Value -> Parser Vocabulary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Vocabulary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Text
-> VocabularyLanguageCode
-> VocabularyState
-> POSIX
-> Vocabulary
Vocabulary'
            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
"Content")
            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
"FailureReason")
            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
"Tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"Name")
            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
"Id")
            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
"Arn")
            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
"LanguageCode")
            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
"State")
            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
"LastModifiedTime")
      )

instance Prelude.Hashable Vocabulary where
  hashWithSalt :: Int -> Vocabulary -> Int
hashWithSalt Int
_salt Vocabulary' {Maybe Text
Maybe (HashMap Text Text)
Text
POSIX
VocabularyLanguageCode
VocabularyState
lastModifiedTime :: POSIX
state :: VocabularyState
languageCode :: VocabularyLanguageCode
arn :: Text
id :: Text
name :: Text
tags :: Maybe (HashMap Text Text)
failureReason :: Maybe Text
content :: Maybe Text
$sel:lastModifiedTime:Vocabulary' :: Vocabulary -> POSIX
$sel:state:Vocabulary' :: Vocabulary -> VocabularyState
$sel:languageCode:Vocabulary' :: Vocabulary -> VocabularyLanguageCode
$sel:arn:Vocabulary' :: Vocabulary -> Text
$sel:id:Vocabulary' :: Vocabulary -> Text
$sel:name:Vocabulary' :: Vocabulary -> Text
$sel:tags:Vocabulary' :: Vocabulary -> Maybe (HashMap Text Text)
$sel:failureReason:Vocabulary' :: Vocabulary -> Maybe Text
$sel:content:Vocabulary' :: Vocabulary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
content
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
failureReason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` VocabularyLanguageCode
languageCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` VocabularyState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
lastModifiedTime

instance Prelude.NFData Vocabulary where
  rnf :: Vocabulary -> ()
rnf Vocabulary' {Maybe Text
Maybe (HashMap Text Text)
Text
POSIX
VocabularyLanguageCode
VocabularyState
lastModifiedTime :: POSIX
state :: VocabularyState
languageCode :: VocabularyLanguageCode
arn :: Text
id :: Text
name :: Text
tags :: Maybe (HashMap Text Text)
failureReason :: Maybe Text
content :: Maybe Text
$sel:lastModifiedTime:Vocabulary' :: Vocabulary -> POSIX
$sel:state:Vocabulary' :: Vocabulary -> VocabularyState
$sel:languageCode:Vocabulary' :: Vocabulary -> VocabularyLanguageCode
$sel:arn:Vocabulary' :: Vocabulary -> Text
$sel:id:Vocabulary' :: Vocabulary -> Text
$sel:name:Vocabulary' :: Vocabulary -> Text
$sel:tags:Vocabulary' :: Vocabulary -> Maybe (HashMap Text Text)
$sel:failureReason:Vocabulary' :: Vocabulary -> Maybe Text
$sel:content:Vocabulary' :: Vocabulary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
content
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
failureReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf VocabularyLanguageCode
languageCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf VocabularyState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
lastModifiedTime