{-# 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.DecisionTaskCompletedEventAttributes
-- 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.SWF.Types.DecisionTaskCompletedEventAttributes 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 the details of the @DecisionTaskCompleted@ event.
--
-- /See:/ 'newDecisionTaskCompletedEventAttributes' smart constructor.
data DecisionTaskCompletedEventAttributes = DecisionTaskCompletedEventAttributes'
  { -- | User defined context for the workflow execution.
    DecisionTaskCompletedEventAttributes -> Maybe Text
executionContext :: Prelude.Maybe Prelude.Text,
    -- | 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.
    DecisionTaskCompletedEventAttributes -> 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.
    DecisionTaskCompletedEventAttributes -> Integer
startedEventId :: Prelude.Integer
  }
  deriving (DecisionTaskCompletedEventAttributes
-> DecisionTaskCompletedEventAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DecisionTaskCompletedEventAttributes
-> DecisionTaskCompletedEventAttributes -> Bool
$c/= :: DecisionTaskCompletedEventAttributes
-> DecisionTaskCompletedEventAttributes -> Bool
== :: DecisionTaskCompletedEventAttributes
-> DecisionTaskCompletedEventAttributes -> Bool
$c== :: DecisionTaskCompletedEventAttributes
-> DecisionTaskCompletedEventAttributes -> Bool
Prelude.Eq, ReadPrec [DecisionTaskCompletedEventAttributes]
ReadPrec DecisionTaskCompletedEventAttributes
Int -> ReadS DecisionTaskCompletedEventAttributes
ReadS [DecisionTaskCompletedEventAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DecisionTaskCompletedEventAttributes]
$creadListPrec :: ReadPrec [DecisionTaskCompletedEventAttributes]
readPrec :: ReadPrec DecisionTaskCompletedEventAttributes
$creadPrec :: ReadPrec DecisionTaskCompletedEventAttributes
readList :: ReadS [DecisionTaskCompletedEventAttributes]
$creadList :: ReadS [DecisionTaskCompletedEventAttributes]
readsPrec :: Int -> ReadS DecisionTaskCompletedEventAttributes
$creadsPrec :: Int -> ReadS DecisionTaskCompletedEventAttributes
Prelude.Read, Int -> DecisionTaskCompletedEventAttributes -> ShowS
[DecisionTaskCompletedEventAttributes] -> ShowS
DecisionTaskCompletedEventAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DecisionTaskCompletedEventAttributes] -> ShowS
$cshowList :: [DecisionTaskCompletedEventAttributes] -> ShowS
show :: DecisionTaskCompletedEventAttributes -> String
$cshow :: DecisionTaskCompletedEventAttributes -> String
showsPrec :: Int -> DecisionTaskCompletedEventAttributes -> ShowS
$cshowsPrec :: Int -> DecisionTaskCompletedEventAttributes -> ShowS
Prelude.Show, forall x.
Rep DecisionTaskCompletedEventAttributes x
-> DecisionTaskCompletedEventAttributes
forall x.
DecisionTaskCompletedEventAttributes
-> Rep DecisionTaskCompletedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DecisionTaskCompletedEventAttributes x
-> DecisionTaskCompletedEventAttributes
$cfrom :: forall x.
DecisionTaskCompletedEventAttributes
-> Rep DecisionTaskCompletedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'DecisionTaskCompletedEventAttributes' 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:
--
-- 'executionContext', 'decisionTaskCompletedEventAttributes_executionContext' - User defined context for the workflow execution.
--
-- 'scheduledEventId', 'decisionTaskCompletedEventAttributes_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', 'decisionTaskCompletedEventAttributes_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.
newDecisionTaskCompletedEventAttributes ::
  -- | 'scheduledEventId'
  Prelude.Integer ->
  -- | 'startedEventId'
  Prelude.Integer ->
  DecisionTaskCompletedEventAttributes
newDecisionTaskCompletedEventAttributes :: Integer -> Integer -> DecisionTaskCompletedEventAttributes
newDecisionTaskCompletedEventAttributes
  Integer
pScheduledEventId_
  Integer
pStartedEventId_ =
    DecisionTaskCompletedEventAttributes'
      { $sel:executionContext:DecisionTaskCompletedEventAttributes' :: Maybe Text
executionContext =
          forall a. Maybe a
Prelude.Nothing,
        $sel:scheduledEventId:DecisionTaskCompletedEventAttributes' :: Integer
scheduledEventId = Integer
pScheduledEventId_,
        $sel:startedEventId:DecisionTaskCompletedEventAttributes' :: Integer
startedEventId = Integer
pStartedEventId_
      }

-- | User defined context for the workflow execution.
decisionTaskCompletedEventAttributes_executionContext :: Lens.Lens' DecisionTaskCompletedEventAttributes (Prelude.Maybe Prelude.Text)
decisionTaskCompletedEventAttributes_executionContext :: Lens' DecisionTaskCompletedEventAttributes (Maybe Text)
decisionTaskCompletedEventAttributes_executionContext = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecisionTaskCompletedEventAttributes' {Maybe Text
executionContext :: Maybe Text
$sel:executionContext:DecisionTaskCompletedEventAttributes' :: DecisionTaskCompletedEventAttributes -> Maybe Text
executionContext} -> Maybe Text
executionContext) (\s :: DecisionTaskCompletedEventAttributes
s@DecisionTaskCompletedEventAttributes' {} Maybe Text
a -> DecisionTaskCompletedEventAttributes
s {$sel:executionContext:DecisionTaskCompletedEventAttributes' :: Maybe Text
executionContext = Maybe Text
a} :: DecisionTaskCompletedEventAttributes)

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

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

