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

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

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

-- |
-- Create a value of 'ActivityTaskCompletedEventAttributes' 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:
--
-- 'result', 'activityTaskCompletedEventAttributes_result' - The results of the activity task.
--
-- 'scheduledEventId', 'activityTaskCompletedEventAttributes_scheduledEventId' - The ID of the @ActivityTaskScheduled@ event that was recorded when this
-- activity task was scheduled. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
--
-- 'startedEventId', 'activityTaskCompletedEventAttributes_startedEventId' - The ID of the @ActivityTaskStarted@ event recorded when this activity
-- task was started. This information can be useful for diagnosing problems
-- by tracing back the chain of events leading up to this event.
newActivityTaskCompletedEventAttributes ::
  -- | 'scheduledEventId'
  Prelude.Integer ->
  -- | 'startedEventId'
  Prelude.Integer ->
  ActivityTaskCompletedEventAttributes
newActivityTaskCompletedEventAttributes :: Integer -> Integer -> ActivityTaskCompletedEventAttributes
newActivityTaskCompletedEventAttributes
  Integer
pScheduledEventId_
  Integer
pStartedEventId_ =
    ActivityTaskCompletedEventAttributes' :: Maybe Text
-> Integer -> Integer -> ActivityTaskCompletedEventAttributes
ActivityTaskCompletedEventAttributes'
      { $sel:result:ActivityTaskCompletedEventAttributes' :: Maybe Text
result =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:scheduledEventId:ActivityTaskCompletedEventAttributes' :: Integer
scheduledEventId = Integer
pScheduledEventId_,
        $sel:startedEventId:ActivityTaskCompletedEventAttributes' :: Integer
startedEventId = Integer
pStartedEventId_
      }

-- | The results of the activity task.
activityTaskCompletedEventAttributes_result :: Lens.Lens' ActivityTaskCompletedEventAttributes (Prelude.Maybe Prelude.Text)
activityTaskCompletedEventAttributes_result :: (Maybe Text -> f (Maybe Text))
-> ActivityTaskCompletedEventAttributes
-> f ActivityTaskCompletedEventAttributes
activityTaskCompletedEventAttributes_result = (ActivityTaskCompletedEventAttributes -> Maybe Text)
-> (ActivityTaskCompletedEventAttributes
    -> Maybe Text -> ActivityTaskCompletedEventAttributes)
-> Lens
     ActivityTaskCompletedEventAttributes
     ActivityTaskCompletedEventAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityTaskCompletedEventAttributes' {Maybe Text
result :: Maybe Text
$sel:result:ActivityTaskCompletedEventAttributes' :: ActivityTaskCompletedEventAttributes -> Maybe Text
result} -> Maybe Text
result) (\s :: ActivityTaskCompletedEventAttributes
s@ActivityTaskCompletedEventAttributes' {} Maybe Text
a -> ActivityTaskCompletedEventAttributes
s {$sel:result:ActivityTaskCompletedEventAttributes' :: Maybe Text
result = Maybe Text
a} :: ActivityTaskCompletedEventAttributes)

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

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

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

instance
  Prelude.NFData
    ActivityTaskCompletedEventAttributes