{-# 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.SWF.Types.TimerFiredEventAttributes
-- 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.SWF.Types.TimerFiredEventAttributes where

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

-- | Provides the details of the @TimerFired@ event.
--
-- /See:/ 'newTimerFiredEventAttributes' smart constructor.
data TimerFiredEventAttributes = TimerFiredEventAttributes'
  { -- | The unique ID of the timer that fired.
    TimerFiredEventAttributes -> Text
timerId :: Prelude.Text,
    -- | The ID of the @TimerStarted@ event that was recorded when this timer was
    -- started. This information can be useful for diagnosing problems by
    -- tracing back the chain of events leading up to this event.
    TimerFiredEventAttributes -> Integer
startedEventId :: Prelude.Integer
  }
  deriving (TimerFiredEventAttributes -> TimerFiredEventAttributes -> Bool
(TimerFiredEventAttributes -> TimerFiredEventAttributes -> Bool)
-> (TimerFiredEventAttributes -> TimerFiredEventAttributes -> Bool)
-> Eq TimerFiredEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimerFiredEventAttributes -> TimerFiredEventAttributes -> Bool
$c/= :: TimerFiredEventAttributes -> TimerFiredEventAttributes -> Bool
== :: TimerFiredEventAttributes -> TimerFiredEventAttributes -> Bool
$c== :: TimerFiredEventAttributes -> TimerFiredEventAttributes -> Bool
Prelude.Eq, ReadPrec [TimerFiredEventAttributes]
ReadPrec TimerFiredEventAttributes
Int -> ReadS TimerFiredEventAttributes
ReadS [TimerFiredEventAttributes]
(Int -> ReadS TimerFiredEventAttributes)
-> ReadS [TimerFiredEventAttributes]
-> ReadPrec TimerFiredEventAttributes
-> ReadPrec [TimerFiredEventAttributes]
-> Read TimerFiredEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimerFiredEventAttributes]
$creadListPrec :: ReadPrec [TimerFiredEventAttributes]
readPrec :: ReadPrec TimerFiredEventAttributes
$creadPrec :: ReadPrec TimerFiredEventAttributes
readList :: ReadS [TimerFiredEventAttributes]
$creadList :: ReadS [TimerFiredEventAttributes]
readsPrec :: Int -> ReadS TimerFiredEventAttributes
$creadsPrec :: Int -> ReadS TimerFiredEventAttributes
Prelude.Read, Int -> TimerFiredEventAttributes -> ShowS
[TimerFiredEventAttributes] -> ShowS
TimerFiredEventAttributes -> String
(Int -> TimerFiredEventAttributes -> ShowS)
-> (TimerFiredEventAttributes -> String)
-> ([TimerFiredEventAttributes] -> ShowS)
-> Show TimerFiredEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimerFiredEventAttributes] -> ShowS
$cshowList :: [TimerFiredEventAttributes] -> ShowS
show :: TimerFiredEventAttributes -> String
$cshow :: TimerFiredEventAttributes -> String
showsPrec :: Int -> TimerFiredEventAttributes -> ShowS
$cshowsPrec :: Int -> TimerFiredEventAttributes -> ShowS
Prelude.Show, (forall x.
 TimerFiredEventAttributes -> Rep TimerFiredEventAttributes x)
-> (forall x.
    Rep TimerFiredEventAttributes x -> TimerFiredEventAttributes)
-> Generic TimerFiredEventAttributes
forall x.
Rep TimerFiredEventAttributes x -> TimerFiredEventAttributes
forall x.
TimerFiredEventAttributes -> Rep TimerFiredEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TimerFiredEventAttributes x -> TimerFiredEventAttributes
$cfrom :: forall x.
TimerFiredEventAttributes -> Rep TimerFiredEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'TimerFiredEventAttributes' 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:
--
-- 'timerId', 'timerFiredEventAttributes_timerId' - The unique ID of the timer that fired.
--
-- 'startedEventId', 'timerFiredEventAttributes_startedEventId' - The ID of the @TimerStarted@ event that was recorded when this timer was
-- started. This information can be useful for diagnosing problems by
-- tracing back the chain of events leading up to this event.
newTimerFiredEventAttributes ::
  -- | 'timerId'
  Prelude.Text ->
  -- | 'startedEventId'
  Prelude.Integer ->
  TimerFiredEventAttributes
