{-# 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-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.ActivityTaskCanceledEventAttributes 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 @ActivityTaskCanceled@ event.
--
-- /See:/ 'newActivityTaskCanceledEventAttributes' smart constructor.
data ActivityTaskCanceledEventAttributes = ActivityTaskCanceledEventAttributes'
  { -- | Details of the cancellation.
    ActivityTaskCanceledEventAttributes -> Maybe Text
details :: Prelude.Maybe Prelude.Text,
    -- | 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,
    -- | 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
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]
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
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.
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:
--
-- 'details', 'activityTaskCanceledEventAttributes_details' - Details of the cancellation.
--
-- '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.
--
-- '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'
      { $sel:details:ActivityTaskCanceledEventAttributes' :: Maybe Text
details =
          forall a. Maybe a
Prelude.Nothing,
        $sel:latestCancelRequestedEventId:ActivityTaskCanceledEventAttributes' :: Maybe Integer
latestCancelRequestedEventId =
          forall a. Maybe a
Prelude.Nothing,
        $sel:scheduledEventId:ActivityTaskCanceledEventAttributes' :: Integer
scheduledEventId = Integer
pScheduledEventId_,
        $sel:startedEventId:ActivityTaskCanceledEventAttributes' :: Integer
startedEventId = Integer
pStartedEventId_
      }

-- | Details of the cancellation.
activityTaskCanceledEventAttributes_details :: Lens.Lens' ActivityTaskCanceledEventAttributes (Prelude.Maybe Prelude.Text)
activityTaskCanceledEventAttributes_details :: Lens' ActivityTaskCanceledEventAttributes (Maybe Text)
activityTaskCanceledEventAttributes_details = 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)

-- | 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 :: Lens' ActivityTaskCanceledEventAttributes (Maybe Integer)
activityTaskCanceledEventAttributes_latestCancelRequestedEventId = 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)

-- | 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 :: Lens' ActivityTaskCanceledEventAttributes Integer
activityTaskCanceledEventAttributes_scheduledEventId = 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 :: Lens' ActivityTaskCanceledEventAttributes Integer
activityTaskCanceledEventAttributes_startedEventId = 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
  Data.FromJSON
    ActivityTaskCanceledEventAttributes
  where
  parseJSON :: Value -> Parser ActivityTaskCanceledEventAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ActivityTaskCanceledEventAttributes"
      ( \Object
x ->
          Maybe Text
-> Maybe Integer
-> Integer
-> Integer
-> ActivityTaskCanceledEventAttributes
ActivityTaskCanceledEventAttributes'
            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
"details")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"latestCancelRequestedEventId")
            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
    ActivityTaskCanceledEventAttributes
  where
  hashWithSalt :: Int -> ActivityTaskCanceledEventAttributes -> Int
hashWithSalt
    Int
_salt
    ActivityTaskCanceledEventAttributes' {Integer
Maybe Integer
Maybe Text
startedEventId :: Integer
scheduledEventId :: Integer
latestCancelRequestedEventId :: Maybe Integer
details :: Maybe Text
$sel:startedEventId:ActivityTaskCanceledEventAttributes' :: ActivityTaskCanceledEventAttributes -> Integer
$sel:scheduledEventId:ActivityTaskCanceledEventAttributes' :: ActivityTaskCanceledEventAttributes -> Integer
$sel:latestCancelRequestedEventId:ActivityTaskCanceledEventAttributes' :: ActivityTaskCanceledEventAttributes -> Maybe Integer
$sel:details:ActivityTaskCanceledEventAttributes' :: ActivityTaskCanceledEventAttributes -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
details
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
latestCancelRequestedEventId
        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
    ActivityTaskCanceledEventAttributes
  where
  rnf :: ActivityTaskCanceledEventAttributes -> ()
rnf ActivityTaskCanceledEventAttributes' {Integer
Maybe Integer
Maybe Text
startedEventId :: Integer
scheduledEventId :: Integer
latestCancelRequestedEventId :: Maybe Integer
details :: Maybe Text
$sel:startedEventId:ActivityTaskCanceledEventAttributes' :: ActivityTaskCanceledEventAttributes -> Integer
$sel:scheduledEventId:ActivityTaskCanceledEventAttributes' :: ActivityTaskCanceledEventAttributes -> Integer
$sel:latestCancelRequestedEventId:ActivityTaskCanceledEventAttributes' :: ActivityTaskCanceledEventAttributes -> Maybe Integer
$sel:details:ActivityTaskCanceledEventAttributes' :: ActivityTaskCanceledEventAttributes -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
details
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
latestCancelRequestedEventId
      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