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

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

-- | Configuration information of an Amazon Lex bot.
--
-- /See:/ 'newLexBot' smart constructor.
data LexBot = LexBot'
  { -- | The Amazon Web Services Region where the Amazon Lex bot was created.
    LexBot -> Maybe Text
lexRegion :: Prelude.Maybe Prelude.Text,
    -- | The name of the Amazon Lex bot.
    LexBot -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (LexBot -> LexBot -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LexBot -> LexBot -> Bool
$c/= :: LexBot -> LexBot -> Bool
== :: LexBot -> LexBot -> Bool
$c== :: LexBot -> LexBot -> Bool
Prelude.Eq, ReadPrec [LexBot]
ReadPrec LexBot
Int -> ReadS LexBot
ReadS [LexBot]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LexBot]
$creadListPrec :: ReadPrec [LexBot]
readPrec :: ReadPrec LexBot
$creadPrec :: ReadPrec LexBot
readList :: ReadS [LexBot]
$creadList :: ReadS [LexBot]
readsPrec :: Int -> ReadS LexBot
$creadsPrec :: Int -> ReadS LexBot
Prelude.Read, Int -> LexBot -> ShowS
[LexBot] -> ShowS
LexBot -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LexBot] -> ShowS
$cshowList :: [LexBot] -> ShowS
show :: LexBot -> String
$cshow :: LexBot -> String
showsPrec :: Int -> LexBot -> ShowS
$cshowsPrec :: Int -> LexBot -> ShowS
Prelude.Show, forall x. Rep LexBot x -> LexBot
forall x. LexBot -> Rep LexBot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LexBot x -> LexBot
$cfrom :: forall x. LexBot -> Rep LexBot x
Prelude.Generic)

-- |
-- Create a value of 'LexBot' 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:
--
-- 'lexRegion', 'lexBot_lexRegion' - The Amazon Web Services Region where the Amazon Lex bot was created.
--
-- 'name', 'lexBot_name' - The name of the Amazon Lex bot.
newLexBot ::
  LexBot
newLexBot :: LexBot
newLexBot =
  LexBot'
    { $sel:lexRegion:LexBot' :: Maybe Text
lexRegion = forall a. Maybe a
Prelude.Nothing,
      $sel:name:LexBot' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services Region where the Amazon Lex bot was created.
lexBot_lexRegion :: Lens.Lens' LexBot (Prelude.Maybe Prelude.Text)
lexBot_lexRegion :: Lens' LexBot (Maybe Text)
lexBot_lexRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LexBot' {Maybe Text
lexRegion :: Maybe Text
$sel:lexRegion:LexBot' :: LexBot -> Maybe Text
lexRegion} -> Maybe Text
lexRegion) (\s :: LexBot
s@LexBot' {} Maybe Text
a -> LexBot
s {$sel:lexRegion:LexBot' :: Maybe Text
lexRegion = Maybe Text
a} :: LexBot)

-- | The name of the Amazon Lex bot.
lexBot_name :: Lens.Lens' LexBot (Prelude.Maybe Prelude.Text)
lexBot_name :: Lens' LexBot (Maybe Text)
lexBot_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LexBot' {Maybe Text
name :: Maybe Text
$sel:name:LexBot' :: LexBot -> Maybe Text
name} -> Maybe Text
name) (\s :: LexBot
s@LexBot' {} Maybe Text
a -> LexBot
s {$sel:name:LexBot' :: Maybe Text
name = Maybe Text
a} :: LexBot)

instance Data.FromJSON LexBot where
  parseJSON :: Value -> Parser LexBot
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LexBot"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> LexBot
LexBot'
            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
"LexRegion")
            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
"Name")
      )

instance Prelude.Hashable LexBot where
  hashWithSalt :: Int -> LexBot -> Int
hashWithSalt Int
_salt LexBot' {Maybe Text
name :: Maybe Text
lexRegion :: Maybe Text
$sel:name:LexBot' :: LexBot -> Maybe Text
$sel:lexRegion:LexBot' :: LexBot -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lexRegion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name

instance Prelude.NFData LexBot where
  rnf :: LexBot -> ()
rnf LexBot' {Maybe Text
name :: Maybe Text
lexRegion :: Maybe Text
$sel:name:LexBot' :: LexBot -> Maybe Text
$sel:lexRegion:LexBot' :: LexBot -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lexRegion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name

instance Data.ToJSON LexBot where
  toJSON :: LexBot -> Value
toJSON LexBot' {Maybe Text
name :: Maybe Text
lexRegion :: Maybe Text
$sel:name:LexBot' :: LexBot -> Maybe Text
$sel:lexRegion:LexBot' :: LexBot -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"LexRegion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
lexRegion,
            (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name
          ]
      )