{-# 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.BotLocaleHistoryEvent
-- 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.BotLocaleHistoryEvent 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 information about an event that occurred affecting the bot
-- locale.
--
-- /See:/ 'newBotLocaleHistoryEvent' smart constructor.
data BotLocaleHistoryEvent = BotLocaleHistoryEvent'
  { -- | A description of the event that occurred.
    BotLocaleHistoryEvent -> Text
event :: Prelude.Text,
    -- | A timestamp of the date and time that the event occurred.
    BotLocaleHistoryEvent -> POSIX
eventDate :: Data.POSIX
  }
  deriving (BotLocaleHistoryEvent -> BotLocaleHistoryEvent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BotLocaleHistoryEvent -> BotLocaleHistoryEvent -> Bool
$c/= :: BotLocaleHistoryEvent -> BotLocaleHistoryEvent -> Bool
== :: BotLocaleHistoryEvent -> BotLocaleHistoryEvent -> Bool
$c== :: BotLocaleHistoryEvent -> BotLocaleHistoryEvent -> Bool
Prelude.Eq, ReadPrec [BotLocaleHistoryEvent]
ReadPrec BotLocaleHistoryEvent
Int -> ReadS BotLocaleHistoryEvent
ReadS [BotLocaleHistoryEvent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BotLocaleHistoryEvent]
$creadListPrec :: ReadPrec [BotLocaleHistoryEvent]
readPrec :: ReadPrec BotLocaleHistoryEvent
$creadPrec :: ReadPrec BotLocaleHistoryEvent
readList :: ReadS [BotLocaleHistoryEvent]
$creadList :: ReadS [BotLocaleHistoryEvent]
readsPrec :: Int -> ReadS BotLocaleHistoryEvent
$creadsPrec :: Int -> ReadS BotLocaleHistoryEvent
Prelude.Read, Int -> BotLocaleHistoryEvent -> ShowS
[BotLocaleHistoryEvent] -> ShowS
BotLocaleHistoryEvent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BotLocaleHistoryEvent] -> ShowS
$cshowList :: [BotLocaleHistoryEvent] -> ShowS
show :: BotLocaleHistoryEvent -> String
$cshow :: BotLocaleHistoryEvent -> String
showsPrec :: Int -> BotLocaleHistoryEvent -> ShowS
$cshowsPrec :: Int -> BotLocaleHistoryEvent -> ShowS
Prelude.Show, forall x. Rep BotLocaleHistoryEvent x -> BotLocaleHistoryEvent
forall x. BotLocaleHistoryEvent -> Rep BotLocaleHistoryEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BotLocaleHistoryEvent x -> BotLocaleHistoryEvent
$cfrom :: forall x. BotLocaleHistoryEvent -> Rep BotLocaleHistoryEvent x
Prelude.Generic)

-- |
-- Create a value of 'BotLocaleHistoryEvent' 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:
--
-- 'event', 'botLocaleHistoryEvent_event' - A description of the event that occurred.
--
-- 'eventDate', 'botLocaleHistoryEvent_eventDate' - A timestamp of the date and time that the event occurred.
newBotLocaleHistoryEvent ::
  -- | 'event'
  Prelude.Text ->
  -- | 'eventDate'
  Prelude.UTCTime ->
  BotLocaleHistoryEvent
newBotLocaleHistoryEvent :: Text -> UTCTime -> BotLocaleHistoryEvent
newBotLocaleHistoryEvent Text
pEvent_ UTCTime
pEventDate_ =
  BotLocaleHistoryEvent'
    { $sel:event:BotLocaleHistoryEvent' :: Text
event = Text
pEvent_,
      $sel:eventDate:BotLocaleHistoryEvent' :: POSIX
eventDate = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEventDate_
    }

-- | A description of the event that occurred.
botLocaleHistoryEvent_event :: Lens.Lens' BotLocaleHistoryEvent Prelude.Text
botLocaleHistoryEvent_event :: Lens' BotLocaleHistoryEvent Text
botLocaleHistoryEvent_event = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotLocaleHistoryEvent' {Text
event :: Text
$sel:event:BotLocaleHistoryEvent' :: BotLocaleHistoryEvent -> Text
event} -> Text
event) (\s :: BotLocaleHistoryEvent
s@BotLocaleHistoryEvent' {} Text
a -> BotLocaleHistoryEvent
s {$sel:event:BotLocaleHistoryEvent' :: Text
event = Text
a} :: BotLocaleHistoryEvent)

-- | A timestamp of the date and time that the event occurred.
botLocaleHistoryEvent_eventDate :: Lens.Lens' BotLocaleHistoryEvent Prelude.UTCTime
botLocaleHistoryEvent_eventDate :: Lens' BotLocaleHistoryEvent UTCTime
botLocaleHistoryEvent_eventDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotLocaleHistoryEvent' {POSIX
eventDate :: POSIX
$sel:eventDate:BotLocaleHistoryEvent' :: BotLocaleHistoryEvent -> POSIX
eventDate} -> POSIX
eventDate) (\s :: BotLocaleHistoryEvent
s@BotLocaleHistoryEvent' {} POSIX
a -> BotLocaleHistoryEvent
s {$sel:eventDate:BotLocaleHistoryEvent' :: POSIX
eventDate = POSIX
a} :: BotLocaleHistoryEvent) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON BotLocaleHistoryEvent where
  parseJSON :: Value -> Parser BotLocaleHistoryEvent
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BotLocaleHistoryEvent"
      ( \Object
x ->
          Text -> POSIX -> BotLocaleHistoryEvent
BotLocaleHistoryEvent'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"event")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"eventDate")
      )

instance Prelude.Hashable BotLocaleHistoryEvent where
  hashWithSalt :: Int -> BotLocaleHistoryEvent -> Int
hashWithSalt Int
_salt BotLocaleHistoryEvent' {Text
POSIX
eventDate :: POSIX
event :: Text
$sel:eventDate:BotLocaleHistoryEvent' :: BotLocaleHistoryEvent -> POSIX
$sel:event:BotLocaleHistoryEvent' :: BotLocaleHistoryEvent -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
event
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
eventDate

instance Prelude.NFData BotLocaleHistoryEvent where
  rnf :: BotLocaleHistoryEvent -> ()
rnf BotLocaleHistoryEvent' {Text
POSIX
eventDate :: POSIX
event :: Text
$sel:eventDate:BotLocaleHistoryEvent' :: BotLocaleHistoryEvent -> POSIX
$sel:event:BotLocaleHistoryEvent' :: BotLocaleHistoryEvent -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
event
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
eventDate