{-# 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.SSMIncidents.Types.EventSummary
-- 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.SSMIncidents.Types.EventSummary where

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

-- | Details about a timeline event during an incident.
--
-- /See:/ 'newEventSummary' smart constructor.
data EventSummary = EventSummary'
  { -- | The timeline event ID.
    EventSummary -> Text
eventId :: Prelude.Text,
    -- | The time that the event occurred.
    EventSummary -> POSIX
eventTime :: Core.POSIX,
    -- | The type of event. The timeline event must be @Custom Event@.
    EventSummary -> Text
eventType :: Prelude.Text,
    -- | The time that the timeline event was last updated.
    EventSummary -> POSIX
eventUpdatedTime :: Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the incident that the event happened
    -- during.
    EventSummary -> Text
incidentRecordArn :: Prelude.Text
  }
  deriving (EventSummary -> EventSummary -> Bool
(EventSummary -> EventSummary -> Bool)
-> (EventSummary -> EventSummary -> Bool) -> Eq EventSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventSummary -> EventSummary -> Bool
$c/= :: EventSummary -> EventSummary -> Bool
== :: EventSummary -> EventSummary -> Bool
$c== :: EventSummary -> EventSummary -> Bool
Prelude.Eq, ReadPrec [EventSummary]
ReadPrec EventSummary
Int -> ReadS EventSummary
ReadS [EventSummary]
(Int -> ReadS EventSummary)
-> ReadS [EventSummary]
-> ReadPrec EventSummary
-> ReadPrec [EventSummary]
-> Read EventSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventSummary]
$creadListPrec :: ReadPrec [EventSummary]
readPrec :: ReadPrec EventSummary
$creadPrec :: ReadPrec EventSummary
readList :: ReadS [EventSummary]
$creadList :: ReadS [EventSummary]
readsPrec :: Int -> ReadS EventSummary
$creadsPrec :: Int -> ReadS EventSummary
Prelude.Read, Int -> EventSummary -> ShowS
[EventSummary] -> ShowS
EventSummary -> String
(Int -> EventSummary -> ShowS)
-> (EventSummary -> String)
-> ([EventSummary] -> ShowS)
-> Show EventSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventSummary] -> ShowS
$cshowList :: [EventSummary] -> ShowS
show :: EventSummary -> String
$cshow :: EventSummary -> String
showsPrec :: Int -> EventSummary -> ShowS
$cshowsPrec :: Int -> EventSummary -> ShowS
Prelude.Show, (forall x. EventSummary -> Rep EventSummary x)
-> (forall x. Rep EventSummary x -> EventSummary)
-> Generic EventSummary
forall x. Rep EventSummary x -> EventSummary
forall x. EventSummary -> Rep EventSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventSummary x -> EventSummary
$cfrom :: forall x. EventSummary -> Rep EventSummary x
Prelude.Generic)

-- |
-- Create a value of 'EventSummary' 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:
--
-- 'eventId', 'eventSummary_eventId' - The timeline event ID.
--
-- 'eventTime', 'eventSummary_eventTime' - The time that the event occurred.
--
-- 'eventType', 'eventSummary_eventType' - The type of event. The timeline event must be @Custom Event@.
--
-- 'eventUpdatedTime', 'eventSummary_eventUpdatedTime' - The time that the timeline event was last updated.
--
-- 'incidentRecordArn', 'eventSummary_incidentRecordArn' - The Amazon Resource Name (ARN) of the incident that the event happened
-- during.
newEventSummary ::
  -- | 'eventId'
  Prelude.Text ->
  -- | 'eventTime'
  Prelude.UTCTime ->
  -- | 'eventType'
  Prelude.Text ->
  -- | 'eventUpdatedTime'
  Prelude.UTCTime ->
  -- | 'incidentRecordArn'
  Prelude.Text ->
  EventSummary
newEventSummary :: Text -> UTCTime -> Text -> UTCTime -> Text -> EventSummary
newEventSummary
  Text
pEventId_
  UTCTime
pEventTime_
  Text
pEventType_
  UTCTime
pEventUpdatedTime_
  Text
pIncidentRecordArn_ =
    EventSummary' :: Text -> POSIX -> Text -> POSIX -> Text -> EventSummary
EventSummary'
      { $sel:eventId:EventSummary' :: Text
eventId = Text
pEventId_,
        $sel:eventTime:EventSummary' :: POSIX
eventTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEventTime_,
        $sel:eventType:EventSummary' :: Text
eventType = Text
pEventType_,
        $sel:eventUpdatedTime:EventSummary' :: POSIX
eventUpdatedTime =
          Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEventUpdatedTime_,
        $sel:incidentRecordArn:EventSummary' :: Text
incidentRecordArn = Text
pIncidentRecordArn_
      }

