{-# 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-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.ActivityTaskCompletedEventAttributes 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 @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
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]
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
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.
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'
      { $sel:result:ActivityTaskCompletedEventAttributes' :: Maybe Text
result =
          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 :: Lens' ActivityTaskCompletedEventAttributes (Maybe Text)
activityTaskCompletedEventAttributes_result = 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 :: Lens' ActivityTaskCompletedEventAttributes Integer
activityTaskCompletedEventAttributes_scheduledEventId = 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 :: Lens' ActivityTaskCompletedEventAttributes Integer
activityTaskCompletedEventAttributes_startedEventId = 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
  Data.FromJSON
    ActivityTaskCompletedEventAttributes
  where
  parseJSON :: Value -> Parser ActivityTaskCompletedEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ActivityTaskCompletedEventAttributes"
      ( \Object
x ->
          Maybe Text
-> Integer -> Integer -> ActivityTaskCompletedEventAttributes
ActivityTaskCompletedEventAttributes'
            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
"result")
            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
    ActivityTaskCompletedEventAttributes
  where
  hashWithSalt :: Int -> ActivityTaskCompletedEventAttributes -> Int
hashWithSalt
    Int
_salt
    ActivityTaskCompletedEventAttributes' {Integer
Maybe Text
startedEventId :: Integer
scheduledEventId :: Integer
result :: Maybe Text
$sel:startedEventId:ActivityTaskCompletedEventAttributes' :: ActivityTaskCompletedEventAttributes -> Integer
$sel:scheduledEventId:ActivityTaskCompletedEventAttributes' :: ActivityTaskCompletedEventAttributes -> Integer
$sel:result:ActivityTaskCompletedEventAttributes' :: ActivityTaskCompletedEventAttributes -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
result
        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
    ActivityTaskCompletedEventAttributes
  where
  rnf :: ActivityTaskCompletedEventAttributes -> ()
rnf ActivityTaskCompletedEventAttributes' {Integer
Maybe Text
startedEventId :: Integer
scheduledEventId :: Integer
result :: Maybe Text
$sel:startedEventId:ActivityTaskCompletedEventAttributes' :: ActivityTaskCompletedEventAttributes -> Integer
$sel:scheduledEventId:ActivityTaskCompletedEventAttributes' :: ActivityTaskCompletedEventAttributes -> Integer
$sel:result:ActivityTaskCompletedEventAttributes' :: ActivityTaskCompletedEventAttributes -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
result
      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