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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | 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,
    -- | Total size of the lexicon, in characters.
    LexiconAttributes -> Maybe Int
size :: Prelude.Maybe Prelude.Int,
    -- | 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,
    -- | Phonetic alphabet used in the lexicon. Valid values are @ipa@ and
    -- @x-sampa@.
    LexiconAttributes -> Maybe Text
alphabet :: Prelude.Maybe Prelude.Text,
    -- | Date lexicon was last modified (a timestamp value).
    LexiconAttributes -> Maybe POSIX
lastModified :: Prelude.Maybe Core.POSIX
  }
  deriving (LexiconAttributes -> LexiconAttributes -> Bool
(LexiconAttributes -> LexiconAttributes -> Bool)
-> (LexiconAttributes -> LexiconAttributes -> Bool)
-> Eq LexiconAttributes
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]
(Int -> ReadS LexiconAttributes)
-> ReadS [LexiconAttributes]
-> ReadPrec LexiconAttributes
-> ReadPrec [LexiconAttributes]
-> Read 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
(Int -> LexiconAttributes -> ShowS)
-> (LexiconAttributes -> String)
-> ([LexiconAttributes] -> ShowS)
-> Show LexiconAttributes
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. LexiconAttributes -> Rep LexiconAttributes x)
-> (forall x. Rep LexiconAttributes x -> LexiconAttributes)
-> Generic LexiconAttributes
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:
--
-- '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.
--
-- 'size', 'lexiconAttributes_size' - Total size of the lexicon, in characters.
--
-- 'lexemesCount', 'lexiconAttributes_lexemesCount' - Number of lexemes in the lexicon.
--
-- 'lexiconArn', 'lexiconAttributes_lexiconArn' - Amazon Resource Name (ARN) of the lexicon.
--
-- 'alphabet', 'lexiconAttributes_alphabet' - Phonetic alphabet used in the lexicon. Valid values are @ipa@ and
-- @x-sampa@.
--
-- 'lastModified', 'lexiconAttributes_lastModified' - Date lexicon was last modified (a timestamp value).
newLexiconAttributes ::
  LexiconAttributes
newLexiconAttributes :: LexiconAttributes
newLexiconAttributes =
  LexiconAttributes' :: Maybe LanguageCode
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> LexiconAttributes
LexiconAttributes'
    { $sel:languageCode:LexiconAttributes' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
forall a. Maybe a
Prelude.Nothing,
      $sel:size:LexiconAttributes' :: Maybe Int
size = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:lexemesCount:LexiconAttributes' :: Maybe Int
lexemesCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:lexiconArn:LexiconAttributes' :: Maybe Text
lexiconArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:alphabet:LexiconAttributes' :: Maybe Text
alphabet = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModified:LexiconAttributes' :: Maybe POSIX
lastModified = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe LanguageCode -> f (Maybe LanguageCode))
-> LexiconAttributes -> f LexiconAttributes
lexiconAttributes_languageCode = (LexiconAttributes -> Maybe LanguageCode)
-> (LexiconAttributes -> Maybe LanguageCode -> LexiconAttributes)
-> Lens
     LexiconAttributes
     LexiconAttributes
     (Maybe LanguageCode)
     (Maybe 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)

-- | Total size of the lexicon, in characters.
lexiconAttributes_size :: Lens.Lens' LexiconAttributes (Prelude.Maybe Prelude.Int)
lexiconAttributes_size :: (Maybe Int -> f (Maybe Int))
-> LexiconAttributes -> f LexiconAttributes
lexiconAttributes_size = (LexiconAttributes -> Maybe Int)
-> (LexiconAttributes -> Maybe Int -> LexiconAttributes)
-> Lens LexiconAttributes LexiconAttributes (Maybe Int) (Maybe Int)
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)

-- | Number of lexemes in the lexicon.
lexiconAttributes_lexemesCount :: Lens.Lens' LexiconAttributes (Prelude.Maybe Prelude.Int)
lexiconAttributes_lexemesCount :: (Maybe Int -> f (Maybe Int))
-> LexiconAttributes -> f LexiconAttributes
lexiconAttributes_lexemesCount = (LexiconAttributes -> Maybe Int)
-> (LexiconAttributes -> Maybe Int -> LexiconAttributes)
-> Lens LexiconAttributes LexiconAttributes (Maybe Int) (Maybe Int)
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 :: (Maybe Text -> f (Maybe Text))
-> LexiconAttributes -> f LexiconAttributes
lexiconAttributes_lexiconArn = (LexiconAttributes -> Maybe Text)
-> (LexiconAttributes -> Maybe Text -> LexiconAttributes)
-> Lens
     LexiconAttributes LexiconAttributes (Maybe Text) (Maybe Text)
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)

-- | Phonetic alphabet used in the lexicon. Valid values are @ipa@ and
-- @x-sampa@.
lexiconAttributes_alphabet :: Lens.Lens' LexiconAttributes (Prelude.Maybe Prelude.Text)
lexiconAttributes_alphabet :: (Maybe Text -> f (Maybe Text))
-> LexiconAttributes -> f LexiconAttributes
lexiconAttributes_alphabet = (LexiconAttributes -> Maybe Text)
-> (LexiconAttributes -> Maybe Text -> LexiconAttributes)
-> Lens
     LexiconAttributes LexiconAttributes (Maybe Text) (Maybe Text)
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)

-- | Date lexicon was last modified (a timestamp value).
lexiconAttributes_lastModified :: Lens.Lens' LexiconAttributes (Prelude.Maybe Prelude.UTCTime)
lexiconAttributes_lastModified :: (Maybe UTCTime -> f (Maybe UTCTime))
-> LexiconAttributes -> f LexiconAttributes
lexiconAttributes_lastModified = (LexiconAttributes -> Maybe POSIX)
-> (LexiconAttributes -> Maybe POSIX -> LexiconAttributes)
-> Lens
     LexiconAttributes LexiconAttributes (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> LexiconAttributes -> f LexiconAttributes)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> LexiconAttributes
-> f LexiconAttributes
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

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

instance Prelude.Hashable LexiconAttributes

instance Prelude.NFData LexiconAttributes