{-# 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.LexV2Models.Types.BotAliasHistoryEvent
-- 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.LexV2Models.Types.BotAliasHistoryEvent 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

-- | Provides a record of an event that affects a bot alias. For example,
-- when the version of a bot that the alias points to changes.
--
-- /See:/ 'newBotAliasHistoryEvent' smart constructor.
data BotAliasHistoryEvent = BotAliasHistoryEvent'
  { -- | The version of the bot that was used in the event.
    BotAliasHistoryEvent -> Maybe Text
botVersion :: Prelude.Maybe Prelude.Text,
    -- | The date and time that the event ended.
    BotAliasHistoryEvent -> Maybe POSIX
endDate :: Prelude.Maybe Data.POSIX,
    -- | The date and time that the event started.
    BotAliasHistoryEvent -> Maybe POSIX
startDate :: Prelude.Maybe Data.POSIX
  }
  deriving (BotAliasHistoryEvent -> BotAliasHistoryEvent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BotAliasHistoryEvent -> BotAliasHistoryEvent -> Bool
$c/= :: BotAliasHistoryEvent -> BotAliasHistoryEvent -> Bool
== :: BotAliasHistoryEvent -> BotAliasHistoryEvent -> Bool
$c== :: BotAliasHistoryEvent -> BotAliasHistoryEvent -> Bool
Prelude.Eq, ReadPrec [BotAliasHistoryEvent]
ReadPrec BotAliasHistoryEvent
Int -> ReadS BotAliasHistoryEvent
ReadS [BotAliasHistoryEvent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BotAliasHistoryEvent]
$creadListPrec :: ReadPrec [BotAliasHistoryEvent]
readPrec :: ReadPrec BotAliasHistoryEvent
$creadPrec :: ReadPrec BotAliasHistoryEvent
readList :: ReadS [BotAliasHistoryEvent]
$creadList :: ReadS [BotAliasHistoryEvent]
readsPrec :: Int -> ReadS BotAliasHistoryEvent
$creadsPrec :: Int -> ReadS BotAliasHistoryEvent
Prelude.Read, Int -> BotAliasHistoryEvent -> ShowS
[BotAliasHistoryEvent] -> ShowS
BotAliasHistoryEvent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BotAliasHistoryEvent] -> ShowS
$cshowList :: [BotAliasHistoryEvent] -> ShowS
show :: BotAliasHistoryEvent -> String
$cshow :: BotAliasHistoryEvent -> String
showsPrec :: Int -> BotAliasHistoryEvent -> ShowS
$cshowsPrec :: Int -> BotAliasHistoryEvent -> ShowS
Prelude.Show, forall x. Rep BotAliasHistoryEvent x -> BotAliasHistoryEvent
forall x. BotAliasHistoryEvent -> Rep BotAliasHistoryEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BotAliasHistoryEvent x -> BotAliasHistoryEvent
$cfrom :: forall x. BotAliasHistoryEvent -> Rep BotAliasHistoryEvent x
Prelude.Generic)

-- |
-- Create a value of 'BotAliasHistoryEvent' 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:
--
-- 'botVersion', 'botAliasHistoryEvent_botVersion' - The version of the bot that was used in the event.
--
-- 'endDate', 'botAliasHistoryEvent_endDate' - The date and time that the event ended.
--
-- 'startDate', 'botAliasHistoryEvent_startDate' - The date and time that the event started.
newBotAliasHistoryEvent ::
  BotAliasHistoryEvent
newBotAliasHistoryEvent :: BotAliasHistoryEvent
newBotAliasHistoryEvent =
  BotAliasHistoryEvent'
    { $sel:botVersion:BotAliasHistoryEvent' :: Maybe Text
botVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:endDate:BotAliasHistoryEvent' :: Maybe POSIX
endDate = forall a. Maybe a
Prelude.Nothing,
      $sel:startDate:BotAliasHistoryEvent' :: Maybe POSIX
startDate = forall a. Maybe a
Prelude.Nothing
    }