newTimerFiredEventAttributes :: Text -> Integer -> TimerFiredEventAttributes
newTimerFiredEventAttributes
  Text
pTimerId_
  Integer
pStartedEventId_ =
    TimerFiredEventAttributes' :: Text -> Integer -> TimerFiredEventAttributes
TimerFiredEventAttributes'
      { $sel:timerId:TimerFiredEventAttributes' :: Text
timerId = Text
pTimerId_,
        $sel:startedEventId:TimerFiredEventAttributes' :: Integer
startedEventId = Integer
pStartedEventId_
      }

-- | The unique ID of the timer that fired.
timerFiredEventAttributes_timerId :: Lens.Lens' TimerFiredEventAttributes Prelude.Text
timerFiredEventAttributes_timerId :: (Text -> f Text)
-> TimerFiredEventAttributes -> f TimerFiredEventAttributes
timerFiredEventAttributes_timerId = (TimerFiredEventAttributes -> Text)
-> (TimerFiredEventAttributes -> Text -> TimerFiredEventAttributes)
-> Lens
     TimerFiredEventAttributes TimerFiredEventAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimerFiredEventAttributes' {Text
timerId :: Text
$sel:timerId:TimerFiredEventAttributes' :: TimerFiredEventAttributes -> Text
timerId} -> Text
timerId) (\s :: TimerFiredEventAttributes
s@TimerFiredEventAttributes' {} Text
a -> TimerFiredEventAttributes
s {$sel:timerId:TimerFiredEventAttributes' :: Text
timerId = Text
a} :: TimerFiredEventAttributes)

-- | The ID of the @TimerStarted@ event that was recorded when this timer was
-- started. This information can be useful for diagnosing problems by
-- tracing back the chain of events leading up to this event.
timerFiredEventAttributes_startedEventId :: Lens.Lens' TimerFiredEventAttributes Prelude.Integer
timerFiredEventAttributes_startedEventId :: (Integer -> f Integer)
-> TimerFiredEventAttributes -> f TimerFiredEventAttributes
timerFiredEventAttributes_startedEventId = (TimerFiredEventAttributes -> Integer)
-> (TimerFiredEventAttributes
    -> Integer -> TimerFiredEventAttributes)
-> Lens
     TimerFiredEventAttributes TimerFiredEventAttributes Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimerFiredEventAttributes' {Integer
startedEventId :: Integer
$sel:startedEventId:TimerFiredEventAttributes' :: TimerFiredEventAttributes -> Integer
startedEventId} -> Integer
startedEventId) (\s :: TimerFiredEventAttributes
s@TimerFiredEventAttributes' {} Integer
a -> TimerFiredEventAttributes
s {$sel:startedEventId:TimerFiredEventAttributes' :: Integer
startedEventId = Integer
a} :: TimerFiredEventAttributes)

instance Core.FromJSON TimerFiredEventAttributes where
  parseJSON :: Value -> Parser TimerFiredEventAttributes
parseJSON =
    String
-> (Object -> Parser TimerFiredEventAttributes)
-> Value
-> Parser TimerFiredEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TimerFiredEventAttributes"
      ( \Object
x ->
          Text -> Integer -> TimerFiredEventAttributes
TimerFiredEventAttributes'
            (Text -> Integer -> TimerFiredEventAttributes)
-> Parser Text -> Parser (Integer -> TimerFiredEventAttributes)
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
"timerId")
            Parser (Integer -> TimerFiredEventAttributes)
-> Parser Integer -> Parser TimerFiredEventAttributes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"startedEventId")
      )

instance Prelude.Hashable TimerFiredEventAttributes

instance Prelude.NFData TimerFiredEventAttributes