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

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

-- | Provides the details of the @ActivityTaskCanceled@ event.
--
-- /See:/ 'newActivityTaskCanceledEventAttributes' smart constructor.
data ActivityTaskCanceledEventAttributes = ActivityTaskCanceledEventAttributes'
  { -- | If set, contains the ID of the last @ActivityTaskCancelRequested@ event
    -- recorded for this activity task. This information can be useful for
    -- diagnosing problems by tracing back the chain of events leading up to
    -- this event.
    ActivityTaskCanceledEventAttributes -> Maybe Integer
latestCancelRequestedEventId :: Prelude.Maybe Prelude.Integer,
    -- | Details of the cancellation.
    ActivityTaskCanceledEventAttributes -> Maybe Text
details :: 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.
    ActivityTaskCanceledEventAttributes -> 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.
    ActivityTaskCanceledEventAttributes -> Integer
startedEventId :: Prelude.Integer
  }
  deriving (ActivityTaskCanceledEventAttributes
-> ActivityTaskCanceledEventAttributes -> Bool
(ActivityTaskCanceledEventAttributes
 -> ActivityTaskCanceledEventAttributes -> Bool)
-> (ActivityTaskCanceledEventAttributes
    -> ActivityTaskCanceledEventAttributes -> Bool)
-> Eq ActivityTaskCanceledEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActivityTaskCanceledEventAttributes
-> ActivityTaskCanceledEventAttributes -> Bool
$c/= :: ActivityTaskCanceledEventAttributes
-> ActivityTaskCanceledEventAttributes -> Bool
== :: ActivityTaskCanceledEventAttributes
-> ActivityTaskCanceledEventAttributes -> Bool
$c== :: ActivityTaskCanceledEventAttributes
-> ActivityTaskCanceledEventAttributes -> Bool
Prelude.Eq, ReadPrec [ActivityTaskCanceledEventAttributes]
ReadPrec ActivityTaskCanceledEventAttributes
Int -> ReadS ActivityTaskCanceledEventAttributes
ReadS [ActivityTaskCanceledEventAttributes]
(Int -> ReadS ActivityTaskCanceledEventAttributes)
-> ReadS [ActivityTaskCanceledEventAttributes]
-> ReadPrec ActivityTaskCanceledEventAttributes
-> ReadPrec [ActivityTaskCanceledEventAttributes]
-> Read ActivityTaskCanceledEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActivityTaskCanceledEventAttributes]
$creadListPrec :: ReadPrec [ActivityTaskCanceledEventAttributes]
readPrec :: ReadPrec ActivityTaskCanceledEventAttributes
$creadPrec :: ReadPrec ActivityTaskCanceledEventAttributes
readList :: ReadS [ActivityTaskCanceledEventAttributes]
$creadList :: ReadS [ActivityTaskCanceledEventAttributes]
readsPrec :: Int -> ReadS ActivityTaskCanceledEventAttributes
$creadsPrec :: Int -> ReadS ActivityTaskCanceledEventAttributes
Prelude.Read, Int -> ActivityTaskCanceledEventAttributes -> ShowS
[ActivityTaskCanceledEventAttributes] -> ShowS
ActivityTaskCanceledEventAttributes -> String
(Int -> ActivityTaskCanceledEventAttributes -> ShowS)
-> (ActivityTaskCanceledEventAttributes -> String)
-> ([ActivityTaskCanceledEventAttributes] -> ShowS)
-> Show ActivityTaskCanceledEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActivityTaskCanceledEventAttributes] -> ShowS
$cshowList :: [ActivityTaskCanceledEventAttributes] -> ShowS
show :: ActivityTaskCanceledEventAttributes -> String
$cshow :: ActivityTaskCanceledEventAttributes -> String
showsPrec :: Int -> ActivityTaskCanceledEventAttributes -> ShowS
$cshowsPrec :: Int -> ActivityTaskCanceledEventAttributes -> ShowS
Prelude.Show, (forall x.
 ActivityTaskCanceledEventAttributes
 -> Rep ActivityTaskCanceledEventAttributes x)
-> (forall x.
    Rep ActivityTaskCanceledEventAttributes x
    -> ActivityTaskCanceledEventAttributes)
-> Generic ActivityTaskCanceledEventAttributes
forall x.
Rep ActivityTaskCanceledEventAttributes x
-> ActivityTaskCanceledEventAttributes
forall x.
ActivityTaskCanceledEventAttributes
-> Rep ActivityTaskCanceledEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ActivityTaskCanceledEventAttributes x
-> ActivityTaskCanceledEventAttributes
$cfrom :: forall x.
ActivityTaskCanceledEventAttributes
-> Rep ActivityTaskCanceledEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ActivityTaskCanceledEventAttributes' 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:
--
-- 'latestCancelRequestedEventId', 'activityTaskCanceledEventAttributes_latestCancelRequestedEventId' - If set, contains the ID of the last @ActivityTaskCancelRequested@ event
-- recorded for this activity task. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
--
-- 'details', 'activityTaskCanceledEventAttributes_details' - Details of the cancellation.
--
-- 'scheduledEventId', 'activityTaskCanceledEventAttributes_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', 'activityTaskCanceledEventAttributes_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.
newActivityTaskCanceledEventAttributes ::
  -- | 'scheduledEventId'
  Prelude.Integer ->
  -- | 'startedEventId'
  Prelude.Integer ->
  ActivityTaskCanceledEventAttributes
newActivityTaskCanceledEventAttributes :: Integer -> Integer -> ActivityTaskCanceledEventAttributes
newActivityTaskCanceledEventAttributes
  Integer
