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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Configuration information of an Amazon Lex bot.
--
-- /See:/ 'newLexBot' smart constructor.
data LexBot = LexBot'
  { -- | The Region that the Amazon Lex bot was created in.
    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
(LexBot -> LexBot -> Bool)
-> (LexBot -> LexBot -> Bool) -> Eq LexBot
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]
(Int -> ReadS LexBot)
-> ReadS [LexBot]
-> ReadPrec LexBot
-> ReadPrec [LexBot]
-> Read 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
(Int -> LexBot -> ShowS)
-> (LexBot -> String) -> ([LexBot] -> ShowS) -> Show LexBot
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. LexBot -> Rep LexBot x)
-> (forall x. Rep LexBot x -> LexBot) -> Generic LexBot
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 Region that the Amazon Lex bot was created in.
--
-- 'name', 'lexBot_name' - The name of the Amazon Lex bot.
newLexBot ::
  LexBot
newLexBot :: LexBot
newLexBot =
  LexBot' :: Maybe Text -> Maybe Text -> LexBot
LexBot'
    { $sel:lexRegion:LexBot' :: Maybe Text
lexRegion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:LexBot' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Region that the Amazon Lex bot was created in.
lexBot_lexRegion :: Lens.Lens' LexBot (Prelude.Maybe Prelude.Text)
lexBot_lexRegion :: (Maybe Text -> f (Maybe Text)) -> LexBot -> f LexBot
lexBot_lexRegion = (LexBot -> Maybe Text)
-> (LexBot -> Maybe Text -> LexBot)
-> Lens LexBot LexBot (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> LexBot -> f LexBot
lexBot_name = (LexBot -> Maybe Text)
-> (LexBot -> Maybe Text -> LexBot)
-> Lens LexBot LexBot (Maybe Text) (Maybe Text)
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 Core.FromJSON LexBot where
  parseJSON :: Value -> Parser LexBot
parseJSON =
    String -> (Object -> Parser LexBot) -> Value -> Parser LexBot
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LexBot"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> LexBot
LexBot'
            (Maybe Text -> Maybe Text -> LexBot)
-> Parser (Maybe Text) -> Parser (Maybe Text -> LexBot)
forall (f :: * -> *) a b. Functor 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
"LexRegion")
            Parser (Maybe Text -> LexBot)
-> Parser (Maybe Text) -> Parser LexBot
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 LexBot

instance Prelude.NFData LexBot

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"LexRegion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
lexRegion,
            (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name
          ]
      )