{-# 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.LexModels.Types.BotMetadata
-- 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.LexModels.Types.BotMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexModels.Types.LexStatus
import qualified Amazonka.Prelude as Prelude

-- | Provides information about a bot. .
--
-- /See:/ 'newBotMetadata' smart constructor.
data BotMetadata = BotMetadata'
  { -- | The status of the bot.
    BotMetadata -> Maybe LexStatus
status :: Prelude.Maybe LexStatus,
    -- | The date that the bot was created.
    BotMetadata -> Maybe POSIX
createdDate :: Prelude.Maybe Core.POSIX,
    -- | The name of the bot.
    BotMetadata -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The version of the bot. For a new bot, the version is always @$LATEST@.
    BotMetadata -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The date that the bot was updated. When you create a bot, the creation
    -- date and last updated date are the same.
    BotMetadata -> Maybe POSIX
lastUpdatedDate :: Prelude.Maybe Core.POSIX,
    -- | A description of the bot.
    BotMetadata -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (BotMetadata -> BotMetadata -> Bool
(BotMetadata -> BotMetadata -> Bool)
-> (BotMetadata -> BotMetadata -> Bool) -> Eq BotMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BotMetadata -> BotMetadata -> Bool
$c/= :: BotMetadata -> BotMetadata -> Bool
== :: BotMetadata -> BotMetadata -> Bool
$c== :: BotMetadata -> BotMetadata -> Bool
Prelude.Eq, ReadPrec [BotMetadata]
ReadPrec BotMetadata
Int -> ReadS BotMetadata
ReadS [BotMetadata]
(Int -> ReadS BotMetadata)
-> ReadS [BotMetadata]
-> ReadPrec BotMetadata
-> ReadPrec [BotMetadata]
-> Read BotMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BotMetadata]
$creadListPrec :: ReadPrec [BotMetadata]
readPrec :: ReadPrec BotMetadata
$creadPrec :: ReadPrec BotMetadata
readList :: ReadS [BotMetadata]
$creadList :: ReadS [BotMetadata]
readsPrec :: Int -> ReadS BotMetadata
$creadsPrec :: Int -> ReadS BotMetadata
Prelude.Read, Int -> BotMetadata -> ShowS
[BotMetadata] -> ShowS
BotMetadata -> String
(Int -> BotMetadata -> ShowS)
-> (BotMetadata -> String)
-> ([BotMetadata] -> ShowS)
-> Show BotMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BotMetadata] -> ShowS
$cshowList :: [BotMetadata] -> ShowS
show :: BotMetadata -> String
$cshow :: BotMetadata -> String
showsPrec :: Int -> BotMetadata -> ShowS
$cshowsPrec :: Int -> BotMetadata -> ShowS
Prelude.Show, (forall x. BotMetadata -> Rep BotMetadata x)
-> (forall x. Rep BotMetadata x -> BotMetadata)
-> Generic BotMetadata
forall x. Rep BotMetadata x -> BotMetadata
forall x. BotMetadata -> Rep BotMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BotMetadata x -> BotMetadata
$cfrom :: forall x. BotMetadata -> Rep BotMetadata x
Prelude.Generic)

-- |
-- Create a value of 'BotMetadata' 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:
--
-- 'status', 'botMetadata_status' - The status of the bot.
--
-- 'createdDate', 'botMetadata_createdDate' - The date that the bot was created.
--
-- 'name', 'botMetadata_name' - The name of the bot.
--
-- 'version', 'botMetadata_version' - The version of the bot. For a new bot, the version is always @$LATEST@.
--
-- 'lastUpdatedDate', 'botMetadata_lastUpdatedDate' - The date that the bot was updated. When you create a bot, the creation
-- date and last updated date are the same.
--
-- 'description', 'botMetadata_description' - A description of the bot.
newBotMetadata ::
  BotMetadata
newBotMetadata :: BotMetadata
newBotMetadata =
  BotMetadata' :: Maybe LexStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> BotMetadata
BotMetadata'
    { $sel:status:BotMetadata' :: Maybe LexStatus
status = Maybe LexStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:createdDate:BotMetadata' :: Maybe POSIX
createdDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:BotMetadata' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:version:BotMetadata' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDate:BotMetadata' :: Maybe POSIX
lastUpdatedDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:description:BotMetadata' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the bot.
botMetadata_status :: Lens.Lens' BotMetadata (Prelude.Maybe LexStatus)
botMetadata_status :: (Maybe LexStatus -> f (Maybe LexStatus))
-> BotMetadata -> f BotMetadata
botMetadata_status = (BotMetadata -> Maybe LexStatus)
-> (BotMetadata -> Maybe LexStatus -> BotMetadata)
-> Lens BotMetadata BotMetadata (Maybe LexStatus) (Maybe LexStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotMetadata' {Maybe LexStatus
status :: Maybe LexStatus
$sel:status:BotMetadata' :: BotMetadata -> Maybe LexStatus
status} -> Maybe LexStatus
status) (\s :: BotMetadata
s@BotMetadata' {} Maybe LexStatus
a -> BotMetadata
s {$sel:status:BotMetadata' :: Maybe LexStatus
status = Maybe LexStatus
a} :: BotMetadata)