pScheduledEventId_
  Integer
pStartedEventId_ =
    ActivityTaskCanceledEventAttributes' :: Maybe Integer
-> Maybe Text
-> Integer
-> Integer
-> ActivityTaskCanceledEventAttributes
ActivityTaskCanceledEventAttributes'
      { $sel:latestCancelRequestedEventId:ActivityTaskCanceledEventAttributes' :: Maybe Integer
latestCancelRequestedEventId =
          Maybe Integer
forall a. Maybe a
Prelude.Nothing,
        $sel:details:ActivityTaskCanceledEventAttributes' :: Maybe Text
details = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:scheduledEventId:ActivityTaskCanceledEventAttributes' :: Integer
scheduledEventId = Integer
pScheduledEventId_,
        $sel:startedEventId:ActivityTaskCanceledEventAttributes' :: Integer
startedEventId = Integer
pStartedEventId_
      }

-- | If set, contains the ID of the last @ActivityTaskCancelRequested@ event
-- recorded for this activity task. This information can be useful for
-- diagnosing problems by tracing back the chain of events leading up to
-- this event.
activityTaskCanceledEventAttributes_latestCancelRequestedEventId :: Lens.Lens' ActivityTaskCanceledEventAttributes (Prelude.Maybe Prelude.Integer)
activityTaskCanceledEventAttributes_latestCancelRequestedEventId :: (Maybe Integer -> f (Maybe Integer))
-> ActivityTaskCanceledEventAttributes
-> f ActivityTaskCanceledEventAttributes
activityTaskCanceledEventAttributes_latestCancelRequestedEventId = (ActivityTaskCanceledEventAttributes -> Maybe Integer)
-> (ActivityTaskCanceledEventAttributes
    -> Maybe Integer -> ActivityTaskCanceledEventAttributes)
-> Lens
     ActivityTaskCanceledEventAttributes
     ActivityTaskCanceledEventAttributes
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityTaskCanceledEventAttributes' {Maybe Integer
latestCancelRequestedEventId :: Maybe Integer
$sel:latestCancelRequestedEventId:ActivityTaskCanceledEventAttributes' :: ActivityTaskCanceledEventAttributes -> Maybe Integer
latestCancelRequestedEventId} -> Maybe Integer
latestCancelRequestedEventId) (\s :: ActivityTaskCanceledEventAttributes
s@ActivityTaskCanceledEventAttributes' {} Maybe Integer
a -> ActivityTaskCanceledEventAttributes
s {$sel:latestCancelRequestedEventId:ActivityTaskCanceledEventAttributes' :: Maybe Integer
latestCancelRequestedEventId = Maybe Integer
a} :: ActivityTaskCanceledEventAttributes)

-- | Details of the cancellation.
activityTaskCanceledEventAttributes_details :: Lens.Lens' ActivityTaskCanceledEventAttributes (Prelude.Maybe Prelude.Text)
activityTaskCanceledEventAttributes_details :: (Maybe Text -> f (Maybe Text))
-> ActivityTaskCanceledEventAttributes
-> f ActivityTaskCanceledEventAttributes
activityTaskCanceledEventAttributes_details = (ActivityTaskCanceledEventAttributes -> Maybe Text)
-> (ActivityTaskCanceledEventAttributes
    -> Maybe Text -> ActivityTaskCanceledEventAttributes)
-> Lens
     ActivityTaskCanceledEventAttributes
     ActivityTaskCanceledEventAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityTaskCanceledEventAttributes' {Maybe Text
details :: Maybe Text
$sel:details:ActivityTaskCanceledEventAttributes' :: ActivityTaskCanceledEventAttributes -> Maybe Text
details} -> Maybe Text
details) (\s :: ActivityTaskCanceledEventAttributes
s@ActivityTaskCanceledEventAttributes' {} Maybe Text
a -> ActivityTaskCanceledEventAttributes
s {$sel:details:ActivityTaskCanceledEventAttributes' :: Maybe Text
details = Maybe Text
a} :: ActivityTaskCanceledEventAttributes)

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

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

instance
  Core.FromJSON
    ActivityTaskCanceledEventAttributes
  where
  parseJSON :: Value -> Parser ActivityTaskCanceledEventAttributes
parseJSON =
    String
-> (Object -> Parser ActivityTaskCanceledEventAttributes)
-> Value
-> Parser ActivityTaskCanceledEventAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActivityTaskCanceledEventAttributes"
      ( \Object
x ->
          Maybe Integer
-> Maybe Text
-> Integer
-> Integer
-> ActivityTaskCanceledEventAttributes
ActivityTaskCanceledEventAttributes'
            (Maybe Integer
 -> Maybe Text
 -> Integer
 -> Integer
 -> ActivityTaskCanceledEventAttributes)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Text
      -> Integer -> Integer -> ActivityTaskCanceledEventAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"latestCancelRequestedEventId")
            Parser
  (Maybe Text
   -> Integer -> Integer -> ActivityTaskCanceledEventAttributes)
-> Parser (Maybe Text)
-> Parser
     (Integer -> Integer -> ActivityTaskCanceledEventAttributes)
forall (f :: * -> *) a b. Applicative f => 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
"details")
            Parser (Integer -> Integer -> ActivityTaskCanceledEventAttributes)
-> Parser Integer
-> Parser (Integer -> ActivityTaskCanceledEventAttributes)
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 -> ActivityTaskCanceledEventAttributes)
-> Parser Integer -> Parser ActivityTaskCanceledEventAttributes
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
    ActivityTaskCanceledEventAttributes

instance
  Prelude.NFData
    ActivityTaskCanceledEventAttributes