{-# 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.TimerCanceledEventAttributes
-- 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.TimerCanceledEventAttributes where

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

-- | Provides the details of the @TimerCanceled@ event.
--
-- /See:/ 'newTimerCanceledEventAttributes' smart constructor.
data TimerCanceledEventAttributes = TimerCanceledEventAttributes'
  { -- | The unique ID of the timer that was canceled.
    TimerCanceledEventAttributes -> 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.
    TimerCanceledEventAttributes -> Integer
startedEventId :: Prelude.Integer,
    -- | The ID of the @DecisionTaskCompleted@ event corresponding to the
    -- decision task that resulted in the @CancelTimer@ decision to cancel this
    -- timer. This information can be useful for diagnosing problems by tracing
    -- back the chain of events leading up to this event.
    TimerCanceledEventAttributes -> Integer
decisionTaskCompletedEventId :: Prelude.Integer
  }
  deriving (TimerCanceledEventAttributes
-> TimerCanceledEventAttributes -> Bool
(TimerCanceledEventAttributes
 -> TimerCanceledEventAttributes -> Bool)
-> (TimerCanceledEventAttributes
    -> TimerCanceledEventAttributes -> Bool)
-> Eq TimerCanceledEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimerCanceledEventAttributes
-> TimerCanceledEventAttributes -> Bool
$c/= :: TimerCanceledEventAttributes
-> TimerCanceledEventAttributes -> Bool
== :: TimerCanceledEventAttributes
-> TimerCanceledEventAttributes -> Bool
$c== :: TimerCanceledEventAttributes
-> TimerCanceledEventAttributes -> Bool
Prelude.Eq, ReadPrec [TimerCanceledEventAttributes]
ReadPrec TimerCanceledEventAttributes
Int -> ReadS TimerCanceledEventAttributes
ReadS [TimerCanceledEventAttributes]
(Int -> ReadS TimerCanceledEventAttributes)
-> ReadS [TimerCanceledEventAttributes]
-> ReadPrec TimerCanceledEventAttributes
-> ReadPrec [TimerCanceledEventAttributes]
-> Read TimerCanceledEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimerCanceledEventAttributes]
$creadListPrec :: ReadPrec [TimerCanceledEventAttributes]
readPrec :: ReadPrec TimerCanceledEventAttributes
$creadPrec :: ReadPrec TimerCanceledEventAttributes
readList :: ReadS [TimerCanceledEventAttributes]
$creadList :: ReadS [TimerCanceledEventAttributes]
readsPrec :: Int -> ReadS TimerCanceledEventAttributes
$creadsPrec :: Int -> ReadS TimerCanceledEventAttributes
Prelude.Read, Int -> TimerCanceledEventAttributes -> ShowS
[TimerCanceledEventAttributes] -> ShowS
TimerCanceledEventAttributes -> String
(Int -> TimerCanceledEventAttributes -> ShowS)
-> (TimerCanceledEventAttributes -> String)
-> ([TimerCanceledEventAttributes] -> ShowS)
-> Show TimerCanceledEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimerCanceledEventAttributes] -> ShowS
$cshowList :: [TimerCanceledEventAttributes] -> ShowS
show :: TimerCanceledEventAttributes -> String
$cshow :: TimerCanceledEventAttributes -> String
showsPrec :: Int -> TimerCanceledEventAttributes -> ShowS
$cshowsPrec :: Int -> TimerCanceledEventAttributes -> ShowS
Prelude.Show, (forall x.
 TimerCanceledEventAttributes -> Rep TimerCanceledEventAttributes x)
-> (forall x.
    Rep TimerCanceledEventAttributes x -> TimerCanceledEventAttributes)
-> Generic TimerCanceledEventAttributes
forall x.
Rep TimerCanceledEventAttributes x -> TimerCanceledEventAttributes
forall x.
TimerCanceledEventAttributes -> Rep TimerCanceledEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TimerCanceledEventAttributes x -> TimerCanceledEventAttributes
$cfrom :: forall x.
TimerCanceledEventAttributes -> Rep TimerCanceledEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'TimerCanceledEventAttributes' 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', 'timerCanceledEventAttributes_timerId' - The unique ID of the timer that was canceled.
--
-- 'startedEventId', 'timerCanceledEventAttributes_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.
--
-- 'decisionTaskCompletedEventId', 'timerCanceledEventAttributes_decisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @CancelTimer@ decision to cancel this
-- timer. This information can be useful for diagnosing problems by tracing
-- back the chain of events leading up to this event.
newTimerCanceledEventAttributes ::
  -- | 'timerId'
  Prelude.Text ->
  -- | 'startedEventId'
  Prelude.Integer ->
  -- | 'decisionTaskCompletedEventId'
  Prelude.Integer ->
  TimerCanceledEventAttributes
