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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Polly.Types.LanguageCode
import qualified Amazonka.Prelude as Prelude

-- | Contains metadata describing the lexicon such as the number of lexemes,
-- language code, and so on. For more information, see
-- <https://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html Managing Lexicons>.
--
-- /See:/ 'newLexiconAttributes' smart constructor.
data LexiconAttributes = LexiconAttributes'
  { -- | Phonetic alphabet used in the lexicon. Valid values are @ipa@ and
    -- @x-sampa@.
    LexiconAttributes -> Maybe Text
alphabet :: Prelude.Maybe Prelude.Text,
    -- | Language code that the lexicon applies to. A lexicon with a language
    -- code such as \"en\" would be applied to all English languages (en-GB,
    -- en-US, en-AUS, en-WLS, and so on.
    LexiconAttributes -> Maybe LanguageCode
languageCode :: Prelude.Maybe LanguageCode,
    -- | Date lexicon was last modified (a timestamp value).
    LexiconAttributes -> Maybe POSIX
lastModified :: Prelude.Maybe Data.POSIX,
    -- | Number of lexemes in the lexicon.
    LexiconAttributes -> Maybe Int
lexemesCount :: Prelude.Maybe Prelude.Int,
    -- | Amazon Resource Name (ARN) of the lexicon.
    LexiconAttributes -> Maybe Text
lexiconArn :: Prelude.Maybe Prelude.Text,
    -- | Total size of the lexicon, in characters.
    LexiconAttributes -> Maybe Int
size :: Prelude.Maybe Prelude.Int
  }
  deriving (LexiconAttributes -> LexiconAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LexiconAttributes -> LexiconAttributes -> Bool
$c/= :: LexiconAttributes -> LexiconAttributes -> Bool
== :: LexiconAttributes -> LexiconAttributes -> Bool
$c== :: LexiconAttributes -> LexiconAttributes -> Bool
Prelude.Eq, ReadPrec [LexiconAttributes]
ReadPrec LexiconAttributes
Int -> ReadS LexiconAttributes
ReadS [LexiconAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LexiconAttributes]
$creadListPrec :: ReadPrec [LexiconAttributes]
readPrec :: ReadPrec LexiconAttributes
$creadPrec :: ReadPrec LexiconAttributes
readList :: ReadS [LexiconAttributes]
$creadList :: ReadS [LexiconAttributes]
readsPrec :: Int -> ReadS LexiconAttributes
$creadsPrec :: Int -> ReadS LexiconAttributes
Prelude.Read, Int -> LexiconAttributes -> ShowS
[LexiconAttributes] -> ShowS
LexiconAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LexiconAttributes] -> ShowS
$cshowList :: [LexiconAttributes] -> ShowS
show :: LexiconAttributes -> String
$cshow :: LexiconAttributes -> String
showsPrec :: Int -> LexiconAttributes -> ShowS
$cshowsPrec :: Int -> LexiconAttributes -> ShowS
Prelude.Show, forall x. Rep LexiconAttributes x -> LexiconAttributes
forall x. LexiconAttributes -> Rep LexiconAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LexiconAttributes x -> LexiconAttributes
$cfrom :: forall x. LexiconAttributes -> Rep LexiconAttributes x
Prelude.Generic)

-- |
-- Create a value of 'LexiconAttributes' 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:
--
-- 'alphabet', 'lexiconAttributes_alphabet' - Phonetic alphabet used in the lexicon. Valid values are @ipa@ and
-- @x-sampa@.
--
-- 'languageCode', 'lexiconAttributes_languageCode' - Language code that the lexicon applies to. A lexicon with a language
-- code such as \"en\" would be applied to all English languages (en-GB,
-- en-US, en-AUS, en-WLS, and so on.
--
-- 'lastModified', 'lexiconAttributes_lastModified' - Date lexicon was last modified (a timestamp value).
--
-- 'lexemesCount', 'lexiconAttributes_lexemesCount' - Number of lexemes in the lexicon.
--
-- 'lexiconArn', 'lexiconAttributes_lexiconArn' - Amazon Resource Name (ARN) of the lexicon.
--
-- 'size', 'lexiconAttributes_size' - Total size of the lexicon, in characters.
newLexiconAttributes ::
  LexiconAttributes
