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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SWF.Types.DecisionTaskTimeoutType

-- | Provides the details of the @DecisionTaskTimedOut@ event.
--
-- /See:/ 'newDecisionTaskTimedOutEventAttributes' smart constructor.
data DecisionTaskTimedOutEventAttributes = DecisionTaskTimedOutEventAttributes'
  { -- | The type of timeout that expired before the decision task could be
    -- completed.
    DecisionTaskTimedOutEventAttributes -> DecisionTaskTimeoutType
timeoutType :: DecisionTaskTimeoutType,
    -- | The ID of the @DecisionTaskScheduled@ event that was recorded when this
    -- decision task was scheduled. This information can be useful for
    -- diagnosing problems by tracing back the chain of events leading up to
    -- this event.
    DecisionTaskTimedOutEventAttributes -> Integer
scheduledEventId :: Prelude.Integer,
    -- | The ID of the @DecisionTaskStarted@ event recorded when this decision
    -- task was started. This information can be useful for diagnosing problems
    -- by tracing back the chain of events leading up to this event.
    DecisionTaskTimedOutEventAttributes -> Integer
startedEventId :: Prelude.Integer
  }
  deriving (DecisionTaskTimedOutEventAttributes
-> DecisionTaskTimedOutEventAttributes -> Bool
(DecisionTaskTimedOutEventAttributes
 -> DecisionTaskTimedOutEventAttributes -> Bool)
-> (DecisionTaskTimedOutEventAttributes
    -> DecisionTaskTimedOutEventAttributes -> Bool)
-> Eq DecisionTaskTimedOutEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DecisionTaskTimedOutEventAttributes
-> DecisionTaskTimedOutEventAttributes -> Bool
$c/= :: DecisionTaskTimedOutEventAttributes
-> DecisionTaskTimedOutEventAttributes -> Bool
== :: DecisionTaskTimedOutEventAttributes
-> DecisionTaskTimedOutEventAttributes -> Bool
$c== :: DecisionTaskTimedOutEventAttributes
-> DecisionTaskTimedOutEventAttributes -> Bool
Prelude.Eq, ReadPrec [DecisionTaskTimedOutEventAttributes]
ReadPrec DecisionTaskTimedOutEventAttributes
Int -> ReadS DecisionTaskTimedOutEventAttributes
ReadS [DecisionTaskTimedOutEventAttributes]
(Int -> ReadS DecisionTaskTimedOutEventAttributes)
-> ReadS [DecisionTaskTimedOutEventAttributes]
-> ReadPrec DecisionTaskTimedOutEventAttributes
-> ReadPrec [DecisionTaskTimedOutEventAttributes]
-> Read DecisionTaskTimedOutEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DecisionTaskTimedOutEventAttributes]
$creadListPrec :: ReadPrec [DecisionTaskTimedOutEventAttributes]
readPrec :: ReadPrec DecisionTaskTimedOutEventAttributes
$creadPrec :: ReadPrec DecisionTaskTimedOutEventAttributes
readList :: ReadS [DecisionTaskTimedOutEventAttributes]
$creadList :: ReadS [DecisionTaskTimedOutEventAttributes]
readsPrec :: Int -> ReadS DecisionTaskTimedOutEventAttributes
$creadsPrec :: Int -> ReadS DecisionTaskTimedOutEventAttributes
Prelude.Read, Int -> DecisionTaskTimedOutEventAttributes -> ShowS
[DecisionTaskTimedOutEventAttributes] -> ShowS
DecisionTaskTimedOutEventAttributes -> String
(Int -> DecisionTaskTimedOutEventAttributes -> ShowS)
-> (DecisionTaskTimedOutEventAttributes -> String)
-> ([DecisionTaskTimedOutEventAttributes] -> ShowS)
-> Show DecisionTaskTimedOutEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DecisionTaskTimedOutEventAttributes] -> ShowS
$cshowList :: [DecisionTaskTimedOutEventAttributes] -> ShowS
show :: DecisionTaskTimedOutEventAttributes -> String
$cshow :: DecisionTaskTimedOutEventAttributes -> String
showsPrec :: Int -> DecisionTaskTimedOutEventAttributes -> ShowS
$cshowsPrec :: Int -> DecisionTaskTimedOutEventAttributes -> ShowS
Prelude.Show, (forall x.
 DecisionTaskTimedOutEventAttributes
 -> Rep DecisionTaskTimedOutEventAttributes x)