newTimerCanceledEventAttributes :: Text -> Integer -> Integer -> TimerCanceledEventAttributes
newTimerCanceledEventAttributes
  Text
pTimerId_
  Integer
pStartedEventId_
  Integer
pDecisionTaskCompletedEventId_ =
    TimerCanceledEventAttributes' :: Text -> Integer -> Integer -> TimerCanceledEventAttributes
TimerCanceledEventAttributes'
      { $sel:timerId:TimerCanceledEventAttributes' :: Text
timerId = Text
pTimerId_,
        $sel:startedEventId:TimerCanceledEventAttributes' :: Integer
startedEventId = Integer
pStartedEventId_,
        $sel:decisionTaskCompletedEventId:TimerCanceledEventAttributes' :: Integer
decisionTaskCompletedEventId =
          Integer
pDecisionTaskCompletedEventId_
      }

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

-- | 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.
timerCanceledEventAttributes_startedEventId :: Lens.Lens' TimerCanceledEventAttributes Prelude.Integer
timerCanceledEventAttributes_startedEventId :: (Integer -> f Integer)
-> TimerCanceledEventAttributes -> f TimerCanceledEventAttributes
timerCanceledEventAttributes_startedEventId = (TimerCanceledEventAttributes -> Integer)
-> (TimerCanceledEventAttributes
    -> Integer -> TimerCanceledEventAttributes)
-> Lens
     TimerCanceledEventAttributes
     TimerCanceledEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimerCanceledEventAttributes' {Integer
startedEventId :: Integer
$sel:startedEventId:TimerCanceledEventAttributes' :: TimerCanceledEventAttributes -> Integer
startedEventId} -> Integer
startedEventId) (\s :: TimerCanceledEventAttributes
s@TimerCanceledEventAttributes' {} Integer
a -> TimerCanceledEventAttributes
s {$sel:startedEventId:TimerCanceledEventAttributes' :: Integer
startedEventId = Integer
a} :: TimerCanceledEventAttributes)

-- | The ID of the @DecisionTaskCompleted@ event corresponding to the
-- decision task that resulted in the @CancelTimer@ decision to cancel this
-- timer. This information can be useful for diagnosing problems by tracing
-- back the chain of events leading up to this event.
timerCanceledEventAttributes_decisionTaskCompletedEventId :: Lens.Lens' TimerCanceledEventAttributes Prelude.Integer
timerCanceledEventAttributes_decisionTaskCompletedEventId :: (Integer -> f Integer)
-> TimerCanceledEventAttributes -> f TimerCanceledEventAttributes
timerCanceledEventAttributes_decisionTaskCompletedEventId = (TimerCanceledEventAttributes -> Integer)
-> (TimerCanceledEventAttributes
    -> Integer -> TimerCanceledEventAttributes)
-> Lens
     TimerCanceledEventAttributes
     TimerCanceledEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimerCanceledEventAttributes' {Integer
decisionTaskCompletedEventId :: Integer
$sel:decisionTaskCompletedEventId:TimerCanceledEventAttributes' :: TimerCanceledEventAttributes -> Integer
decisionTaskCompletedEventId} -> Integer
decisionTaskCompletedEventId) (\s :: TimerCanceledEventAttributes
s@TimerCanceledEventAttributes' {} Integer
a -> TimerCanceledEventAttributes
s {$sel:decisionTaskCompletedEventId:TimerCanceledEventAttributes' :: Integer
decisionTaskCompletedEventId = Integer
a} :: TimerCanceledEventAttributes)

instance Core.FromJSON TimerCanceledEventAttributes where
  parseJSON :: Value -> Parser TimerCanceledEventAttributes
parseJSON =
    String
-> (Object -> Parser TimerCanceledEventAttributes)
-> Value
-> Parser TimerCanceledEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TimerCanceledEventAttributes"
      ( \Object
x ->
          Text -> Integer -> Integer -> TimerCanceledEventAttributes
TimerCanceledEventAttributes'
            (Text -> Integer -> Integer -> TimerCanceledEventAttributes)
-> Parser Text
-> Parser (Integer -> Integer -> TimerCanceledEventAttributes)
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 -> Integer -> TimerCanceledEventAttributes)
-> Parser Integer
-> Parser (Integer -> TimerCanceledEventAttributes)
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")
            Parser (Integer -> TimerCanceledEventAttributes)
-> Parser Integer -> Parser TimerCanceledEventAttributes
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
"decisionTaskCompletedEventId")
      )

instance
  Prelude.Hashable
    TimerCanceledEventAttributes

instance Prelude.NFData TimerCanceledEventAttributes