instance
  Data.FromJSON
    DecisionTaskCompletedEventAttributes
  where
  parseJSON :: Value -> Parser DecisionTaskCompletedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DecisionTaskCompletedEventAttributes"
      ( \Object
x ->
          Maybe Text
-> Integer -> Integer -> DecisionTaskCompletedEventAttributes
DecisionTaskCompletedEventAttributes'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"executionContext")
            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
"scheduledEventId")
            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
"startedEventId")
      )

instance
  Prelude.Hashable
    DecisionTaskCompletedEventAttributes
  where
  hashWithSalt :: Int -> DecisionTaskCompletedEventAttributes -> Int
hashWithSalt
    Int
_salt
    DecisionTaskCompletedEventAttributes' {Integer
Maybe Text
startedEventId :: Integer
scheduledEventId :: Integer
executionContext :: Maybe Text
$sel:startedEventId:DecisionTaskCompletedEventAttributes' :: DecisionTaskCompletedEventAttributes -> Integer
$sel:scheduledEventId:DecisionTaskCompletedEventAttributes' :: DecisionTaskCompletedEventAttributes -> Integer
$sel:executionContext:DecisionTaskCompletedEventAttributes' :: DecisionTaskCompletedEventAttributes -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
executionContext
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
scheduledEventId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
startedEventId

instance
  Prelude.NFData
    DecisionTaskCompletedEventAttributes
  where
  rnf :: DecisionTaskCompletedEventAttributes -> ()
rnf DecisionTaskCompletedEventAttributes' {Integer
Maybe Text
startedEventId :: Integer
scheduledEventId :: Integer
executionContext :: Maybe Text
$sel:startedEventId:DecisionTaskCompletedEventAttributes' :: DecisionTaskCompletedEventAttributes -> Integer
$sel:scheduledEventId:DecisionTaskCompletedEventAttributes' :: DecisionTaskCompletedEventAttributes -> Integer
$sel:executionContext:DecisionTaskCompletedEventAttributes' :: DecisionTaskCompletedEventAttributes -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
executionContext
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
scheduledEventId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
startedEventId