-> (forall x.
    Rep DecisionTaskTimedOutEventAttributes x
    -> DecisionTaskTimedOutEventAttributes)
-> Generic DecisionTaskTimedOutEventAttributes
forall x.
Rep DecisionTaskTimedOutEventAttributes x
-> DecisionTaskTimedOutEventAttributes
forall x.
DecisionTaskTimedOutEventAttributes
-> Rep DecisionTaskTimedOutEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DecisionTaskTimedOutEventAttributes x
-> DecisionTaskTimedOutEventAttributes
$cfrom :: forall x.
DecisionTaskTimedOutEventAttributes
-> Rep DecisionTaskTimedOutEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'DecisionTaskTimedOutEventAttributes' 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:
--
-- 'timeoutType', 'decisionTaskTimedOutEventAttributes_timeoutType' - The type of timeout that expired before the decision task could be
-- completed.
--
-- 'scheduledEventId', 'decisionTaskTimedOutEventAttributes_scheduledEventId' - The ID of the @DecisionTaskScheduled@ event that was recorded when this
-- decision task was scheduled. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
--
-- 'startedEventId', 'decisionTaskTimedOutEventAttributes_startedEventId' - The ID of the @DecisionTaskStarted@ event recorded when this decision
-- task was started. This information can be useful for diagnosing problems
-- by tracing back the chain of events leading up to this event.
newDecisionTaskTimedOutEventAttributes ::
  -- | 'timeoutType'
  DecisionTaskTimeoutType ->
  -- | 'scheduledEventId'
  Prelude.Integer ->
  -- | 'startedEventId'
  Prelude.Integer ->
  DecisionTaskTimedOutEventAttributes
newDecisionTaskTimedOutEventAttributes :: DecisionTaskTimeoutType
-> Integer -> Integer -> DecisionTaskTimedOutEventAttributes
newDecisionTaskTimedOutEventAttributes
  DecisionTaskTimeoutType
pTimeoutType_
  Integer
pScheduledEventId_
  Integer
pStartedEventId_ =
    DecisionTaskTimedOutEventAttributes' :: DecisionTaskTimeoutType
-> Integer -> Integer -> DecisionTaskTimedOutEventAttributes
DecisionTaskTimedOutEventAttributes'
      { $sel:timeoutType:DecisionTaskTimedOutEventAttributes' :: DecisionTaskTimeoutType
timeoutType =
          DecisionTaskTimeoutType
pTimeoutType_,
        $sel:scheduledEventId:DecisionTaskTimedOutEventAttributes' :: Integer
scheduledEventId = Integer
pScheduledEventId_,
        $sel:startedEventId:DecisionTaskTimedOutEventAttributes' :: Integer
startedEventId = Integer
pStartedEventId_
      }

-- | The type of timeout that expired before the decision task could be
-- completed.
decisionTaskTimedOutEventAttributes_timeoutType :: Lens.Lens' DecisionTaskTimedOutEventAttributes DecisionTaskTimeoutType
decisionTaskTimedOutEventAttributes_timeoutType :: (DecisionTaskTimeoutType -> f DecisionTaskTimeoutType)
-> DecisionTaskTimedOutEventAttributes
-> f DecisionTaskTimedOutEventAttributes
decisionTaskTimedOutEventAttributes_timeoutType = (DecisionTaskTimedOutEventAttributes -> DecisionTaskTimeoutType)
-> (DecisionTaskTimedOutEventAttributes
    -> DecisionTaskTimeoutType -> DecisionTaskTimedOutEventAttributes)