-- | The version of the bot that was used in the event.
botAliasHistoryEvent_botVersion :: Lens.Lens' BotAliasHistoryEvent (Prelude.Maybe Prelude.Text)
botAliasHistoryEvent_botVersion :: Lens' BotAliasHistoryEvent (Maybe Text)
botAliasHistoryEvent_botVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotAliasHistoryEvent' {Maybe Text
botVersion :: Maybe Text
$sel:botVersion:BotAliasHistoryEvent' :: BotAliasHistoryEvent -> Maybe Text
botVersion} -> Maybe Text
botVersion) (\s :: BotAliasHistoryEvent
s@BotAliasHistoryEvent' {} Maybe Text
a -> BotAliasHistoryEvent
s {$sel:botVersion:BotAliasHistoryEvent' :: Maybe Text
botVersion = Maybe Text
a} :: BotAliasHistoryEvent)

-- | The date and time that the event ended.
botAliasHistoryEvent_endDate :: Lens.Lens' BotAliasHistoryEvent (Prelude.Maybe Prelude.UTCTime)
botAliasHistoryEvent_endDate :: Lens' BotAliasHistoryEvent (Maybe UTCTime)
botAliasHistoryEvent_endDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotAliasHistoryEvent' {Maybe POSIX
endDate :: Maybe POSIX
$sel:endDate:BotAliasHistoryEvent' :: BotAliasHistoryEvent -> Maybe POSIX
endDate} -> Maybe POSIX
endDate) (\s :: BotAliasHistoryEvent
s@BotAliasHistoryEvent' {} Maybe POSIX
a -> BotAliasHistoryEvent
s {$sel:endDate:BotAliasHistoryEvent' :: Maybe POSIX
endDate = Maybe POSIX
a} :: BotAliasHistoryEvent) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The date and time that the event started.
botAliasHistoryEvent_startDate :: Lens.Lens' BotAliasHistoryEvent (Prelude.Maybe Prelude.UTCTime)
botAliasHistoryEvent_startDate :: Lens' BotAliasHistoryEvent (Maybe UTCTime)
botAliasHistoryEvent_startDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotAliasHistoryEvent' {Maybe POSIX
startDate :: Maybe POSIX
$sel:startDate:BotAliasHistoryEvent' :: BotAliasHistoryEvent -> Maybe POSIX
startDate} -> Maybe POSIX
startDate) (\s :: BotAliasHistoryEvent
s@BotAliasHistoryEvent' {} Maybe POSIX
a -> BotAliasHistoryEvent
s {$sel:startDate:BotAliasHistoryEvent' :: Maybe POSIX
startDate = Maybe POSIX
a} :: BotAliasHistoryEvent) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON BotAliasHistoryEvent where
  parseJSON :: Value -> Parser BotAliasHistoryEvent
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BotAliasHistoryEvent"
      ( \Object
x ->
          Maybe Text -> Maybe POSIX -> Maybe POSIX -> BotAliasHistoryEvent
BotAliasHistoryEvent'
            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
"botVersion")
            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
"endDate")
            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
"startDate")
      )

instance Prelude.Hashable BotAliasHistoryEvent where
  hashWithSalt :: Int -> BotAliasHistoryEvent -> Int
hashWithSalt Int
_salt BotAliasHistoryEvent' {Maybe Text
Maybe POSIX
startDate :: Maybe POSIX
endDate :: Maybe POSIX
botVersion :: Maybe Text
$sel:startDate:BotAliasHistoryEvent' :: BotAliasHistoryEvent -> Maybe POSIX
$sel:endDate:BotAliasHistoryEvent' :: BotAliasHistoryEvent -> Maybe POSIX
$sel:botVersion:BotAliasHistoryEvent' :: BotAliasHistoryEvent -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
botVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startDate

instance Prelude.NFData BotAliasHistoryEvent where
  rnf :: BotAliasHistoryEvent -> ()
rnf BotAliasHistoryEvent' {Maybe Text
Maybe POSIX
startDate :: Maybe POSIX
endDate :: Maybe POSIX
botVersion :: Maybe Text
$sel:startDate:BotAliasHistoryEvent' :: BotAliasHistoryEvent -> Maybe POSIX
$sel:endDate:BotAliasHistoryEvent' :: BotAliasHistoryEvent -> Maybe POSIX
$sel:botVersion:BotAliasHistoryEvent' :: BotAliasHistoryEvent -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
botVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startDate