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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(DecisionTaskCompletedEventAttributes
 -> DecisionTaskCompletedEventAttributes -> Bool)
-> (DecisionTaskCompletedEventAttributes
    -> DecisionTaskCompletedEventAttributes -> Bool)
-> Eq DecisionTaskCompletedEventAttributes
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]
(Int -> ReadS DecisionTaskCompletedEventAttributes)
-> ReadS [DecisionTaskCompletedEventAttributes]
-> ReadPrec DecisionTaskCompletedEventAttributes
-> ReadPrec [DecisionTaskCompletedEventAttributes]
-> Read 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
(Int -> DecisionTaskCompletedEventAttributes -> ShowS)
-> (DecisionTaskCompletedEventAttributes -> String)
-> ([DecisionTaskCompletedEventAttributes] -> ShowS)
-> Show DecisionTaskCompletedEventAttributes
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.
 DecisionTaskCompletedEventAttributes
 -> Rep DecisionTaskCompletedEventAttributes x)
-> (forall x.
    Rep DecisionTaskCompletedEventAttributes x
    -> DecisionTaskCompletedEventAttributes)
-> Generic DecisionTaskCompletedEventAttributes
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' :: Maybe Text
-> Integer -> Integer -> DecisionTaskCompletedEventAttributes
DecisionTaskCompletedEventAttributes'
      { $sel:executionContext:DecisionTaskCompletedEventAttributes' :: Maybe Text
executionContext =
          Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> DecisionTaskCompletedEventAttributes
-> f DecisionTaskCompletedEventAttributes
decisionTaskCompletedEventAttributes_executionContext = (DecisionTaskCompletedEventAttributes -> Maybe Text)
-> (DecisionTaskCompletedEventAttributes
    -> Maybe Text -> DecisionTaskCompletedEventAttributes)
-> Lens
     DecisionTaskCompletedEventAttributes
     DecisionTaskCompletedEventAttributes
     (Maybe Text)
     (Maybe Text)
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 :: (Integer -> f Integer)
-> DecisionTaskCompletedEventAttributes
-> f DecisionTaskCompletedEventAttributes
decisionTaskCompletedEventAttributes_scheduledEventId = (DecisionTaskCompletedEventAttributes -> Integer)
-> (DecisionTaskCompletedEventAttributes
    -> Integer -> DecisionTaskCompletedEventAttributes)
-> Lens
     DecisionTaskCompletedEventAttributes
     DecisionTaskCompletedEventAttributes
     Integer
     Integer
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 :: (Integer -> f Integer)
-> DecisionTaskCompletedEventAttributes
-> f DecisionTaskCompletedEventAttributes
decisionTaskCompletedEventAttributes_startedEventId = (DecisionTaskCompletedEventAttributes -> Integer)
-> (DecisionTaskCompletedEventAttributes
    -> Integer -> DecisionTaskCompletedEventAttributes)
-> Lens
     DecisionTaskCompletedEventAttributes
     DecisionTaskCompletedEventAttributes
     Integer
     Integer
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
  Core.FromJSON
    DecisionTaskCompletedEventAttributes
  where
  parseJSON :: Value -> Parser DecisionTaskCompletedEventAttributes
parseJSON =
    String
-> (Object -> Parser DecisionTaskCompletedEventAttributes)
-> Value
-> Parser DecisionTaskCompletedEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DecisionTaskCompletedEventAttributes"
      ( \Object
x ->
          Maybe Text
-> Integer -> Integer -> DecisionTaskCompletedEventAttributes
DecisionTaskCompletedEventAttributes'
            (Maybe Text
 -> Integer -> Integer -> DecisionTaskCompletedEventAttributes)
-> Parser (Maybe Text)
-> Parser
     (Integer -> Integer -> DecisionTaskCompletedEventAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"executionContext")
            Parser (Integer -> Integer -> DecisionTaskCompletedEventAttributes)
-> Parser Integer
-> Parser (Integer -> DecisionTaskCompletedEventAttributes)
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 -> DecisionTaskCompletedEventAttributes)
-> Parser Integer -> Parser DecisionTaskCompletedEventAttributes
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
    DecisionTaskCompletedEventAttributes

instance
  Prelude.NFData
    DecisionTaskCompletedEventAttributes