-> Lens
     DecisionTaskTimedOutEventAttributes
     DecisionTaskTimedOutEventAttributes
     DecisionTaskTimeoutType
     DecisionTaskTimeoutType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecisionTaskTimedOutEventAttributes' {DecisionTaskTimeoutType
timeoutType :: DecisionTaskTimeoutType
$sel:timeoutType:DecisionTaskTimedOutEventAttributes' :: DecisionTaskTimedOutEventAttributes -> DecisionTaskTimeoutType
timeoutType} -> DecisionTaskTimeoutType
timeoutType) (\s :: DecisionTaskTimedOutEventAttributes
s@DecisionTaskTimedOutEventAttributes' {} DecisionTaskTimeoutType
a -> DecisionTaskTimedOutEventAttributes
s {$sel:timeoutType:DecisionTaskTimedOutEventAttributes' :: DecisionTaskTimeoutType
timeoutType = DecisionTaskTimeoutType
a} :: DecisionTaskTimedOutEventAttributes)

-- | The ID of the @DecisionTaskScheduled@ event that was recorded when this
-- decision task was scheduled. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
decisionTaskTimedOutEventAttributes_scheduledEventId :: Lens.Lens' DecisionTaskTimedOutEventAttributes Prelude.Integer
decisionTaskTimedOutEventAttributes_scheduledEventId :: (Integer -> f Integer)
-> DecisionTaskTimedOutEventAttributes
-> f DecisionTaskTimedOutEventAttributes
decisionTaskTimedOutEventAttributes_scheduledEventId = (DecisionTaskTimedOutEventAttributes -> Integer)
-> (DecisionTaskTimedOutEventAttributes
    -> Integer -> DecisionTaskTimedOutEventAttributes)
-> Lens
     DecisionTaskTimedOutEventAttributes
     DecisionTaskTimedOutEventAttributes
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecisionTaskTimedOutEventAttributes' {Integer
scheduledEventId :: Integer
$sel:scheduledEventId:DecisionTaskTimedOutEventAttributes' :: DecisionTaskTimedOutEventAttributes -> Integer
scheduledEventId} -> Integer
scheduledEventId) (\s :: DecisionTaskTimedOutEventAttributes
s@DecisionTaskTimedOutEventAttributes' {} Integer
a -> DecisionTaskTimedOutEventAttributes
s {$sel:scheduledEventId:DecisionTaskTimedOutEventAttributes' :: Integer
scheduledEventId = Integer
a} :: DecisionTaskTimedOutEventAttributes)

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

instance
  Core.FromJSON
    DecisionTaskTimedOutEventAttributes
  where
  parseJSON :: Value -> Parser DecisionTaskTimedOutEventAttributes
parseJSON =
    String
-> (Object -> Parser DecisionTaskTimedOutEventAttributes)
-> Value
-> Parser DecisionTaskTimedOutEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DecisionTaskTimedOutEventAttributes"
      ( \Object
x ->
          DecisionTaskTimeoutType
-> Integer -> Integer -> DecisionTaskTimedOutEventAttributes
DecisionTaskTimedOutEventAttributes'
            (DecisionTaskTimeoutType
 -> Integer -> Integer -> DecisionTaskTimedOutEventAttributes)
-> Parser DecisionTaskTimeoutType
-> Parser
     (Integer -> Integer -> DecisionTaskTimedOutEventAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser DecisionTaskTimeoutType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"timeoutType")
            Parser (Integer -> Integer -> DecisionTaskTimedOutEventAttributes)
-> Parser Integer
-> Parser (Integer -> DecisionTaskTimedOutEventAttributes)
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
"scheduledEventId")
            Parser (Integer -> DecisionTaskTimedOutEventAttributes)
-> Parser Integer -> Parser DecisionTaskTimedOutEventAttributes
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
    DecisionTaskTimedOutEventAttributes

instance
  Prelude.NFData
    DecisionTaskTimedOutEventAttributes