{-# 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.LexiconDescription
-- 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.LexiconDescription where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Polly.Types.LexiconAttributes
import qualified Amazonka.Prelude as Prelude

-- | Describes the content of the lexicon.
--
-- /See:/ 'newLexiconDescription' smart constructor.
data LexiconDescription = LexiconDescription'
  { -- | Provides lexicon metadata.
    LexiconDescription -> Maybe LexiconAttributes
attributes :: Prelude.Maybe LexiconAttributes,
    -- | Name of the lexicon.
    LexiconDescription -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (LexiconDescription -> LexiconDescription -> Bool
(LexiconDescription -> LexiconDescription -> Bool)
-> (LexiconDescription -> LexiconDescription -> Bool)
-> Eq LexiconDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LexiconDescription -> LexiconDescription -> Bool
$c/= :: LexiconDescription -> LexiconDescription -> Bool
== :: LexiconDescription -> LexiconDescription -> Bool
$c== :: LexiconDescription -> LexiconDescription -> Bool
Prelude.Eq, ReadPrec [LexiconDescription]
ReadPrec LexiconDescription
Int -> ReadS LexiconDescription
ReadS [LexiconDescription]
(Int -> ReadS LexiconDescription)
-> ReadS [LexiconDescription]
-> ReadPrec LexiconDescription
-> ReadPrec [LexiconDescription]
-> Read LexiconDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LexiconDescription]
$creadListPrec :: ReadPrec [LexiconDescription]
readPrec :: ReadPrec LexiconDescription
$creadPrec :: ReadPrec LexiconDescription
readList :: ReadS [LexiconDescription]
$creadList :: ReadS [LexiconDescription]
readsPrec :: Int -> ReadS LexiconDescription
$creadsPrec :: Int -> ReadS LexiconDescription
Prelude.Read, Int -> LexiconDescription -> ShowS
[LexiconDescription] -> ShowS
LexiconDescription -> String
(Int -> LexiconDescription -> ShowS)
-> (LexiconDescription -> String)
-> ([LexiconDescription] -> ShowS)
-> Show LexiconDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LexiconDescription] -> ShowS
$cshowList :: [LexiconDescription] -> ShowS
show :: LexiconDescription -> String
$cshow :: LexiconDescription -> String
showsPrec :: Int -> LexiconDescription -> ShowS
$cshowsPrec :: Int -> LexiconDescription -> ShowS
Prelude.Show, (forall x. LexiconDescription -> Rep LexiconDescription x)
-> (forall x. Rep LexiconDescription x -> LexiconDescription)
-> Generic LexiconDescription
forall x. Rep LexiconDescription x -> LexiconDescription
forall x. LexiconDescription -> Rep LexiconDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LexiconDescription x -> LexiconDescription
$cfrom :: forall x. LexiconDescription -> Rep LexiconDescription x
Prelude.Generic)

-- |
-- Create a value of 'LexiconDescription' 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:
--
-- 'attributes', 'lexiconDescription_attributes' - Provides lexicon metadata.
--
-- 'name', 'lexiconDescription_name' - Name of the lexicon.
newLexiconDescription ::
  LexiconDescription
newLexiconDescription :: LexiconDescription
newLexiconDescription =
  LexiconDescription' :: Maybe LexiconAttributes -> Maybe Text -> LexiconDescription
LexiconDescription'
    { $sel:attributes:LexiconDescription' :: Maybe LexiconAttributes
attributes = Maybe LexiconAttributes
forall a. Maybe a
Prelude.Nothing,
      $sel:name:LexiconDescription' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Provides lexicon metadata.
lexiconDescription_attributes :: Lens.Lens' LexiconDescription (Prelude.Maybe LexiconAttributes)
lexiconDescription_attributes :: (Maybe LexiconAttributes -> f (Maybe LexiconAttributes))
-> LexiconDescription -> f LexiconDescription
lexiconDescription_attributes = (LexiconDescription -> Maybe LexiconAttributes)
-> (LexiconDescription
    -> Maybe LexiconAttributes -> LexiconDescription)
-> Lens
     LexiconDescription
     LexiconDescription
     (Maybe LexiconAttributes)
     (Maybe LexiconAttributes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LexiconDescription' {Maybe LexiconAttributes
attributes :: Maybe LexiconAttributes
$sel:attributes:LexiconDescription' :: LexiconDescription -> Maybe LexiconAttributes
attributes} -> Maybe LexiconAttributes
attributes) (\s :: LexiconDescription
s@LexiconDescription' {} Maybe LexiconAttributes
a -> LexiconDescription
s {$sel:attributes:LexiconDescription' :: Maybe LexiconAttributes
attributes = Maybe LexiconAttributes
a} :: LexiconDescription)

-- | Name of the lexicon.
lexiconDescription_name :: Lens.Lens' LexiconDescription (Prelude.Maybe Prelude.Text)
lexiconDescription_name :: (Maybe Text -> f (Maybe Text))
-> LexiconDescription -> f LexiconDescription
lexiconDescription_name = (LexiconDescription -> Maybe Text)
-> (LexiconDescription -> Maybe Text -> LexiconDescription)
-> Lens
     LexiconDescription LexiconDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LexiconDescription' {Maybe Text
name :: Maybe Text
$sel:name:LexiconDescription' :: LexiconDescription -> Maybe Text
name} -> Maybe Text
name) (\s :: LexiconDescription
s@LexiconDescription' {} Maybe Text
a -> LexiconDescription
s {$sel:name:LexiconDescription' :: Maybe Text
name = Maybe Text
a} :: LexiconDescription)

instance Core.FromJSON LexiconDescription where
  parseJSON :: Value -> Parser LexiconDescription
parseJSON =
    String
-> (Object -> Parser LexiconDescription)
-> Value
-> Parser LexiconDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LexiconDescription"
      ( \Object
x ->
          Maybe LexiconAttributes -> Maybe Text -> LexiconDescription
LexiconDescription'
            (Maybe LexiconAttributes -> Maybe Text -> LexiconDescription)
-> Parser (Maybe LexiconAttributes)
-> Parser (Maybe Text -> LexiconDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LexiconAttributes)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Attributes")
            Parser (Maybe Text -> LexiconDescription)
-> Parser (Maybe Text) -> Parser LexiconDescription
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
"Name")
      )

instance Prelude.Hashable LexiconDescription

instance Prelude.NFData LexiconDescription