-- | The timeline event ID.
eventSummary_eventId :: Lens.Lens' EventSummary Prelude.Text
eventSummary_eventId :: (Text -> f Text) -> EventSummary -> f EventSummary
eventSummary_eventId = (EventSummary -> Text)
-> (EventSummary -> Text -> EventSummary)
-> Lens EventSummary EventSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventSummary' {Text
eventId :: Text
$sel:eventId:EventSummary' :: EventSummary -> Text
eventId} -> Text
eventId) (\s :: EventSummary
s@EventSummary' {} Text
a -> EventSummary
s {$sel:eventId:EventSummary' :: Text
eventId = Text
a} :: EventSummary)

-- | The time that the event occurred.
eventSummary_eventTime :: Lens.Lens' EventSummary Prelude.UTCTime
eventSummary_eventTime :: (UTCTime -> f UTCTime) -> EventSummary -> f EventSummary
eventSummary_eventTime = (EventSummary -> POSIX)
-> (EventSummary -> POSIX -> EventSummary)
-> Lens EventSummary EventSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventSummary' {POSIX
eventTime :: POSIX
$sel:eventTime:EventSummary' :: EventSummary -> POSIX
eventTime} -> POSIX
eventTime) (\s :: EventSummary
s@EventSummary' {} POSIX
a -> EventSummary
s {$sel:eventTime:EventSummary' :: POSIX
eventTime = POSIX
a} :: EventSummary) ((POSIX -> f POSIX) -> EventSummary -> f EventSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> EventSummary
-> f EventSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The type of event. The timeline event must be @Custom Event@.
eventSummary_eventType :: Lens.Lens' EventSummary Prelude.Text
eventSummary_eventType :: (Text -> f Text) -> EventSummary -> f EventSummary
eventSummary_eventType = (EventSummary -> Text)
-> (EventSummary -> Text -> EventSummary)
-> Lens EventSummary EventSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventSummary' {Text
eventType :: Text
$sel:eventType:EventSummary' :: EventSummary -> Text
eventType} -> Text
eventType) (\s :: EventSummary
s@EventSummary' {} Text
a -> EventSummary
s {$sel:eventType:EventSummary' :: Text
eventType = Text
a} :: EventSummary)

-- | The time that the timeline event was last updated.
eventSummary_eventUpdatedTime :: Lens.Lens' EventSummary Prelude.UTCTime
eventSummary_eventUpdatedTime :: (UTCTime -> f UTCTime) -> EventSummary -> f EventSummary
eventSummary_eventUpdatedTime = (EventSummary -> POSIX)
-> (EventSummary -> POSIX -> EventSummary)
-> Lens EventSummary EventSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventSummary' {POSIX
eventUpdatedTime :: POSIX
$sel:eventUpdatedTime:EventSummary' :: EventSummary -> POSIX
eventUpdatedTime} -> POSIX
eventUpdatedTime) (\s :: EventSummary
s@EventSummary' {} POSIX
a -> EventSummary
s {$sel:eventUpdatedTime:EventSummary' :: POSIX
eventUpdatedTime = POSIX
a} :: EventSummary) ((POSIX -> f POSIX) -> EventSummary -> f EventSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> EventSummary
-> f EventSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Amazon Resource Name (ARN) of the incident that the event happened
-- during.
eventSummary_incidentRecordArn :: Lens.Lens' EventSummary Prelude.Text
eventSummary_incidentRecordArn :: (Text -> f Text) -> EventSummary -> f EventSummary
eventSummary_incidentRecordArn = (EventSummary -> Text)
-> (EventSummary -> Text -> EventSummary)
-> Lens EventSummary EventSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventSummary' {Text
incidentRecordArn :: Text
$sel:incidentRecordArn:EventSummary' :: EventSummary -> Text
incidentRecordArn} -> Text
incidentRecordArn) (\s :: EventSummary
s@EventSummary' {} Text
a -> EventSummary
s {$sel:incidentRecordArn:EventSummary' :: Text
incidentRecordArn = Text
a} :: EventSummary)

instance Core.FromJSON EventSummary where
  parseJSON :: Value -> Parser EventSummary
parseJSON =
    String
-> (Object -> Parser EventSummary) -> Value -> Parser EventSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EventSummary"
      ( \Object
x ->
          Text -> POSIX -> Text -> POSIX -> Text -> EventSummary
EventSummary'
            (Text -> POSIX -> Text -> POSIX -> Text -> EventSummary)
-> Parser Text
-> Parser (POSIX -> Text -> POSIX -> Text -> EventSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"eventId")
            Parser (POSIX -> Text -> POSIX -> Text -> EventSummary)
-> Parser POSIX -> Parser (Text -> POSIX -> Text -> EventSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"eventTime")
            Parser (Text -> POSIX -> Text -> EventSummary)
-> Parser Text -> Parser (POSIX -> Text -> EventSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"eventType")
            Parser (POSIX -> Text -> EventSummary)
-> Parser POSIX -> Parser (Text -> EventSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"eventUpdatedTime")
            Parser (Text -> EventSummary) -> Parser Text -> Parser EventSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"incidentRecordArn")
      )

instance Prelude.Hashable EventSummary

instance Prelude.NFData EventSummary