newLexiconAttributes :: LexiconAttributes
newLexiconAttributes =
  LexiconAttributes'
    { $sel:alphabet:LexiconAttributes' :: Maybe Text
alphabet = forall a. Maybe a
Prelude.Nothing,
      $sel:languageCode:LexiconAttributes' :: Maybe LanguageCode
languageCode = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModified:LexiconAttributes' :: Maybe POSIX
lastModified = forall a. Maybe a
Prelude.Nothing,
      $sel:lexemesCount:LexiconAttributes' :: Maybe Int
lexemesCount = forall a. Maybe a
Prelude.Nothing,
      $sel:lexiconArn:LexiconAttributes' :: Maybe Text
lexiconArn = forall a. Maybe a
Prelude.Nothing,
      $sel:size:LexiconAttributes' :: Maybe Int
size = forall a. Maybe a
Prelude.Nothing
    }

-- | Phonetic alphabet used in the lexicon. Valid values are @ipa@ and
-- @x-sampa@.
lexiconAttributes_alphabet :: Lens.Lens' LexiconAttributes (Prelude.Maybe Prelude.Text)
lexiconAttributes_alphabet :: Lens' LexiconAttributes (Maybe Text)
lexiconAttributes_alphabet = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LexiconAttributes' {Maybe Text
alphabet :: Maybe Text
$sel:alphabet:LexiconAttributes' :: LexiconAttributes -> Maybe Text
alphabet} -> Maybe Text
alphabet) (\s :: LexiconAttributes
s@LexiconAttributes' {} Maybe Text
a -> LexiconAttributes
s {$sel:alphabet:LexiconAttributes' :: Maybe Text
alphabet = Maybe Text
a} :: LexiconAttributes)

-- | Language code that the lexicon applies to. A lexicon with a language
-- code such as \"en\" would be applied to all English languages (en-GB,
-- en-US, en-AUS, en-WLS, and so on.
lexiconAttributes_languageCode :: Lens.Lens' LexiconAttributes (Prelude.Maybe LanguageCode)
lexiconAttributes_languageCode :: Lens' LexiconAttributes (Maybe LanguageCode)
lexiconAttributes_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LexiconAttributes' {Maybe LanguageCode
languageCode :: Maybe LanguageCode
$sel:languageCode:LexiconAttributes' :: LexiconAttributes -> Maybe LanguageCode
languageCode} -> Maybe LanguageCode
languageCode) (\s :: LexiconAttributes
s@LexiconAttributes' {} Maybe LanguageCode
a -> LexiconAttributes
s {$sel:languageCode:LexiconAttributes' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
a} :: LexiconAttributes)

-- | Date lexicon was last modified (a timestamp value).
lexiconAttributes_lastModified :: Lens.Lens' LexiconAttributes (Prelude.Maybe Prelude.UTCTime)
lexiconAttributes_lastModified :: Lens' LexiconAttributes (Maybe UTCTime)
lexiconAttributes_lastModified = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LexiconAttributes' {Maybe POSIX
lastModified :: Maybe POSIX
$sel:lastModified:LexiconAttributes' :: LexiconAttributes -> Maybe POSIX
lastModified} -> Maybe POSIX
lastModified) (\s :: LexiconAttributes
s@LexiconAttributes' {} Maybe POSIX
a -> LexiconAttributes
s {$sel:lastModified:LexiconAttributes' :: Maybe POSIX
lastModified = Maybe POSIX
a} :: LexiconAttributes) 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

-- | Number of lexemes in the lexicon.
lexiconAttributes_lexemesCount :: Lens.Lens' LexiconAttributes (Prelude.Maybe Prelude.Int)
lexiconAttributes_lexemesCount :: Lens' LexiconAttributes (Maybe Int)
lexiconAttributes_lexemesCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LexiconAttributes' {Maybe Int
lexemesCount :: Maybe Int
$sel:lexemesCount:LexiconAttributes' :: LexiconAttributes -> Maybe Int
lexemesCount} -> Maybe Int
lexemesCount) (\s :: LexiconAttributes
s@LexiconAttributes' {} Maybe Int
a -> LexiconAttributes
s {$sel:lexemesCount:LexiconAttributes' :: Maybe Int
lexemesCount = Maybe Int
a} :: LexiconAttributes)