-- | The date that the bot was created.
botMetadata_createdDate :: Lens.Lens' BotMetadata (Prelude.Maybe Prelude.UTCTime)
botMetadata_createdDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> BotMetadata -> f BotMetadata
botMetadata_createdDate = (BotMetadata -> Maybe POSIX)
-> (BotMetadata -> Maybe POSIX -> BotMetadata)
-> Lens BotMetadata BotMetadata (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotMetadata' {Maybe POSIX
createdDate :: Maybe POSIX
$sel:createdDate:BotMetadata' :: BotMetadata -> Maybe POSIX
createdDate} -> Maybe POSIX
createdDate) (\s :: BotMetadata
s@BotMetadata' {} Maybe POSIX
a -> BotMetadata
s {$sel:createdDate:BotMetadata' :: Maybe POSIX
createdDate = Maybe POSIX
a} :: BotMetadata) ((Maybe POSIX -> f (Maybe POSIX)) -> BotMetadata -> f BotMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> BotMetadata
-> f BotMetadata
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

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

-- | The version of the bot. For a new bot, the version is always @$LATEST@.
botMetadata_version :: Lens.Lens' BotMetadata (Prelude.Maybe Prelude.Text)
botMetadata_version :: (Maybe Text -> f (Maybe Text)) -> BotMetadata -> f BotMetadata
botMetadata_version = (BotMetadata -> Maybe Text)
-> (BotMetadata -> Maybe Text -> BotMetadata)
-> Lens BotMetadata BotMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotMetadata' {Maybe Text
version :: Maybe Text
$sel:version:BotMetadata' :: BotMetadata -> Maybe Text
version} -> Maybe Text
version) (\s :: BotMetadata
s@BotMetadata' {} Maybe Text
a -> BotMetadata
s {$sel:version:BotMetadata' :: Maybe Text
version = Maybe Text
a} :: BotMetadata)

-- | The date that the bot was updated. When you create a bot, the creation
-- date and last updated date are the same.
botMetadata_lastUpdatedDate :: Lens.Lens' BotMetadata (Prelude.Maybe Prelude.UTCTime)
botMetadata_lastUpdatedDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> BotMetadata -> f BotMetadata
botMetadata_lastUpdatedDate = (BotMetadata -> Maybe POSIX)
-> (BotMetadata -> Maybe POSIX -> BotMetadata)
-> Lens BotMetadata BotMetadata (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotMetadata' {Maybe POSIX
lastUpdatedDate :: Maybe POSIX
$sel:lastUpdatedDate:BotMetadata' :: BotMetadata -> Maybe POSIX
lastUpdatedDate} -> Maybe POSIX
lastUpdatedDate) (\s :: BotMetadata
s@BotMetadata' {} Maybe POSIX
a -> BotMetadata
s {$sel:lastUpdatedDate:BotMetadata' :: Maybe POSIX
lastUpdatedDate = Maybe POSIX
a} :: BotMetadata) ((Maybe POSIX -> f (Maybe POSIX)) -> BotMetadata -> f BotMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> BotMetadata
-> f BotMetadata
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

-- | A description of the bot.
botMetadata_description :: Lens.Lens' BotMetadata (Prelude.Maybe Prelude.Text)
botMetadata_description :: (Maybe Text -> f (Maybe Text)) -> BotMetadata -> f BotMetadata
botMetadata_description = (BotMetadata -> Maybe Text)
-> (BotMetadata -> Maybe Text -> BotMetadata)
-> Lens BotMetadata BotMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotMetadata' {Maybe Text
description :: Maybe Text
$sel:description:BotMetadata' :: BotMetadata -> Maybe Text
description} -> Maybe Text
description) (\s :: BotMetadata
s@BotMetadata' {} Maybe Text
a -> BotMetadata
s {$sel:description:BotMetadata' :: Maybe Text
description = Maybe Text
a} :: BotMetadata)

instance Core.FromJSON BotMetadata where
  parseJSON :: Value -> Parser BotMetadata
parseJSON =
    String
-> (Object -> Parser BotMetadata) -> Value -> Parser BotMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BotMetadata"
      ( \Object
x ->
          Maybe LexStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> BotMetadata
BotMetadata'
            (Maybe LexStatus
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> BotMetadata)
-> Parser (Maybe LexStatus)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> BotMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LexStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> BotMetadata)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe POSIX -> Maybe Text -> BotMetadata)
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
"createdDate")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe POSIX -> Maybe Text -> BotMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> Maybe Text -> BotMetadata)
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")
            Parser (Maybe Text -> Maybe POSIX -> Maybe Text -> BotMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> BotMetadata)
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
"version")
            Parser (Maybe POSIX -> Maybe Text -> BotMetadata)
-> Parser (Maybe POSIX) -> Parser (Maybe Text -> BotMetadata)
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
"lastUpdatedDate")
            Parser (Maybe Text -> BotMetadata)
-> Parser (Maybe Text) -> Parser BotMetadata
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
"description")
      )

instance Prelude.Hashable BotMetadata

instance Prelude.NFData BotMetadata