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

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

-- | Provides the details of the @ActivityTaskStarted@ event.
--
-- /See:/ 'newActivityTaskStartedEventAttributes' smart constructor.
data ActivityTaskStartedEventAttributes = ActivityTaskStartedEventAttributes'
  { -- | Identity of the worker that was assigned this task. This aids
    -- diagnostics when problems arise. The form of this identity is user
    -- defined.
    ActivityTaskStartedEventAttributes -> Maybe Text
identity :: 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.
    ActivityTaskStartedEventAttributes -> Integer
scheduledEventId :: Prelude.Integer
  }
  deriving (ActivityTaskStartedEventAttributes
-> ActivityTaskStartedEventAttributes -> Bool
(ActivityTaskStartedEventAttributes
 -> ActivityTaskStartedEventAttributes -> Bool)
-> (ActivityTaskStartedEventAttributes
    -> ActivityTaskStartedEventAttributes -> Bool)
-> Eq ActivityTaskStartedEventAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActivityTaskStartedEventAttributes
-> ActivityTaskStartedEventAttributes -> Bool
$c/= :: ActivityTaskStartedEventAttributes
-> ActivityTaskStartedEventAttributes -> Bool
== :: ActivityTaskStartedEventAttributes
-> ActivityTaskStartedEventAttributes -> Bool
$c== :: ActivityTaskStartedEventAttributes
-> ActivityTaskStartedEventAttributes -> Bool
Prelude.Eq, ReadPrec [ActivityTaskStartedEventAttributes]
ReadPrec ActivityTaskStartedEventAttributes
Int -> ReadS ActivityTaskStartedEventAttributes
ReadS [ActivityTaskStartedEventAttributes]
(Int -> ReadS ActivityTaskStartedEventAttributes)
-> ReadS [ActivityTaskStartedEventAttributes]
-> ReadPrec ActivityTaskStartedEventAttributes
-> ReadPrec [ActivityTaskStartedEventAttributes]
-> Read ActivityTaskStartedEventAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActivityTaskStartedEventAttributes]
$creadListPrec :: ReadPrec [ActivityTaskStartedEventAttributes]
readPrec :: ReadPrec ActivityTaskStartedEventAttributes
$creadPrec :: ReadPrec ActivityTaskStartedEventAttributes
readList :: ReadS [ActivityTaskStartedEventAttributes]
$creadList :: ReadS [ActivityTaskStartedEventAttributes]
readsPrec :: Int -> ReadS ActivityTaskStartedEventAttributes
$creadsPrec :: Int -> ReadS ActivityTaskStartedEventAttributes
Prelude.Read, Int -> ActivityTaskStartedEventAttributes -> ShowS
[ActivityTaskStartedEventAttributes] -> ShowS
ActivityTaskStartedEventAttributes -> String
(Int -> ActivityTaskStartedEventAttributes -> ShowS)
-> (ActivityTaskStartedEventAttributes -> String)
-> ([ActivityTaskStartedEventAttributes] -> ShowS)
-> Show ActivityTaskStartedEventAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActivityTaskStartedEventAttributes] -> ShowS
$cshowList :: [ActivityTaskStartedEventAttributes] -> ShowS
show :: ActivityTaskStartedEventAttributes -> String
$cshow :: ActivityTaskStartedEventAttributes -> String
showsPrec :: Int -> ActivityTaskStartedEventAttributes -> ShowS
$cshowsPrec :: Int -> ActivityTaskStartedEventAttributes -> ShowS
Prelude.Show, (forall x.
 ActivityTaskStartedEventAttributes
 -> Rep ActivityTaskStartedEventAttributes x)
-> (forall x.
    Rep ActivityTaskStartedEventAttributes x
    -> ActivityTaskStartedEventAttributes)
-> Generic ActivityTaskStartedEventAttributes
forall x.
Rep ActivityTaskStartedEventAttributes x
-> ActivityTaskStartedEventAttributes
forall x.
ActivityTaskStartedEventAttributes
-> Rep ActivityTaskStartedEventAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ActivityTaskStartedEventAttributes x
-> ActivityTaskStartedEventAttributes
$cfrom :: forall x.
ActivityTaskStartedEventAttributes
-> Rep ActivityTaskStartedEventAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ActivityTaskStartedEventAttributes' 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:
--
-- 'identity', 'activityTaskStartedEventAttributes_identity' - Identity of the worker that was assigned this task. This aids
-- diagnostics when problems arise. The form of this identity is user
-- defined.
--
-- 'scheduledEventId', 'activityTaskStartedEventAttributes_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.
newActivityTaskStartedEventAttributes ::
  -- | 'scheduledEventId'
  Prelude.Integer ->
  ActivityTaskStartedEventAttributes
newActivityTaskStartedEventAttributes :: Integer -> ActivityTaskStartedEventAttributes
newActivityTaskStartedEventAttributes
  Integer
pScheduledEventId_ =
    ActivityTaskStartedEventAttributes' :: Maybe Text -> Integer -> ActivityTaskStartedEventAttributes
ActivityTaskStartedEventAttributes'
      { $sel:identity:ActivityTaskStartedEventAttributes' :: Maybe Text
identity =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:scheduledEventId:ActivityTaskStartedEventAttributes' :: Integer
scheduledEventId = Integer
pScheduledEventId_
      }

-- | Identity of the worker that was assigned this task. This aids
-- diagnostics when problems arise. The form of this identity is user
-- defined.
activityTaskStartedEventAttributes_identity :: Lens.Lens' ActivityTaskStartedEventAttributes (Prelude.Maybe Prelude.Text)
activityTaskStartedEventAttributes_identity :: (Maybe Text -> f (Maybe Text))
-> ActivityTaskStartedEventAttributes
-> f ActivityTaskStartedEventAttributes
activityTaskStartedEventAttributes_identity = (ActivityTaskStartedEventAttributes -> Maybe Text)
-> (ActivityTaskStartedEventAttributes
    -> Maybe Text -> ActivityTaskStartedEventAttributes)
-> Lens
     ActivityTaskStartedEventAttributes
     ActivityTaskStartedEventAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivityTaskStartedEventAttributes' {Maybe Text
identity :: Maybe Text
$sel:identity:ActivityTaskStartedEventAttributes' :: ActivityTaskStartedEventAttributes -> Maybe Text
identity} -> Maybe Text
identity) (\s :: ActivityTaskStartedEventAttributes
s@ActivityTaskStartedEventAttributes' {} Maybe Text
a -> ActivityTaskStartedEventAttributes
s {$sel:identity:ActivityTaskStartedEventAttributes' :: Maybe Text
identity = Maybe Text
a} :: ActivityTaskStartedEventAttributes)

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

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

instance
  Prelude.Hashable
    ActivityTaskStartedEventAttributes

instance
  Prelude.NFData
    ActivityTaskStartedEventAttributes