-- | Amazon Resource Name (ARN) of the lexicon.
lexiconAttributes_lexiconArn :: Lens.Lens' LexiconAttributes (Prelude.Maybe Prelude.Text)
lexiconAttributes_lexiconArn :: Lens' LexiconAttributes (Maybe Text)
lexiconAttributes_lexiconArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LexiconAttributes' {Maybe Text
lexiconArn :: Maybe Text
$sel:lexiconArn:LexiconAttributes' :: LexiconAttributes -> Maybe Text
lexiconArn} -> Maybe Text
lexiconArn) (\s :: LexiconAttributes
s@LexiconAttributes' {} Maybe Text
a -> LexiconAttributes
s {$sel:lexiconArn:LexiconAttributes' :: Maybe Text
lexiconArn = Maybe Text
a} :: LexiconAttributes)

-- | Total size of the lexicon, in characters.
lexiconAttributes_size :: Lens.Lens' LexiconAttributes (Prelude.Maybe Prelude.Int)
lexiconAttributes_size :: Lens' LexiconAttributes (Maybe Int)
lexiconAttributes_size = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LexiconAttributes' {Maybe Int
size :: Maybe Int
$sel:size:LexiconAttributes' :: LexiconAttributes -> Maybe Int
size} -> Maybe Int
size) (\s :: LexiconAttributes
s@LexiconAttributes' {} Maybe Int
a -> LexiconAttributes
s {$sel:size:LexiconAttributes' :: Maybe Int
size = Maybe Int
a} :: LexiconAttributes)

instance Data.FromJSON LexiconAttributes where
  parseJSON :: Value -> Parser LexiconAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LexiconAttributes"
      ( \Object
x ->
          Maybe Text
-> Maybe LanguageCode
-> Maybe POSIX
-> Maybe Int
-> Maybe Text
-> Maybe Int
-> LexiconAttributes
LexiconAttributes'
            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
"Alphabet")
            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
"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
"LastModified")
            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
"LexemesCount")
            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
"LexiconArn")
            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
"Size")
      )

instance Prelude.Hashable LexiconAttributes where
  hashWithSalt :: Int -> LexiconAttributes -> Int
hashWithSalt Int
_salt LexiconAttributes' {Maybe Int
Maybe Text
Maybe POSIX
Maybe LanguageCode
size :: Maybe Int
lexiconArn :: Maybe Text
lexemesCount :: Maybe Int
lastModified :: Maybe POSIX
languageCode :: Maybe LanguageCode
alphabet :: Maybe Text
$sel:size:LexiconAttributes' :: LexiconAttributes -> Maybe Int
$sel:lexiconArn:LexiconAttributes' :: LexiconAttributes -> Maybe Text
$sel:lexemesCount:LexiconAttributes' :: LexiconAttributes -> Maybe Int
$sel:lastModified:LexiconAttributes' :: LexiconAttributes -> Maybe POSIX
$sel:languageCode:LexiconAttributes' :: LexiconAttributes -> Maybe LanguageCode
$sel:alphabet:LexiconAttributes' :: LexiconAttributes -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
alphabet
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LanguageCode
languageCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModified
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
lexemesCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lexiconArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
size

instance Prelude.NFData LexiconAttributes where
  rnf :: LexiconAttributes -> ()
rnf LexiconAttributes' {Maybe Int
Maybe Text
Maybe POSIX
Maybe LanguageCode
size :: Maybe Int
lexiconArn :: Maybe Text
lexemesCount :: Maybe Int
lastModified :: Maybe POSIX
languageCode :: Maybe LanguageCode
alphabet :: Maybe Text
$sel:size:LexiconAttributes' :: LexiconAttributes -> Maybe Int
$sel:lexiconArn:LexiconAttributes' :: LexiconAttributes -> Maybe Text
$sel:lexemesCount:LexiconAttributes' :: LexiconAttributes -> Maybe Int
$sel:lastModified:LexiconAttributes' :: LexiconAttributes -> Maybe POSIX
$sel:languageCode:LexiconAttributes' :: LexiconAttributes -> Maybe LanguageCode
$sel:alphabet:LexiconAttributes' :: LexiconAttributes -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
alphabet
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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
lastModified
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
lexemesCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lexiconArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
size