{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric      #-}
{-# LANGUAGE OverloadedStrings  #-}
{-# LANGUAGE RecordWildCards    #-}

{-# OPTIONS_GHC -fno-warn-unused-imports #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Network.AWS.SWF.Types.Product
-- Copyright   : (c) 2013-2018 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 Network.AWS.SWF.Types.Product where

import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.SWF.Types.Sum

-- | Provides the details of the @ActivityTaskCancelRequested@ event.
--
--
--
-- /See:/ 'activityTaskCancelRequestedEventAttributes' smart constructor.
data ActivityTaskCancelRequestedEventAttributes = ActivityTaskCancelRequestedEventAttributes'
  { _atcreaDecisionTaskCompletedEventId :: !Integer
  , _atcreaActivityId                   :: !Text
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ActivityTaskCancelRequestedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'atcreaDecisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the decision task that resulted in the @RequestCancelActivityTask@ decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
--
-- * 'atcreaActivityId' - The unique ID of the task.
activityTaskCancelRequestedEventAttributes
    :: Integer -- ^ 'atcreaDecisionTaskCompletedEventId'
    -> Text -- ^ 'atcreaActivityId'
    -> ActivityTaskCancelRequestedEventAttributes
activityTaskCancelRequestedEventAttributes pDecisionTaskCompletedEventId_ pActivityId_ =
  ActivityTaskCancelRequestedEventAttributes'
    { _atcreaDecisionTaskCompletedEventId = pDecisionTaskCompletedEventId_
    , _atcreaActivityId = pActivityId_
    }


-- | The ID of the @DecisionTaskCompleted@ event corresponding to the decision task that resulted in the @RequestCancelActivityTask@ decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
atcreaDecisionTaskCompletedEventId :: Lens' ActivityTaskCancelRequestedEventAttributes Integer
atcreaDecisionTaskCompletedEventId = lens _atcreaDecisionTaskCompletedEventId (\ s a -> s{_atcreaDecisionTaskCompletedEventId = a})

-- | The unique ID of the task.
atcreaActivityId :: Lens' ActivityTaskCancelRequestedEventAttributes Text
atcreaActivityId = lens _atcreaActivityId (\ s a -> s{_atcreaActivityId = a})

instance FromJSON
           ActivityTaskCancelRequestedEventAttributes
         where
        parseJSON
          = withObject
              "ActivityTaskCancelRequestedEventAttributes"
              (\ x ->
                 ActivityTaskCancelRequestedEventAttributes' <$>
                   (x .: "decisionTaskCompletedEventId") <*>
                     (x .: "activityId"))

instance Hashable
           ActivityTaskCancelRequestedEventAttributes
         where

instance NFData
           ActivityTaskCancelRequestedEventAttributes
         where

-- | Provides the details of the @ActivityTaskCanceled@ event.
--
--
--
-- /See:/ 'activityTaskCanceledEventAttributes' smart constructor.
data ActivityTaskCanceledEventAttributes = ActivityTaskCanceledEventAttributes'
  { _aLatestCancelRequestedEventId :: !(Maybe Integer)
  , _aDetails                      :: !(Maybe Text)
  , _aScheduledEventId             :: !Integer
  , _aStartedEventId               :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ActivityTaskCanceledEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aLatestCancelRequestedEventId' - 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.
--
-- * 'aDetails' - Details of the cancellation.
--
-- * 'aScheduledEventId' - 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.
--
-- * 'aStartedEventId' - 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 -- ^ 'aScheduledEventId'
    -> Integer -- ^ 'aStartedEventId'
    -> ActivityTaskCanceledEventAttributes
activityTaskCanceledEventAttributes pScheduledEventId_ pStartedEventId_ =
  ActivityTaskCanceledEventAttributes'
    { _aLatestCancelRequestedEventId = Nothing
    , _aDetails = Nothing
    , _aScheduledEventId = pScheduledEventId_
    , _aStartedEventId = 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.
aLatestCancelRequestedEventId :: Lens' ActivityTaskCanceledEventAttributes (Maybe Integer)
aLatestCancelRequestedEventId = lens _aLatestCancelRequestedEventId (\ s a -> s{_aLatestCancelRequestedEventId = a})

-- | Details of the cancellation.
aDetails :: Lens' ActivityTaskCanceledEventAttributes (Maybe Text)
aDetails = lens _aDetails (\ s a -> s{_aDetails = a})

-- | 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.
aScheduledEventId :: Lens' ActivityTaskCanceledEventAttributes Integer
aScheduledEventId = lens _aScheduledEventId (\ s a -> s{_aScheduledEventId = a})

-- | 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.
aStartedEventId :: Lens' ActivityTaskCanceledEventAttributes Integer
aStartedEventId = lens _aStartedEventId (\ s a -> s{_aStartedEventId = a})

instance FromJSON ActivityTaskCanceledEventAttributes
         where
        parseJSON
          = withObject "ActivityTaskCanceledEventAttributes"
              (\ x ->
                 ActivityTaskCanceledEventAttributes' <$>
                   (x .:? "latestCancelRequestedEventId") <*>
                     (x .:? "details")
                     <*> (x .: "scheduledEventId")
                     <*> (x .: "startedEventId"))

instance Hashable ActivityTaskCanceledEventAttributes
         where

instance NFData ActivityTaskCanceledEventAttributes
         where

-- | Provides the details of the @ActivityTaskCompleted@ event.
--
--
--
-- /See:/ 'activityTaskCompletedEventAttributes' smart constructor.
data ActivityTaskCompletedEventAttributes = ActivityTaskCompletedEventAttributes'
  { _atceaResult           :: !(Maybe Text)
  , _atceaScheduledEventId :: !Integer
  , _atceaStartedEventId   :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ActivityTaskCompletedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'atceaResult' - The results of the activity task.
--
-- * 'atceaScheduledEventId' - 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.
--
-- * 'atceaStartedEventId' - 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 -- ^ 'atceaScheduledEventId'
    -> Integer -- ^ 'atceaStartedEventId'
    -> ActivityTaskCompletedEventAttributes
activityTaskCompletedEventAttributes pScheduledEventId_ pStartedEventId_ =
  ActivityTaskCompletedEventAttributes'
    { _atceaResult = Nothing
    , _atceaScheduledEventId = pScheduledEventId_
    , _atceaStartedEventId = pStartedEventId_
    }


-- | The results of the activity task.
atceaResult :: Lens' ActivityTaskCompletedEventAttributes (Maybe Text)
atceaResult = lens _atceaResult (\ s a -> s{_atceaResult = a})

-- | 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.
atceaScheduledEventId :: Lens' ActivityTaskCompletedEventAttributes Integer
atceaScheduledEventId = lens _atceaScheduledEventId (\ s a -> s{_atceaScheduledEventId = a})

-- | 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.
atceaStartedEventId :: Lens' ActivityTaskCompletedEventAttributes Integer
atceaStartedEventId = lens _atceaStartedEventId (\ s a -> s{_atceaStartedEventId = a})

instance FromJSON
           ActivityTaskCompletedEventAttributes
         where
        parseJSON
          = withObject "ActivityTaskCompletedEventAttributes"
              (\ x ->
                 ActivityTaskCompletedEventAttributes' <$>
                   (x .:? "result") <*> (x .: "scheduledEventId") <*>
                     (x .: "startedEventId"))

instance Hashable
           ActivityTaskCompletedEventAttributes
         where

instance NFData ActivityTaskCompletedEventAttributes
         where

-- | Provides the details of the @ActivityTaskFailed@ event.
--
--
--
-- /See:/ 'activityTaskFailedEventAttributes' smart constructor.
data ActivityTaskFailedEventAttributes = ActivityTaskFailedEventAttributes'
  { _atfeaReason           :: !(Maybe Text)
  , _atfeaDetails          :: !(Maybe Text)
  , _atfeaScheduledEventId :: !Integer
  , _atfeaStartedEventId   :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ActivityTaskFailedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'atfeaReason' - The reason provided for the failure.
--
-- * 'atfeaDetails' - The details of the failure.
--
-- * 'atfeaScheduledEventId' - 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.
--
-- * 'atfeaStartedEventId' - 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.
activityTaskFailedEventAttributes
    :: Integer -- ^ 'atfeaScheduledEventId'
    -> Integer -- ^ 'atfeaStartedEventId'
    -> ActivityTaskFailedEventAttributes
activityTaskFailedEventAttributes pScheduledEventId_ pStartedEventId_ =
  ActivityTaskFailedEventAttributes'
    { _atfeaReason = Nothing
    , _atfeaDetails = Nothing
    , _atfeaScheduledEventId = pScheduledEventId_
    , _atfeaStartedEventId = pStartedEventId_
    }


-- | The reason provided for the failure.
atfeaReason :: Lens' ActivityTaskFailedEventAttributes (Maybe Text)
atfeaReason = lens _atfeaReason (\ s a -> s{_atfeaReason = a})

-- | The details of the failure.
atfeaDetails :: Lens' ActivityTaskFailedEventAttributes (Maybe Text)
atfeaDetails = lens _atfeaDetails (\ s a -> s{_atfeaDetails = a})

-- | 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.
atfeaScheduledEventId :: Lens' ActivityTaskFailedEventAttributes Integer
atfeaScheduledEventId = lens _atfeaScheduledEventId (\ s a -> s{_atfeaScheduledEventId = a})

-- | 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.
atfeaStartedEventId :: Lens' ActivityTaskFailedEventAttributes Integer
atfeaStartedEventId = lens _atfeaStartedEventId (\ s a -> s{_atfeaStartedEventId = a})

instance FromJSON ActivityTaskFailedEventAttributes
         where
        parseJSON
          = withObject "ActivityTaskFailedEventAttributes"
              (\ x ->
                 ActivityTaskFailedEventAttributes' <$>
                   (x .:? "reason") <*> (x .:? "details") <*>
                     (x .: "scheduledEventId")
                     <*> (x .: "startedEventId"))

instance Hashable ActivityTaskFailedEventAttributes
         where

instance NFData ActivityTaskFailedEventAttributes
         where

-- | Provides the details of the @ActivityTaskScheduled@ event.
--
--
--
-- /See:/ 'activityTaskScheduledEventAttributes' smart constructor.
data ActivityTaskScheduledEventAttributes = ActivityTaskScheduledEventAttributes'
  { _atseaControl                      :: !(Maybe Text)
  , _atseaHeartbeatTimeout             :: !(Maybe Text)
  , _atseaScheduleToCloseTimeout       :: !(Maybe Text)
  , _atseaInput                        :: !(Maybe Text)
  , _atseaTaskPriority                 :: !(Maybe Text)
  , _atseaScheduleToStartTimeout       :: !(Maybe Text)
  , _atseaStartToCloseTimeout          :: !(Maybe Text)
  , _atseaActivityType                 :: !ActivityType
  , _atseaActivityId                   :: !Text
  , _atseaTaskList                     :: !TaskList
  , _atseaDecisionTaskCompletedEventId :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ActivityTaskScheduledEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'atseaControl' - Data attached to the event that can be used by the decider in subsequent workflow tasks. This data isn't sent to the activity.
--
-- * 'atseaHeartbeatTimeout' - The maximum time before which the worker processing this task must report progress by calling 'RecordActivityTaskHeartbeat' . If the timeout is exceeded, the activity task is automatically timed out. If the worker subsequently attempts to record a heartbeat or return a result, it is ignored.
--
-- * 'atseaScheduleToCloseTimeout' - The maximum amount of time for this activity task.
--
-- * 'atseaInput' - The input provided to the activity task.
--
-- * 'atseaTaskPriority' - The priority to assign to the scheduled activity task. If set, this overrides any default priority value that was assigned when the activity type was registered. Valid values are integers that range from Java's @Integer.MIN_VALUE@ (-2147483648) to @Integer.MAX_VALUE@ (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/programming-priority.html Setting Task Priority> in the /Amazon SWF Developer Guide/ .
--
-- * 'atseaScheduleToStartTimeout' - The maximum amount of time the activity task can wait to be assigned to a worker.
--
-- * 'atseaStartToCloseTimeout' - The maximum amount of time a worker may take to process the activity task.
--
-- * 'atseaActivityType' - The type of the activity task.
--
-- * 'atseaActivityId' - The unique ID of the activity task.
--
-- * 'atseaTaskList' - The task list in which the activity task has been scheduled.
--
-- * 'atseaDecisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the decision that resulted in the scheduling of this activity task. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
activityTaskScheduledEventAttributes
    :: ActivityType -- ^ 'atseaActivityType'
    -> Text -- ^ 'atseaActivityId'
    -> TaskList -- ^ 'atseaTaskList'
    -> Integer -- ^ 'atseaDecisionTaskCompletedEventId'
    -> ActivityTaskScheduledEventAttributes
activityTaskScheduledEventAttributes pActivityType_ pActivityId_ pTaskList_ pDecisionTaskCompletedEventId_ =
  ActivityTaskScheduledEventAttributes'
    { _atseaControl = Nothing
    , _atseaHeartbeatTimeout = Nothing
    , _atseaScheduleToCloseTimeout = Nothing
    , _atseaInput = Nothing
    , _atseaTaskPriority = Nothing
    , _atseaScheduleToStartTimeout = Nothing
    , _atseaStartToCloseTimeout = Nothing
    , _atseaActivityType = pActivityType_
    , _atseaActivityId = pActivityId_
    , _atseaTaskList = pTaskList_
    , _atseaDecisionTaskCompletedEventId = pDecisionTaskCompletedEventId_
    }


-- | Data attached to the event that can be used by the decider in subsequent workflow tasks. This data isn't sent to the activity.
atseaControl :: Lens' ActivityTaskScheduledEventAttributes (Maybe Text)
atseaControl = lens _atseaControl (\ s a -> s{_atseaControl = a})

-- | The maximum time before which the worker processing this task must report progress by calling 'RecordActivityTaskHeartbeat' . If the timeout is exceeded, the activity task is automatically timed out. If the worker subsequently attempts to record a heartbeat or return a result, it is ignored.
atseaHeartbeatTimeout :: Lens' ActivityTaskScheduledEventAttributes (Maybe Text)
atseaHeartbeatTimeout = lens _atseaHeartbeatTimeout (\ s a -> s{_atseaHeartbeatTimeout = a})

-- | The maximum amount of time for this activity task.
atseaScheduleToCloseTimeout :: Lens' ActivityTaskScheduledEventAttributes (Maybe Text)
atseaScheduleToCloseTimeout = lens _atseaScheduleToCloseTimeout (\ s a -> s{_atseaScheduleToCloseTimeout = a})

-- | The input provided to the activity task.
atseaInput :: Lens' ActivityTaskScheduledEventAttributes (Maybe Text)
atseaInput = lens _atseaInput (\ s a -> s{_atseaInput = a})

-- | The priority to assign to the scheduled activity task. If set, this overrides any default priority value that was assigned when the activity type was registered. Valid values are integers that range from Java's @Integer.MIN_VALUE@ (-2147483648) to @Integer.MAX_VALUE@ (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/programming-priority.html Setting Task Priority> in the /Amazon SWF Developer Guide/ .
atseaTaskPriority :: Lens' ActivityTaskScheduledEventAttributes (Maybe Text)
atseaTaskPriority = lens _atseaTaskPriority (\ s a -> s{_atseaTaskPriority = a})

-- | The maximum amount of time the activity task can wait to be assigned to a worker.
atseaScheduleToStartTimeout :: Lens' ActivityTaskScheduledEventAttributes (Maybe Text)
atseaScheduleToStartTimeout = lens _atseaScheduleToStartTimeout (\ s a -> s{_atseaScheduleToStartTimeout = a})

-- | The maximum amount of time a worker may take to process the activity task.
atseaStartToCloseTimeout :: Lens' ActivityTaskScheduledEventAttributes (Maybe Text)
atseaStartToCloseTimeout = lens _atseaStartToCloseTimeout (\ s a -> s{_atseaStartToCloseTimeout = a})

-- | The type of the activity task.
atseaActivityType :: Lens' ActivityTaskScheduledEventAttributes ActivityType
atseaActivityType = lens _atseaActivityType (\ s a -> s{_atseaActivityType = a})

-- | The unique ID of the activity task.
atseaActivityId :: Lens' ActivityTaskScheduledEventAttributes Text
atseaActivityId = lens _atseaActivityId (\ s a -> s{_atseaActivityId = a})

-- | The task list in which the activity task has been scheduled.
atseaTaskList :: Lens' ActivityTaskScheduledEventAttributes TaskList
atseaTaskList = lens _atseaTaskList (\ s a -> s{_atseaTaskList = a})

-- | The ID of the @DecisionTaskCompleted@ event corresponding to the decision that resulted in the scheduling of this activity task. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
atseaDecisionTaskCompletedEventId :: Lens' ActivityTaskScheduledEventAttributes Integer
atseaDecisionTaskCompletedEventId = lens _atseaDecisionTaskCompletedEventId (\ s a -> s{_atseaDecisionTaskCompletedEventId = a})

instance FromJSON
           ActivityTaskScheduledEventAttributes
         where
        parseJSON
          = withObject "ActivityTaskScheduledEventAttributes"
              (\ x ->
                 ActivityTaskScheduledEventAttributes' <$>
                   (x .:? "control") <*> (x .:? "heartbeatTimeout") <*>
                     (x .:? "scheduleToCloseTimeout")
                     <*> (x .:? "input")
                     <*> (x .:? "taskPriority")
                     <*> (x .:? "scheduleToStartTimeout")
                     <*> (x .:? "startToCloseTimeout")
                     <*> (x .: "activityType")
                     <*> (x .: "activityId")
                     <*> (x .: "taskList")
                     <*> (x .: "decisionTaskCompletedEventId"))

instance Hashable
           ActivityTaskScheduledEventAttributes
         where

instance NFData ActivityTaskScheduledEventAttributes
         where

-- | Provides the details of the @ActivityTaskStarted@ event.
--
--
--
-- /See:/ 'activityTaskStartedEventAttributes' smart constructor.
data ActivityTaskStartedEventAttributes = ActivityTaskStartedEventAttributes'
  { _atseaIdentity         :: !(Maybe Text)
  , _atseaScheduledEventId :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ActivityTaskStartedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'atseaIdentity' - Identity of the worker that was assigned this task. This aids diagnostics when problems arise. The form of this identity is user defined.
--
-- * 'atseaScheduledEventId' - 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 -- ^ 'atseaScheduledEventId'
    -> ActivityTaskStartedEventAttributes
activityTaskStartedEventAttributes pScheduledEventId_ =
  ActivityTaskStartedEventAttributes'
    {_atseaIdentity = Nothing, _atseaScheduledEventId = pScheduledEventId_}


-- | Identity of the worker that was assigned this task. This aids diagnostics when problems arise. The form of this identity is user defined.
atseaIdentity :: Lens' ActivityTaskStartedEventAttributes (Maybe Text)
atseaIdentity = lens _atseaIdentity (\ s a -> s{_atseaIdentity = a})

-- | 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.
atseaScheduledEventId :: Lens' ActivityTaskStartedEventAttributes Integer
atseaScheduledEventId = lens _atseaScheduledEventId (\ s a -> s{_atseaScheduledEventId = a})

instance FromJSON ActivityTaskStartedEventAttributes
         where
        parseJSON
          = withObject "ActivityTaskStartedEventAttributes"
              (\ x ->
                 ActivityTaskStartedEventAttributes' <$>
                   (x .:? "identity") <*> (x .: "scheduledEventId"))

instance Hashable ActivityTaskStartedEventAttributes
         where

instance NFData ActivityTaskStartedEventAttributes
         where

-- | Provides the details of the @ActivityTaskTimedOut@ event.
--
--
--
-- /See:/ 'activityTaskTimedOutEventAttributes' smart constructor.
data ActivityTaskTimedOutEventAttributes = ActivityTaskTimedOutEventAttributes'
  { _attoeaDetails          :: !(Maybe Text)
  , _attoeaTimeoutType      :: !ActivityTaskTimeoutType
  , _attoeaScheduledEventId :: !Integer
  , _attoeaStartedEventId   :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ActivityTaskTimedOutEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'attoeaDetails' - Contains the content of the @details@ parameter for the last call made by the activity to @RecordActivityTaskHeartbeat@ .
--
-- * 'attoeaTimeoutType' - The type of the timeout that caused this event.
--
-- * 'attoeaScheduledEventId' - 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.
--
-- * 'attoeaStartedEventId' - 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.
activityTaskTimedOutEventAttributes
    :: ActivityTaskTimeoutType -- ^ 'attoeaTimeoutType'
    -> Integer -- ^ 'attoeaScheduledEventId'
    -> Integer -- ^ 'attoeaStartedEventId'
    -> ActivityTaskTimedOutEventAttributes
activityTaskTimedOutEventAttributes pTimeoutType_ pScheduledEventId_ pStartedEventId_ =
  ActivityTaskTimedOutEventAttributes'
    { _attoeaDetails = Nothing
    , _attoeaTimeoutType = pTimeoutType_
    , _attoeaScheduledEventId = pScheduledEventId_
    , _attoeaStartedEventId = pStartedEventId_
    }


-- | Contains the content of the @details@ parameter for the last call made by the activity to @RecordActivityTaskHeartbeat@ .
attoeaDetails :: Lens' ActivityTaskTimedOutEventAttributes (Maybe Text)
attoeaDetails = lens _attoeaDetails (\ s a -> s{_attoeaDetails = a})

-- | The type of the timeout that caused this event.
attoeaTimeoutType :: Lens' ActivityTaskTimedOutEventAttributes ActivityTaskTimeoutType
attoeaTimeoutType = lens _attoeaTimeoutType (\ s a -> s{_attoeaTimeoutType = a})

-- | 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.
attoeaScheduledEventId :: Lens' ActivityTaskTimedOutEventAttributes Integer
attoeaScheduledEventId = lens _attoeaScheduledEventId (\ s a -> s{_attoeaScheduledEventId = a})

-- | 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.
attoeaStartedEventId :: Lens' ActivityTaskTimedOutEventAttributes Integer
attoeaStartedEventId = lens _attoeaStartedEventId (\ s a -> s{_attoeaStartedEventId = a})

instance FromJSON ActivityTaskTimedOutEventAttributes
         where
        parseJSON
          = withObject "ActivityTaskTimedOutEventAttributes"
              (\ x ->
                 ActivityTaskTimedOutEventAttributes' <$>
                   (x .:? "details") <*> (x .: "timeoutType") <*>
                     (x .: "scheduledEventId")
                     <*> (x .: "startedEventId"))

instance Hashable ActivityTaskTimedOutEventAttributes
         where

instance NFData ActivityTaskTimedOutEventAttributes
         where

-- | Represents an activity type.
--
--
--
-- /See:/ 'activityType' smart constructor.
data ActivityType = ActivityType'
  { _atName    :: !Text
  , _atVersion :: !Text
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ActivityType' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'atName' - The name of this activity.
--
-- * 'atVersion' - The version of this activity.
activityType
    :: Text -- ^ 'atName'
    -> Text -- ^ 'atVersion'
    -> ActivityType
activityType pName_ pVersion_ =
  ActivityType' {_atName = pName_, _atVersion = pVersion_}


-- | The name of this activity.
atName :: Lens' ActivityType Text
atName = lens _atName (\ s a -> s{_atName = a})

-- | The version of this activity.
atVersion :: Lens' ActivityType Text
atVersion = lens _atVersion (\ s a -> s{_atVersion = a})

instance FromJSON ActivityType where
        parseJSON
          = withObject "ActivityType"
              (\ x ->
                 ActivityType' <$> (x .: "name") <*> (x .: "version"))

instance Hashable ActivityType where

instance NFData ActivityType where

instance ToJSON ActivityType where
        toJSON ActivityType'{..}
          = object
              (catMaybes
                 [Just ("name" .= _atName),
                  Just ("version" .= _atVersion)])

-- | Configuration settings registered with the activity type.
--
--
--
-- /See:/ 'activityTypeConfiguration' smart constructor.
data ActivityTypeConfiguration = ActivityTypeConfiguration'
  { _atcDefaultTaskScheduleToStartTimeout :: !(Maybe Text)
  , _atcDefaultTaskList                   :: !(Maybe TaskList)
  , _atcDefaultTaskPriority               :: !(Maybe Text)
  , _atcDefaultTaskHeartbeatTimeout       :: !(Maybe Text)
  , _atcDefaultTaskScheduleToCloseTimeout :: !(Maybe Text)
  , _atcDefaultTaskStartToCloseTimeout    :: !(Maybe Text)
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ActivityTypeConfiguration' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'atcDefaultTaskScheduleToStartTimeout' - The default maximum duration, specified when registering the activity type, that a task of an activity type can wait before being assigned to a worker. You can override this default when scheduling a task through the @ScheduleActivityTask@ 'Decision' . The duration is specified in seconds, an integer greater than or equal to @0@ . You can use @NONE@ to specify unlimited duration.
--
-- * 'atcDefaultTaskList' - The default task list specified for this activity type at registration. This default is used if a task list isn't provided when a task is scheduled through the @ScheduleActivityTask@ 'Decision' . You can override the default registered task list when scheduling a task through the @ScheduleActivityTask@ 'Decision' .
--
-- * 'atcDefaultTaskPriority' - The default task priority for tasks of this activity type, specified at registration. If not set, then @0@ is used as the default priority. This default can be overridden when scheduling an activity task. Valid values are integers that range from Java's @Integer.MIN_VALUE@ (-2147483648) to @Integer.MAX_VALUE@ (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/programming-priority.html Setting Task Priority> in the /Amazon SWF Developer Guide/ .
--
-- * 'atcDefaultTaskHeartbeatTimeout' - The default maximum time, in seconds, before which a worker processing a task must report progress by calling 'RecordActivityTaskHeartbeat' . You can specify this value only when /registering/ an activity type. The registered default value can be overridden when you schedule a task through the @ScheduleActivityTask@ 'Decision' . If the activity worker subsequently attempts to record a heartbeat or returns a result, the activity worker receives an @UnknownResource@ fault. In this case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the activity task. The duration is specified in seconds, an integer greater than or equal to @0@ . You can use @NONE@ to specify unlimited duration.
--
-- * 'atcDefaultTaskScheduleToCloseTimeout' - The default maximum duration, specified when registering the activity type, for tasks of this activity type. You can override this default when scheduling a task through the @ScheduleActivityTask@ 'Decision' . The duration is specified in seconds, an integer greater than or equal to @0@ . You can use @NONE@ to specify unlimited duration.
--
-- * 'atcDefaultTaskStartToCloseTimeout' - The default maximum duration for tasks of an activity type specified when registering the activity type. You can override this default when scheduling a task through the @ScheduleActivityTask@ 'Decision' . The duration is specified in seconds, an integer greater than or equal to @0@ . You can use @NONE@ to specify unlimited duration.
activityTypeConfiguration
    :: ActivityTypeConfiguration
activityTypeConfiguration =
  ActivityTypeConfiguration'
    { _atcDefaultTaskScheduleToStartTimeout = Nothing
    , _atcDefaultTaskList = Nothing
    , _atcDefaultTaskPriority = Nothing
    , _atcDefaultTaskHeartbeatTimeout = Nothing
    , _atcDefaultTaskScheduleToCloseTimeout = Nothing
    , _atcDefaultTaskStartToCloseTimeout = Nothing
    }


-- | The default maximum duration, specified when registering the activity type, that a task of an activity type can wait before being assigned to a worker. You can override this default when scheduling a task through the @ScheduleActivityTask@ 'Decision' . The duration is specified in seconds, an integer greater than or equal to @0@ . You can use @NONE@ to specify unlimited duration.
atcDefaultTaskScheduleToStartTimeout :: Lens' ActivityTypeConfiguration (Maybe Text)
atcDefaultTaskScheduleToStartTimeout = lens _atcDefaultTaskScheduleToStartTimeout (\ s a -> s{_atcDefaultTaskScheduleToStartTimeout = a})

-- | The default task list specified for this activity type at registration. This default is used if a task list isn't provided when a task is scheduled through the @ScheduleActivityTask@ 'Decision' . You can override the default registered task list when scheduling a task through the @ScheduleActivityTask@ 'Decision' .
atcDefaultTaskList :: Lens' ActivityTypeConfiguration (Maybe TaskList)
atcDefaultTaskList = lens _atcDefaultTaskList (\ s a -> s{_atcDefaultTaskList = a})

-- | The default task priority for tasks of this activity type, specified at registration. If not set, then @0@ is used as the default priority. This default can be overridden when scheduling an activity task. Valid values are integers that range from Java's @Integer.MIN_VALUE@ (-2147483648) to @Integer.MAX_VALUE@ (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/programming-priority.html Setting Task Priority> in the /Amazon SWF Developer Guide/ .
atcDefaultTaskPriority :: Lens' ActivityTypeConfiguration (Maybe Text)
atcDefaultTaskPriority = lens _atcDefaultTaskPriority (\ s a -> s{_atcDefaultTaskPriority = a})

-- | The default maximum time, in seconds, before which a worker processing a task must report progress by calling 'RecordActivityTaskHeartbeat' . You can specify this value only when /registering/ an activity type. The registered default value can be overridden when you schedule a task through the @ScheduleActivityTask@ 'Decision' . If the activity worker subsequently attempts to record a heartbeat or returns a result, the activity worker receives an @UnknownResource@ fault. In this case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the activity task. The duration is specified in seconds, an integer greater than or equal to @0@ . You can use @NONE@ to specify unlimited duration.
atcDefaultTaskHeartbeatTimeout :: Lens' ActivityTypeConfiguration (Maybe Text)
atcDefaultTaskHeartbeatTimeout = lens _atcDefaultTaskHeartbeatTimeout (\ s a -> s{_atcDefaultTaskHeartbeatTimeout = a})

-- | The default maximum duration, specified when registering the activity type, for tasks of this activity type. You can override this default when scheduling a task through the @ScheduleActivityTask@ 'Decision' . The duration is specified in seconds, an integer greater than or equal to @0@ . You can use @NONE@ to specify unlimited duration.
atcDefaultTaskScheduleToCloseTimeout :: Lens' ActivityTypeConfiguration (Maybe Text)
atcDefaultTaskScheduleToCloseTimeout = lens _atcDefaultTaskScheduleToCloseTimeout (\ s a -> s{_atcDefaultTaskScheduleToCloseTimeout = a})

-- | The default maximum duration for tasks of an activity type specified when registering the activity type. You can override this default when scheduling a task through the @ScheduleActivityTask@ 'Decision' . The duration is specified in seconds, an integer greater than or equal to @0@ . You can use @NONE@ to specify unlimited duration.
atcDefaultTaskStartToCloseTimeout :: Lens' ActivityTypeConfiguration (Maybe Text)
atcDefaultTaskStartToCloseTimeout = lens _atcDefaultTaskStartToCloseTimeout (\ s a -> s{_atcDefaultTaskStartToCloseTimeout = a})

instance FromJSON ActivityTypeConfiguration where
        parseJSON
          = withObject "ActivityTypeConfiguration"
              (\ x ->
                 ActivityTypeConfiguration' <$>
                   (x .:? "defaultTaskScheduleToStartTimeout") <*>
                     (x .:? "defaultTaskList")
                     <*> (x .:? "defaultTaskPriority")
                     <*> (x .:? "defaultTaskHeartbeatTimeout")
                     <*> (x .:? "defaultTaskScheduleToCloseTimeout")
                     <*> (x .:? "defaultTaskStartToCloseTimeout"))

instance Hashable ActivityTypeConfiguration where

instance NFData ActivityTypeConfiguration where

-- | Detailed information about an activity type.
--
--
--
-- /See:/ 'activityTypeInfo' smart constructor.
data ActivityTypeInfo = ActivityTypeInfo'
  { _atiDeprecationDate :: !(Maybe POSIX)
  , _atiDescription     :: !(Maybe Text)
  , _atiActivityType    :: !ActivityType
  , _atiStatus          :: !RegistrationStatus
  , _atiCreationDate    :: !POSIX
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ActivityTypeInfo' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'atiDeprecationDate' - If DEPRECATED, the date and time 'DeprecateActivityType' was called.
--
-- * 'atiDescription' - The description of the activity type provided in 'RegisterActivityType' .
--
-- * 'atiActivityType' - The 'ActivityType' type structure representing the activity type.
--
-- * 'atiStatus' - The current status of the activity type.
--
-- * 'atiCreationDate' - The date and time this activity type was created through 'RegisterActivityType' .
activityTypeInfo
    :: ActivityType -- ^ 'atiActivityType'
    -> RegistrationStatus -- ^ 'atiStatus'
    -> UTCTime -- ^ 'atiCreationDate'
    -> ActivityTypeInfo
activityTypeInfo pActivityType_ pStatus_ pCreationDate_ =
  ActivityTypeInfo'
    { _atiDeprecationDate = Nothing
    , _atiDescription = Nothing
    , _atiActivityType = pActivityType_
    , _atiStatus = pStatus_
    , _atiCreationDate = _Time # pCreationDate_
    }


-- | If DEPRECATED, the date and time 'DeprecateActivityType' was called.
atiDeprecationDate :: Lens' ActivityTypeInfo (Maybe UTCTime)
atiDeprecationDate = lens _atiDeprecationDate (\ s a -> s{_atiDeprecationDate = a}) . mapping _Time

-- | The description of the activity type provided in 'RegisterActivityType' .
atiDescription :: Lens' ActivityTypeInfo (Maybe Text)
atiDescription = lens _atiDescription (\ s a -> s{_atiDescription = a})

-- | The 'ActivityType' type structure representing the activity type.
atiActivityType :: Lens' ActivityTypeInfo ActivityType
atiActivityType = lens _atiActivityType (\ s a -> s{_atiActivityType = a})

-- | The current status of the activity type.
atiStatus :: Lens' ActivityTypeInfo RegistrationStatus
atiStatus = lens _atiStatus (\ s a -> s{_atiStatus = a})

-- | The date and time this activity type was created through 'RegisterActivityType' .
atiCreationDate :: Lens' ActivityTypeInfo UTCTime
atiCreationDate = lens _atiCreationDate (\ s a -> s{_atiCreationDate = a}) . _Time

instance FromJSON ActivityTypeInfo where
        parseJSON
          = withObject "ActivityTypeInfo"
              (\ x ->
                 ActivityTypeInfo' <$>
                   (x .:? "deprecationDate") <*> (x .:? "description")
                     <*> (x .: "activityType")
                     <*> (x .: "status")
                     <*> (x .: "creationDate"))

instance Hashable ActivityTypeInfo where

instance NFData ActivityTypeInfo where

-- | Provides the details of the @CancelTimer@ decision.
--
--
-- __Access Control__
--
-- You can use IAM policies to control this decision's access to Amazon SWF resources as follows:
--
--     * Use a @Resource@ element with the domain name to limit the action to only specified domains.
--
--     * Use an @Action@ element to allow or deny permission to call this action.
--
--     * You cannot use an IAM policy to constrain this action's parameters.
--
--
--
-- If the caller doesn't have sufficient permissions to invoke the action, or the parameter values fall outside the specified constraints, the action fails. The associated event attribute's @cause@ parameter is set to @OPERATION_NOT_PERMITTED@ . For details and example IAM policies, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows> in the /Amazon SWF Developer Guide/ .
--
--
-- /See:/ 'cancelTimerDecisionAttributes' smart constructor.
newtype CancelTimerDecisionAttributes = CancelTimerDecisionAttributes'
  { _ctdaTimerId :: Text
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'CancelTimerDecisionAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ctdaTimerId' - The unique ID of the timer to cancel.
cancelTimerDecisionAttributes
    :: Text -- ^ 'ctdaTimerId'
    -> CancelTimerDecisionAttributes
cancelTimerDecisionAttributes pTimerId_ =
  CancelTimerDecisionAttributes' {_ctdaTimerId = pTimerId_}


-- | The unique ID of the timer to cancel.
ctdaTimerId :: Lens' CancelTimerDecisionAttributes Text
ctdaTimerId = lens _ctdaTimerId (\ s a -> s{_ctdaTimerId = a})

instance Hashable CancelTimerDecisionAttributes where

instance NFData CancelTimerDecisionAttributes where

instance ToJSON CancelTimerDecisionAttributes where
        toJSON CancelTimerDecisionAttributes'{..}
          = object
              (catMaybes [Just ("timerId" .= _ctdaTimerId)])

-- | Provides the details of the @CancelTimerFailed@ event.
--
--
--
-- /See:/ 'cancelTimerFailedEventAttributes' smart constructor.
data CancelTimerFailedEventAttributes = CancelTimerFailedEventAttributes'
  { _ctfeaTimerId                      :: !Text
  , _ctfeaCause                        :: !CancelTimerFailedCause
  , _ctfeaDecisionTaskCompletedEventId :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'CancelTimerFailedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ctfeaTimerId' - The timerId provided in the @CancelTimer@ decision that failed.
--
-- * 'ctfeaCause' - The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes.
--
-- * 'ctfeaDecisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the decision task that resulted in the @CancelTimer@ decision to cancel this timer. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cancelTimerFailedEventAttributes
    :: Text -- ^ 'ctfeaTimerId'
    -> CancelTimerFailedCause -- ^ 'ctfeaCause'
    -> Integer -- ^ 'ctfeaDecisionTaskCompletedEventId'
    -> CancelTimerFailedEventAttributes
cancelTimerFailedEventAttributes pTimerId_ pCause_ pDecisionTaskCompletedEventId_ =
  CancelTimerFailedEventAttributes'
    { _ctfeaTimerId = pTimerId_
    , _ctfeaCause = pCause_
    , _ctfeaDecisionTaskCompletedEventId = pDecisionTaskCompletedEventId_
    }


-- | The timerId provided in the @CancelTimer@ decision that failed.
ctfeaTimerId :: Lens' CancelTimerFailedEventAttributes Text
ctfeaTimerId = lens _ctfeaTimerId (\ s a -> s{_ctfeaTimerId = a})

-- | The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes.
ctfeaCause :: Lens' CancelTimerFailedEventAttributes CancelTimerFailedCause
ctfeaCause = lens _ctfeaCause (\ s a -> s{_ctfeaCause = a})

-- | The ID of the @DecisionTaskCompleted@ event corresponding to the decision task that resulted in the @CancelTimer@ decision to cancel this timer. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
ctfeaDecisionTaskCompletedEventId :: Lens' CancelTimerFailedEventAttributes Integer
ctfeaDecisionTaskCompletedEventId = lens _ctfeaDecisionTaskCompletedEventId (\ s a -> s{_ctfeaDecisionTaskCompletedEventId = a})

instance FromJSON CancelTimerFailedEventAttributes
         where
        parseJSON
          = withObject "CancelTimerFailedEventAttributes"
              (\ x ->
                 CancelTimerFailedEventAttributes' <$>
                   (x .: "timerId") <*> (x .: "cause") <*>
                     (x .: "decisionTaskCompletedEventId"))

instance Hashable CancelTimerFailedEventAttributes
         where

instance NFData CancelTimerFailedEventAttributes
         where

-- | Provides the details of the @CancelWorkflowExecution@ decision.
--
--
-- __Access Control__
--
-- You can use IAM policies to control this decision's access to Amazon SWF resources as follows:
--
--     * Use a @Resource@ element with the domain name to limit the action to only specified domains.
--
--     * Use an @Action@ element to allow or deny permission to call this action.
--
--     * You cannot use an IAM policy to constrain this action's parameters.
--
--
--
-- If the caller doesn't have sufficient permissions to invoke the action, or the parameter values fall outside the specified constraints, the action fails. The associated event attribute's @cause@ parameter is set to @OPERATION_NOT_PERMITTED@ . For details and example IAM policies, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows> in the /Amazon SWF Developer Guide/ .
--
--
-- /See:/ 'cancelWorkflowExecutionDecisionAttributes' smart constructor.
newtype CancelWorkflowExecutionDecisionAttributes = CancelWorkflowExecutionDecisionAttributes'
  { _cwedaDetails :: Maybe Text
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'CancelWorkflowExecutionDecisionAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cwedaDetails' - Details of the cancellation.
cancelWorkflowExecutionDecisionAttributes
    :: CancelWorkflowExecutionDecisionAttributes
cancelWorkflowExecutionDecisionAttributes =
  CancelWorkflowExecutionDecisionAttributes' {_cwedaDetails = Nothing}


-- | Details of the cancellation.
cwedaDetails :: Lens' CancelWorkflowExecutionDecisionAttributes (Maybe Text)
cwedaDetails = lens _cwedaDetails (\ s a -> s{_cwedaDetails = a})

instance Hashable
           CancelWorkflowExecutionDecisionAttributes
         where

instance NFData
           CancelWorkflowExecutionDecisionAttributes
         where

instance ToJSON
           CancelWorkflowExecutionDecisionAttributes
         where
        toJSON CancelWorkflowExecutionDecisionAttributes'{..}
          = object
              (catMaybes [("details" .=) <$> _cwedaDetails])

-- | Provides the details of the @CancelWorkflowExecutionFailed@ event.
--
--
--
-- /See:/ 'cancelWorkflowExecutionFailedEventAttributes' smart constructor.
data CancelWorkflowExecutionFailedEventAttributes = CancelWorkflowExecutionFailedEventAttributes'
  { _cCause                        :: !CancelWorkflowExecutionFailedCause
  , _cDecisionTaskCompletedEventId :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'CancelWorkflowExecutionFailedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cCause' - The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes.
--
-- * 'cDecisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the decision task that resulted in the @CancelWorkflowExecution@ decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cancelWorkflowExecutionFailedEventAttributes
    :: CancelWorkflowExecutionFailedCause -- ^ 'cCause'
    -> Integer -- ^ 'cDecisionTaskCompletedEventId'
    -> CancelWorkflowExecutionFailedEventAttributes
cancelWorkflowExecutionFailedEventAttributes pCause_ pDecisionTaskCompletedEventId_ =
  CancelWorkflowExecutionFailedEventAttributes'
    { _cCause = pCause_
    , _cDecisionTaskCompletedEventId = pDecisionTaskCompletedEventId_
    }


-- | The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes.
cCause :: Lens' CancelWorkflowExecutionFailedEventAttributes CancelWorkflowExecutionFailedCause
cCause = lens _cCause (\ s a -> s{_cCause = a})

-- | The ID of the @DecisionTaskCompleted@ event corresponding to the decision task that resulted in the @CancelWorkflowExecution@ decision for this cancellation request. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cDecisionTaskCompletedEventId :: Lens' CancelWorkflowExecutionFailedEventAttributes Integer
cDecisionTaskCompletedEventId = lens _cDecisionTaskCompletedEventId (\ s a -> s{_cDecisionTaskCompletedEventId = a})

instance FromJSON
           CancelWorkflowExecutionFailedEventAttributes
         where
        parseJSON
          = withObject
              "CancelWorkflowExecutionFailedEventAttributes"
              (\ x ->
                 CancelWorkflowExecutionFailedEventAttributes' <$>
                   (x .: "cause") <*>
                     (x .: "decisionTaskCompletedEventId"))

instance Hashable
           CancelWorkflowExecutionFailedEventAttributes
         where

instance NFData
           CancelWorkflowExecutionFailedEventAttributes
         where

-- | Provide details of the @ChildWorkflowExecutionCanceled@ event.
--
--
--
-- /See:/ 'childWorkflowExecutionCanceledEventAttributes' smart constructor.
data ChildWorkflowExecutionCanceledEventAttributes = ChildWorkflowExecutionCanceledEventAttributes'
  { _cDetails           :: !(Maybe Text)
  , _cWorkflowExecution :: !WorkflowExecution
  , _cWorkflowType      :: !WorkflowType
  , _cInitiatedEventId  :: !Integer
  , _cStartedEventId    :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ChildWorkflowExecutionCanceledEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cDetails' - Details of the cancellation (if provided).
--
-- * 'cWorkflowExecution' - The child workflow execution that was canceled.
--
-- * 'cWorkflowType' - The type of the child workflow execution.
--
-- * 'cInitiatedEventId' - The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding to the @StartChildWorkflowExecution@ 'Decision' to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
--
-- * 'cStartedEventId' - The ID of the @ChildWorkflowExecutionStarted@ event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
childWorkflowExecutionCanceledEventAttributes
    :: WorkflowExecution -- ^ 'cWorkflowExecution'
    -> WorkflowType -- ^ 'cWorkflowType'
    -> Integer -- ^ 'cInitiatedEventId'
    -> Integer -- ^ 'cStartedEventId'
    -> ChildWorkflowExecutionCanceledEventAttributes
childWorkflowExecutionCanceledEventAttributes pWorkflowExecution_ pWorkflowType_ pInitiatedEventId_ pStartedEventId_ =
  ChildWorkflowExecutionCanceledEventAttributes'
    { _cDetails = Nothing
    , _cWorkflowExecution = pWorkflowExecution_
    , _cWorkflowType = pWorkflowType_
    , _cInitiatedEventId = pInitiatedEventId_
    , _cStartedEventId = pStartedEventId_
    }


-- | Details of the cancellation (if provided).
cDetails :: Lens' ChildWorkflowExecutionCanceledEventAttributes (Maybe Text)
cDetails = lens _cDetails (\ s a -> s{_cDetails = a})

-- | The child workflow execution that was canceled.
cWorkflowExecution :: Lens' ChildWorkflowExecutionCanceledEventAttributes WorkflowExecution
cWorkflowExecution = lens _cWorkflowExecution (\ s a -> s{_cWorkflowExecution = a})

-- | The type of the child workflow execution.
cWorkflowType :: Lens' ChildWorkflowExecutionCanceledEventAttributes WorkflowType
cWorkflowType = lens _cWorkflowType (\ s a -> s{_cWorkflowType = a})

-- | The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding to the @StartChildWorkflowExecution@ 'Decision' to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cInitiatedEventId :: Lens' ChildWorkflowExecutionCanceledEventAttributes Integer
cInitiatedEventId = lens _cInitiatedEventId (\ s a -> s{_cInitiatedEventId = a})

-- | The ID of the @ChildWorkflowExecutionStarted@ event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cStartedEventId :: Lens' ChildWorkflowExecutionCanceledEventAttributes Integer
cStartedEventId = lens _cStartedEventId (\ s a -> s{_cStartedEventId = a})

instance FromJSON
           ChildWorkflowExecutionCanceledEventAttributes
         where
        parseJSON
          = withObject
              "ChildWorkflowExecutionCanceledEventAttributes"
              (\ x ->
                 ChildWorkflowExecutionCanceledEventAttributes' <$>
                   (x .:? "details") <*> (x .: "workflowExecution") <*>
                     (x .: "workflowType")
                     <*> (x .: "initiatedEventId")
                     <*> (x .: "startedEventId"))

instance Hashable
           ChildWorkflowExecutionCanceledEventAttributes
         where

instance NFData
           ChildWorkflowExecutionCanceledEventAttributes
         where

-- | Provides the details of the @ChildWorkflowExecutionCompleted@ event.
--
--
--
-- /See:/ 'childWorkflowExecutionCompletedEventAttributes' smart constructor.
data ChildWorkflowExecutionCompletedEventAttributes = ChildWorkflowExecutionCompletedEventAttributes'
  { _cweceaResult            :: !(Maybe Text)
  , _cweceaWorkflowExecution :: !WorkflowExecution
  , _cweceaWorkflowType      :: !WorkflowType
  , _cweceaInitiatedEventId  :: !Integer
  , _cweceaStartedEventId    :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ChildWorkflowExecutionCompletedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cweceaResult' - The result of the child workflow execution.
--
-- * 'cweceaWorkflowExecution' - The child workflow execution that was completed.
--
-- * 'cweceaWorkflowType' - The type of the child workflow execution.
--
-- * 'cweceaInitiatedEventId' - The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding to the @StartChildWorkflowExecution@ 'Decision' to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
--
-- * 'cweceaStartedEventId' - The ID of the @ChildWorkflowExecutionStarted@ event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
childWorkflowExecutionCompletedEventAttributes
    :: WorkflowExecution -- ^ 'cweceaWorkflowExecution'
    -> WorkflowType -- ^ 'cweceaWorkflowType'
    -> Integer -- ^ 'cweceaInitiatedEventId'
    -> Integer -- ^ 'cweceaStartedEventId'
    -> ChildWorkflowExecutionCompletedEventAttributes
childWorkflowExecutionCompletedEventAttributes pWorkflowExecution_ pWorkflowType_ pInitiatedEventId_ pStartedEventId_ =
  ChildWorkflowExecutionCompletedEventAttributes'
    { _cweceaResult = Nothing
    , _cweceaWorkflowExecution = pWorkflowExecution_
    , _cweceaWorkflowType = pWorkflowType_
    , _cweceaInitiatedEventId = pInitiatedEventId_
    , _cweceaStartedEventId = pStartedEventId_
    }


-- | The result of the child workflow execution.
cweceaResult :: Lens' ChildWorkflowExecutionCompletedEventAttributes (Maybe Text)
cweceaResult = lens _cweceaResult (\ s a -> s{_cweceaResult = a})

-- | The child workflow execution that was completed.
cweceaWorkflowExecution :: Lens' ChildWorkflowExecutionCompletedEventAttributes WorkflowExecution
cweceaWorkflowExecution = lens _cweceaWorkflowExecution (\ s a -> s{_cweceaWorkflowExecution = a})

-- | The type of the child workflow execution.
cweceaWorkflowType :: Lens' ChildWorkflowExecutionCompletedEventAttributes WorkflowType
cweceaWorkflowType = lens _cweceaWorkflowType (\ s a -> s{_cweceaWorkflowType = a})

-- | The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding to the @StartChildWorkflowExecution@ 'Decision' to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cweceaInitiatedEventId :: Lens' ChildWorkflowExecutionCompletedEventAttributes Integer
cweceaInitiatedEventId = lens _cweceaInitiatedEventId (\ s a -> s{_cweceaInitiatedEventId = a})

-- | The ID of the @ChildWorkflowExecutionStarted@ event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cweceaStartedEventId :: Lens' ChildWorkflowExecutionCompletedEventAttributes Integer
cweceaStartedEventId = lens _cweceaStartedEventId (\ s a -> s{_cweceaStartedEventId = a})

instance FromJSON
           ChildWorkflowExecutionCompletedEventAttributes
         where
        parseJSON
          = withObject
              "ChildWorkflowExecutionCompletedEventAttributes"
              (\ x ->
                 ChildWorkflowExecutionCompletedEventAttributes' <$>
                   (x .:? "result") <*> (x .: "workflowExecution") <*>
                     (x .: "workflowType")
                     <*> (x .: "initiatedEventId")
                     <*> (x .: "startedEventId"))

instance Hashable
           ChildWorkflowExecutionCompletedEventAttributes
         where

instance NFData
           ChildWorkflowExecutionCompletedEventAttributes
         where

-- | Provides the details of the @ChildWorkflowExecutionFailed@ event.
--
--
--
-- /See:/ 'childWorkflowExecutionFailedEventAttributes' smart constructor.
data ChildWorkflowExecutionFailedEventAttributes = ChildWorkflowExecutionFailedEventAttributes'
  { _cwefeaReason            :: !(Maybe Text)
  , _cwefeaDetails           :: !(Maybe Text)
  , _cwefeaWorkflowExecution :: !WorkflowExecution
  , _cwefeaWorkflowType      :: !WorkflowType
  , _cwefeaInitiatedEventId  :: !Integer
  , _cwefeaStartedEventId    :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ChildWorkflowExecutionFailedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cwefeaReason' - The reason for the failure (if provided).
--
-- * 'cwefeaDetails' - The details of the failure (if provided).
--
-- * 'cwefeaWorkflowExecution' - The child workflow execution that failed.
--
-- * 'cwefeaWorkflowType' - The type of the child workflow execution.
--
-- * 'cwefeaInitiatedEventId' - The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding to the @StartChildWorkflowExecution@ 'Decision' to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
--
-- * 'cwefeaStartedEventId' - The ID of the @ChildWorkflowExecutionStarted@ event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
childWorkflowExecutionFailedEventAttributes
    :: WorkflowExecution -- ^ 'cwefeaWorkflowExecution'
    -> WorkflowType -- ^ 'cwefeaWorkflowType'
    -> Integer -- ^ 'cwefeaInitiatedEventId'
    -> Integer -- ^ 'cwefeaStartedEventId'
    -> ChildWorkflowExecutionFailedEventAttributes
childWorkflowExecutionFailedEventAttributes pWorkflowExecution_ pWorkflowType_ pInitiatedEventId_ pStartedEventId_ =
  ChildWorkflowExecutionFailedEventAttributes'
    { _cwefeaReason = Nothing
    , _cwefeaDetails = Nothing
    , _cwefeaWorkflowExecution = pWorkflowExecution_
    , _cwefeaWorkflowType = pWorkflowType_
    , _cwefeaInitiatedEventId = pInitiatedEventId_
    , _cwefeaStartedEventId = pStartedEventId_
    }


-- | The reason for the failure (if provided).
cwefeaReason :: Lens' ChildWorkflowExecutionFailedEventAttributes (Maybe Text)
cwefeaReason = lens _cwefeaReason (\ s a -> s{_cwefeaReason = a})

-- | The details of the failure (if provided).
cwefeaDetails :: Lens' ChildWorkflowExecutionFailedEventAttributes (Maybe Text)
cwefeaDetails = lens _cwefeaDetails (\ s a -> s{_cwefeaDetails = a})

-- | The child workflow execution that failed.
cwefeaWorkflowExecution :: Lens' ChildWorkflowExecutionFailedEventAttributes WorkflowExecution
cwefeaWorkflowExecution = lens _cwefeaWorkflowExecution (\ s a -> s{_cwefeaWorkflowExecution = a})

-- | The type of the child workflow execution.
cwefeaWorkflowType :: Lens' ChildWorkflowExecutionFailedEventAttributes WorkflowType
cwefeaWorkflowType = lens _cwefeaWorkflowType (\ s a -> s{_cwefeaWorkflowType = a})

-- | The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding to the @StartChildWorkflowExecution@ 'Decision' to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cwefeaInitiatedEventId :: Lens' ChildWorkflowExecutionFailedEventAttributes Integer
cwefeaInitiatedEventId = lens _cwefeaInitiatedEventId (\ s a -> s{_cwefeaInitiatedEventId = a})

-- | The ID of the @ChildWorkflowExecutionStarted@ event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cwefeaStartedEventId :: Lens' ChildWorkflowExecutionFailedEventAttributes Integer
cwefeaStartedEventId = lens _cwefeaStartedEventId (\ s a -> s{_cwefeaStartedEventId = a})

instance FromJSON
           ChildWorkflowExecutionFailedEventAttributes
         where
        parseJSON
          = withObject
              "ChildWorkflowExecutionFailedEventAttributes"
              (\ x ->
                 ChildWorkflowExecutionFailedEventAttributes' <$>
                   (x .:? "reason") <*> (x .:? "details") <*>
                     (x .: "workflowExecution")
                     <*> (x .: "workflowType")
                     <*> (x .: "initiatedEventId")
                     <*> (x .: "startedEventId"))

instance Hashable
           ChildWorkflowExecutionFailedEventAttributes
         where

instance NFData
           ChildWorkflowExecutionFailedEventAttributes
         where

-- | Provides the details of the @ChildWorkflowExecutionStarted@ event.
--
--
--
-- /See:/ 'childWorkflowExecutionStartedEventAttributes' smart constructor.
data ChildWorkflowExecutionStartedEventAttributes = ChildWorkflowExecutionStartedEventAttributes'
  { _cweseaWorkflowExecution :: !WorkflowExecution
  , _cweseaWorkflowType      :: !WorkflowType
  , _cweseaInitiatedEventId  :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ChildWorkflowExecutionStartedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cweseaWorkflowExecution' - The child workflow execution that was started.
--
-- * 'cweseaWorkflowType' - The type of the child workflow execution.
--
-- * 'cweseaInitiatedEventId' - The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding to the @StartChildWorkflowExecution@ 'Decision' to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
childWorkflowExecutionStartedEventAttributes
    :: WorkflowExecution -- ^ 'cweseaWorkflowExecution'
    -> WorkflowType -- ^ 'cweseaWorkflowType'
    -> Integer -- ^ 'cweseaInitiatedEventId'
    -> ChildWorkflowExecutionStartedEventAttributes
childWorkflowExecutionStartedEventAttributes pWorkflowExecution_ pWorkflowType_ pInitiatedEventId_ =
  ChildWorkflowExecutionStartedEventAttributes'
    { _cweseaWorkflowExecution = pWorkflowExecution_
    , _cweseaWorkflowType = pWorkflowType_
    , _cweseaInitiatedEventId = pInitiatedEventId_
    }


-- | The child workflow execution that was started.
cweseaWorkflowExecution :: Lens' ChildWorkflowExecutionStartedEventAttributes WorkflowExecution
cweseaWorkflowExecution = lens _cweseaWorkflowExecution (\ s a -> s{_cweseaWorkflowExecution = a})

-- | The type of the child workflow execution.
cweseaWorkflowType :: Lens' ChildWorkflowExecutionStartedEventAttributes WorkflowType
cweseaWorkflowType = lens _cweseaWorkflowType (\ s a -> s{_cweseaWorkflowType = a})

-- | The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding to the @StartChildWorkflowExecution@ 'Decision' to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cweseaInitiatedEventId :: Lens' ChildWorkflowExecutionStartedEventAttributes Integer
cweseaInitiatedEventId = lens _cweseaInitiatedEventId (\ s a -> s{_cweseaInitiatedEventId = a})

instance FromJSON
           ChildWorkflowExecutionStartedEventAttributes
         where
        parseJSON
          = withObject
              "ChildWorkflowExecutionStartedEventAttributes"
              (\ x ->
                 ChildWorkflowExecutionStartedEventAttributes' <$>
                   (x .: "workflowExecution") <*> (x .: "workflowType")
                     <*> (x .: "initiatedEventId"))

instance Hashable
           ChildWorkflowExecutionStartedEventAttributes
         where

instance NFData
           ChildWorkflowExecutionStartedEventAttributes
         where

-- | Provides the details of the @ChildWorkflowExecutionTerminated@ event.
--
--
--
-- /See:/ 'childWorkflowExecutionTerminatedEventAttributes' smart constructor.
data ChildWorkflowExecutionTerminatedEventAttributes = ChildWorkflowExecutionTerminatedEventAttributes'
  { _cweteaWorkflowExecution :: !WorkflowExecution
  , _cweteaWorkflowType      :: !WorkflowType
  , _cweteaInitiatedEventId  :: !Integer
  , _cweteaStartedEventId    :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ChildWorkflowExecutionTerminatedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cweteaWorkflowExecution' - The child workflow execution that was terminated.
--
-- * 'cweteaWorkflowType' - The type of the child workflow execution.
--
-- * 'cweteaInitiatedEventId' - The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding to the @StartChildWorkflowExecution@ 'Decision' to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
--
-- * 'cweteaStartedEventId' - The ID of the @ChildWorkflowExecutionStarted@ event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
childWorkflowExecutionTerminatedEventAttributes
    :: WorkflowExecution -- ^ 'cweteaWorkflowExecution'
    -> WorkflowType -- ^ 'cweteaWorkflowType'
    -> Integer -- ^ 'cweteaInitiatedEventId'
    -> Integer -- ^ 'cweteaStartedEventId'
    -> ChildWorkflowExecutionTerminatedEventAttributes
childWorkflowExecutionTerminatedEventAttributes pWorkflowExecution_ pWorkflowType_ pInitiatedEventId_ pStartedEventId_ =
  ChildWorkflowExecutionTerminatedEventAttributes'
    { _cweteaWorkflowExecution = pWorkflowExecution_
    , _cweteaWorkflowType = pWorkflowType_
    , _cweteaInitiatedEventId = pInitiatedEventId_
    , _cweteaStartedEventId = pStartedEventId_
    }


-- | The child workflow execution that was terminated.
cweteaWorkflowExecution :: Lens' ChildWorkflowExecutionTerminatedEventAttributes WorkflowExecution
cweteaWorkflowExecution = lens _cweteaWorkflowExecution (\ s a -> s{_cweteaWorkflowExecution = a})

-- | The type of the child workflow execution.
cweteaWorkflowType :: Lens' ChildWorkflowExecutionTerminatedEventAttributes WorkflowType
cweteaWorkflowType = lens _cweteaWorkflowType (\ s a -> s{_cweteaWorkflowType = a})

-- | The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding to the @StartChildWorkflowExecution@ 'Decision' to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cweteaInitiatedEventId :: Lens' ChildWorkflowExecutionTerminatedEventAttributes Integer
cweteaInitiatedEventId = lens _cweteaInitiatedEventId (\ s a -> s{_cweteaInitiatedEventId = a})

-- | The ID of the @ChildWorkflowExecutionStarted@ event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cweteaStartedEventId :: Lens' ChildWorkflowExecutionTerminatedEventAttributes Integer
cweteaStartedEventId = lens _cweteaStartedEventId (\ s a -> s{_cweteaStartedEventId = a})

instance FromJSON
           ChildWorkflowExecutionTerminatedEventAttributes
         where
        parseJSON
          = withObject
              "ChildWorkflowExecutionTerminatedEventAttributes"
              (\ x ->
                 ChildWorkflowExecutionTerminatedEventAttributes' <$>
                   (x .: "workflowExecution") <*> (x .: "workflowType")
                     <*> (x .: "initiatedEventId")
                     <*> (x .: "startedEventId"))

instance Hashable
           ChildWorkflowExecutionTerminatedEventAttributes
         where

instance NFData
           ChildWorkflowExecutionTerminatedEventAttributes
         where

-- | Provides the details of the @ChildWorkflowExecutionTimedOut@ event.
--
--
--
-- /See:/ 'childWorkflowExecutionTimedOutEventAttributes' smart constructor.
data ChildWorkflowExecutionTimedOutEventAttributes = ChildWorkflowExecutionTimedOutEventAttributes'
  { _cwetoeaWorkflowExecution :: !WorkflowExecution
  , _cwetoeaWorkflowType      :: !WorkflowType
  , _cwetoeaTimeoutType       :: !WorkflowExecutionTimeoutType
  , _cwetoeaInitiatedEventId  :: !Integer
  , _cwetoeaStartedEventId    :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ChildWorkflowExecutionTimedOutEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cwetoeaWorkflowExecution' - The child workflow execution that timed out.
--
-- * 'cwetoeaWorkflowType' - The type of the child workflow execution.
--
-- * 'cwetoeaTimeoutType' - The type of the timeout that caused the child workflow execution to time out.
--
-- * 'cwetoeaInitiatedEventId' - The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding to the @StartChildWorkflowExecution@ 'Decision' to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
--
-- * 'cwetoeaStartedEventId' - The ID of the @ChildWorkflowExecutionStarted@ event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
childWorkflowExecutionTimedOutEventAttributes
    :: WorkflowExecution -- ^ 'cwetoeaWorkflowExecution'
    -> WorkflowType -- ^ 'cwetoeaWorkflowType'
    -> WorkflowExecutionTimeoutType -- ^ 'cwetoeaTimeoutType'
    -> Integer -- ^ 'cwetoeaInitiatedEventId'
    -> Integer -- ^ 'cwetoeaStartedEventId'
    -> ChildWorkflowExecutionTimedOutEventAttributes
childWorkflowExecutionTimedOutEventAttributes pWorkflowExecution_ pWorkflowType_ pTimeoutType_ pInitiatedEventId_ pStartedEventId_ =
  ChildWorkflowExecutionTimedOutEventAttributes'
    { _cwetoeaWorkflowExecution = pWorkflowExecution_
    , _cwetoeaWorkflowType = pWorkflowType_
    , _cwetoeaTimeoutType = pTimeoutType_
    , _cwetoeaInitiatedEventId = pInitiatedEventId_
    , _cwetoeaStartedEventId = pStartedEventId_
    }


-- | The child workflow execution that timed out.
cwetoeaWorkflowExecution :: Lens' ChildWorkflowExecutionTimedOutEventAttributes WorkflowExecution
cwetoeaWorkflowExecution = lens _cwetoeaWorkflowExecution (\ s a -> s{_cwetoeaWorkflowExecution = a})

-- | The type of the child workflow execution.
cwetoeaWorkflowType :: Lens' ChildWorkflowExecutionTimedOutEventAttributes WorkflowType
cwetoeaWorkflowType = lens _cwetoeaWorkflowType (\ s a -> s{_cwetoeaWorkflowType = a})

-- | The type of the timeout that caused the child workflow execution to time out.
cwetoeaTimeoutType :: Lens' ChildWorkflowExecutionTimedOutEventAttributes WorkflowExecutionTimeoutType
cwetoeaTimeoutType = lens _cwetoeaTimeoutType (\ s a -> s{_cwetoeaTimeoutType = a})

-- | The ID of the @StartChildWorkflowExecutionInitiated@ event corresponding to the @StartChildWorkflowExecution@ 'Decision' to start this child workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cwetoeaInitiatedEventId :: Lens' ChildWorkflowExecutionTimedOutEventAttributes Integer
cwetoeaInitiatedEventId = lens _cwetoeaInitiatedEventId (\ s a -> s{_cwetoeaInitiatedEventId = a})

-- | The ID of the @ChildWorkflowExecutionStarted@ event recorded when this child workflow execution was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cwetoeaStartedEventId :: Lens' ChildWorkflowExecutionTimedOutEventAttributes Integer
cwetoeaStartedEventId = lens _cwetoeaStartedEventId (\ s a -> s{_cwetoeaStartedEventId = a})

instance FromJSON
           ChildWorkflowExecutionTimedOutEventAttributes
         where
        parseJSON
          = withObject
              "ChildWorkflowExecutionTimedOutEventAttributes"
              (\ x ->
                 ChildWorkflowExecutionTimedOutEventAttributes' <$>
                   (x .: "workflowExecution") <*> (x .: "workflowType")
                     <*> (x .: "timeoutType")
                     <*> (x .: "initiatedEventId")
                     <*> (x .: "startedEventId"))

instance Hashable
           ChildWorkflowExecutionTimedOutEventAttributes
         where

instance NFData
           ChildWorkflowExecutionTimedOutEventAttributes
         where

-- | Used to filter the closed workflow executions in visibility APIs by their close status.
--
--
--
-- /See:/ 'closeStatusFilter' smart constructor.
newtype CloseStatusFilter = CloseStatusFilter'
  { _csfStatus :: CloseStatus
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'CloseStatusFilter' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'csfStatus' - The close status that must match the close status of an execution for it to meet the criteria of this filter.
closeStatusFilter
    :: CloseStatus -- ^ 'csfStatus'
    -> CloseStatusFilter
closeStatusFilter pStatus_ = CloseStatusFilter' {_csfStatus = pStatus_}


-- | The close status that must match the close status of an execution for it to meet the criteria of this filter.
csfStatus :: Lens' CloseStatusFilter CloseStatus
csfStatus = lens _csfStatus (\ s a -> s{_csfStatus = a})

instance Hashable CloseStatusFilter where

instance NFData CloseStatusFilter where

instance ToJSON CloseStatusFilter where
        toJSON CloseStatusFilter'{..}
          = object (catMaybes [Just ("status" .= _csfStatus)])

-- | Provides the details of the @CompleteWorkflowExecution@ decision.
--
--
-- __Access Control__
--
-- You can use IAM policies to control this decision's access to Amazon SWF resources as follows:
--
--     * Use a @Resource@ element with the domain name to limit the action to only specified domains.
--
--     * Use an @Action@ element to allow or deny permission to call this action.
--
--     * You cannot use an IAM policy to constrain this action's parameters.
--
--
--
-- If the caller doesn't have sufficient permissions to invoke the action, or the parameter values fall outside the specified constraints, the action fails. The associated event attribute's @cause@ parameter is set to @OPERATION_NOT_PERMITTED@ . For details and example IAM policies, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows> in the /Amazon SWF Developer Guide/ .
--
--
-- /See:/ 'completeWorkflowExecutionDecisionAttributes' smart constructor.
newtype CompleteWorkflowExecutionDecisionAttributes = CompleteWorkflowExecutionDecisionAttributes'
  { _cwedaResult :: Maybe Text
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'CompleteWorkflowExecutionDecisionAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cwedaResult' - The result of the workflow execution. The form of the result is implementation defined.
completeWorkflowExecutionDecisionAttributes
    :: CompleteWorkflowExecutionDecisionAttributes
completeWorkflowExecutionDecisionAttributes =
  CompleteWorkflowExecutionDecisionAttributes' {_cwedaResult = Nothing}


-- | The result of the workflow execution. The form of the result is implementation defined.
cwedaResult :: Lens' CompleteWorkflowExecutionDecisionAttributes (Maybe Text)
cwedaResult = lens _cwedaResult (\ s a -> s{_cwedaResult = a})

instance Hashable
           CompleteWorkflowExecutionDecisionAttributes
         where

instance NFData
           CompleteWorkflowExecutionDecisionAttributes
         where

instance ToJSON
           CompleteWorkflowExecutionDecisionAttributes
         where
        toJSON
          CompleteWorkflowExecutionDecisionAttributes'{..}
          = object (catMaybes [("result" .=) <$> _cwedaResult])

-- | Provides the details of the @CompleteWorkflowExecutionFailed@ event.
--
--
--
-- /See:/ 'completeWorkflowExecutionFailedEventAttributes' smart constructor.
data CompleteWorkflowExecutionFailedEventAttributes = CompleteWorkflowExecutionFailedEventAttributes'
  { _cwefeaCause                        :: !CompleteWorkflowExecutionFailedCause
  , _cwefeaDecisionTaskCompletedEventId :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'CompleteWorkflowExecutionFailedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cwefeaCause' - The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes.
--
-- * 'cwefeaDecisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the decision task that resulted in the @CompleteWorkflowExecution@ decision to complete this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
completeWorkflowExecutionFailedEventAttributes
    :: CompleteWorkflowExecutionFailedCause -- ^ 'cwefeaCause'
    -> Integer -- ^ 'cwefeaDecisionTaskCompletedEventId'
    -> CompleteWorkflowExecutionFailedEventAttributes
completeWorkflowExecutionFailedEventAttributes pCause_ pDecisionTaskCompletedEventId_ =
  CompleteWorkflowExecutionFailedEventAttributes'
    { _cwefeaCause = pCause_
    , _cwefeaDecisionTaskCompletedEventId = pDecisionTaskCompletedEventId_
    }


-- | The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes.
cwefeaCause :: Lens' CompleteWorkflowExecutionFailedEventAttributes CompleteWorkflowExecutionFailedCause
cwefeaCause = lens _cwefeaCause (\ s a -> s{_cwefeaCause = a})

-- | The ID of the @DecisionTaskCompleted@ event corresponding to the decision task that resulted in the @CompleteWorkflowExecution@ decision to complete this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
cwefeaDecisionTaskCompletedEventId :: Lens' CompleteWorkflowExecutionFailedEventAttributes Integer
cwefeaDecisionTaskCompletedEventId = lens _cwefeaDecisionTaskCompletedEventId (\ s a -> s{_cwefeaDecisionTaskCompletedEventId = a})

instance FromJSON
           CompleteWorkflowExecutionFailedEventAttributes
         where
        parseJSON
          = withObject
              "CompleteWorkflowExecutionFailedEventAttributes"
              (\ x ->
                 CompleteWorkflowExecutionFailedEventAttributes' <$>
                   (x .: "cause") <*>
                     (x .: "decisionTaskCompletedEventId"))

instance Hashable
           CompleteWorkflowExecutionFailedEventAttributes
         where

instance NFData
           CompleteWorkflowExecutionFailedEventAttributes
         where

-- | Provides the details of the @ContinueAsNewWorkflowExecution@ decision.
--
--
-- __Access Control__
--
-- You can use IAM policies to control this decision's access to Amazon SWF resources as follows:
--
--     * Use a @Resource@ element with the domain name to limit the action to only specified domains.
--
--     * Use an @Action@ element to allow or deny permission to call this action.
--
--     * Constrain the following parameters by using a @Condition@ element with the appropriate keys.
--
--     * @tag@ – A tag used to identify the workflow execution
--
--     * @taskList@ – String constraint. The key is @swf:taskList.name@ .
--
--     * @workflowType.version@ – String constraint. The key is @swf:workflowType.version@ .
--
--
--
--
--
-- If the caller doesn't have sufficient permissions to invoke the action, or the parameter values fall outside the specified constraints, the action fails. The associated event attribute's @cause@ parameter is set to @OPERATION_NOT_PERMITTED@ . For details and example IAM policies, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows> in the /Amazon SWF Developer Guide/ .
--
--
-- /See:/ 'continueAsNewWorkflowExecutionDecisionAttributes' smart constructor.
data ContinueAsNewWorkflowExecutionDecisionAttributes = ContinueAsNewWorkflowExecutionDecisionAttributes'
  { _canwedaTagList                      :: !(Maybe [Text])
  , _canwedaTaskStartToCloseTimeout      :: !(Maybe Text)
  , _canwedaLambdaRole                   :: !(Maybe Text)
  , _canwedaInput                        :: !(Maybe Text)
  , _canwedaWorkflowTypeVersion          :: !(Maybe Text)
  , _canwedaExecutionStartToCloseTimeout :: !(Maybe Text)
  , _canwedaTaskList                     :: !(Maybe TaskList)
  , _canwedaTaskPriority                 :: !(Maybe Text)
  , _canwedaChildPolicy                  :: !(Maybe ChildPolicy)
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ContinueAsNewWorkflowExecutionDecisionAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'canwedaTagList' - The list of tags to associate with the new workflow execution. A maximum of 5 tags can be specified. You can list workflow executions with a specific tag by calling 'ListOpenWorkflowExecutions' or 'ListClosedWorkflowExecutions' and specifying a 'TagFilter' .
--
-- * 'canwedaTaskStartToCloseTimeout' - Specifies the maximum duration of decision tasks for the new workflow execution. This parameter overrides the @defaultTaskStartToCloseTimout@ specified when registering the workflow type using 'RegisterWorkflowType' . The duration is specified in seconds, an integer greater than or equal to @0@ . You can use @NONE@ to specify unlimited duration.
--
-- * 'canwedaLambdaRole' - The IAM role to attach to the new (continued) execution.
--
-- * 'canwedaInput' - The input provided to the new workflow execution.
--
-- * 'canwedaWorkflowTypeVersion' - The version of the workflow to start.
--
-- * 'canwedaExecutionStartToCloseTimeout' - If set, specifies the total duration for this workflow execution. This overrides the @defaultExecutionStartToCloseTimeout@ specified when registering the workflow type. The duration is specified in seconds, an integer greater than or equal to @0@ . You can use @NONE@ to specify unlimited duration.
--
-- * 'canwedaTaskList' - The task list to use for the decisions of the new (continued) workflow execution.
--
-- * 'canwedaTaskPriority' - The task priority that, if set, specifies the priority for the decision tasks for this workflow execution. This overrides the defaultTaskPriority specified when registering the workflow type. Valid values are integers that range from Java's @Integer.MIN_VALUE@ (-2147483648) to @Integer.MAX_VALUE@ (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/programming-priority.html Setting Task Priority> in the /Amazon SWF Developer Guide/ .
--
-- * 'canwedaChildPolicy' - If set, specifies the policy to use for the child workflow executions of the new execution if it is terminated by calling the 'TerminateWorkflowExecution' action explicitly or due to an expired timeout. This policy overrides the default child policy specified when registering the workflow type using 'RegisterWorkflowType' . The supported child policies are:     * @TERMINATE@ – The child executions are terminated.     * @REQUEST_CANCEL@ – A request to cancel is attempted for each child execution by recording a @WorkflowExecutionCancelRequested@ event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event.     * @ABANDON@ – No action is taken. The child executions continue to run.
continueAsNewWorkflowExecutionDecisionAttributes
    :: ContinueAsNewWorkflowExecutionDecisionAttributes
continueAsNewWorkflowExecutionDecisionAttributes =
  ContinueAsNewWorkflowExecutionDecisionAttributes'
    { _canwedaTagList = Nothing
    , _canwedaTaskStartToCloseTimeout = Nothing
    , _canwedaLambdaRole = Nothing
    , _canwedaInput = Nothing
    , _canwedaWorkflowTypeVersion = Nothing
    , _canwedaExecutionStartToCloseTimeout = Nothing
    , _canwedaTaskList = Nothing
    , _canwedaTaskPriority = Nothing
    , _canwedaChildPolicy = Nothing
    }


-- | The list of tags to associate with the new workflow execution. A maximum of 5 tags can be specified. You can list workflow executions with a specific tag by calling 'ListOpenWorkflowExecutions' or 'ListClosedWorkflowExecutions' and specifying a 'TagFilter' .
canwedaTagList :: Lens' ContinueAsNewWorkflowExecutionDecisionAttributes [Text]
canwedaTagList = lens _canwedaTagList (\ s a -> s{_canwedaTagList = a}) . _Default . _Coerce

-- | Specifies the maximum duration of decision tasks for the new workflow execution. This parameter overrides the @defaultTaskStartToCloseTimout@ specified when registering the workflow type using 'RegisterWorkflowType' . The duration is specified in seconds, an integer greater than or equal to @0@ . You can use @NONE@ to specify unlimited duration.
canwedaTaskStartToCloseTimeout :: Lens' ContinueAsNewWorkflowExecutionDecisionAttributes (Maybe Text)
canwedaTaskStartToCloseTimeout = lens _canwedaTaskStartToCloseTimeout (\ s a -> s{_canwedaTaskStartToCloseTimeout = a})

-- | The IAM role to attach to the new (continued) execution.
canwedaLambdaRole :: Lens' ContinueAsNewWorkflowExecutionDecisionAttributes (Maybe Text)
canwedaLambdaRole = lens _canwedaLambdaRole (\ s a -> s{_canwedaLambdaRole = a})

-- | The input provided to the new workflow execution.
canwedaInput :: Lens' ContinueAsNewWorkflowExecutionDecisionAttributes (Maybe Text)
canwedaInput = lens _canwedaInput (\ s a -> s{_canwedaInput = a})

-- | The version of the workflow to start.
canwedaWorkflowTypeVersion :: Lens' ContinueAsNewWorkflowExecutionDecisionAttributes (Maybe Text)
canwedaWorkflowTypeVersion = lens _canwedaWorkflowTypeVersion (\ s a -> s{_canwedaWorkflowTypeVersion = a})

-- | If set, specifies the total duration for this workflow execution. This overrides the @defaultExecutionStartToCloseTimeout@ specified when registering the workflow type. The duration is specified in seconds, an integer greater than or equal to @0@ . You can use @NONE@ to specify unlimited duration.
canwedaExecutionStartToCloseTimeout :: Lens' ContinueAsNewWorkflowExecutionDecisionAttributes (Maybe Text)
canwedaExecutionStartToCloseTimeout = lens _canwedaExecutionStartToCloseTimeout (\ s a -> s{_canwedaExecutionStartToCloseTimeout = a})

-- | The task list to use for the decisions of the new (continued) workflow execution.
canwedaTaskList :: Lens' ContinueAsNewWorkflowExecutionDecisionAttributes (Maybe TaskList)
canwedaTaskList = lens _canwedaTaskList (\ s a -> s{_canwedaTaskList = a})

-- | The task priority that, if set, specifies the priority for the decision tasks for this workflow execution. This overrides the defaultTaskPriority specified when registering the workflow type. Valid values are integers that range from Java's @Integer.MIN_VALUE@ (-2147483648) to @Integer.MAX_VALUE@ (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/programming-priority.html Setting Task Priority> in the /Amazon SWF Developer Guide/ .
canwedaTaskPriority :: Lens' ContinueAsNewWorkflowExecutionDecisionAttributes (Maybe Text)
canwedaTaskPriority = lens _canwedaTaskPriority (\ s a -> s{_canwedaTaskPriority = a})

-- | If set, specifies the policy to use for the child workflow executions of the new execution if it is terminated by calling the 'TerminateWorkflowExecution' action explicitly or due to an expired timeout. This policy overrides the default child policy specified when registering the workflow type using 'RegisterWorkflowType' . The supported child policies are:     * @TERMINATE@ – The child executions are terminated.     * @REQUEST_CANCEL@ – A request to cancel is attempted for each child execution by recording a @WorkflowExecutionCancelRequested@ event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event.     * @ABANDON@ – No action is taken. The child executions continue to run.
canwedaChildPolicy :: Lens' ContinueAsNewWorkflowExecutionDecisionAttributes (Maybe ChildPolicy)
canwedaChildPolicy = lens _canwedaChildPolicy (\ s a -> s{_canwedaChildPolicy = a})

instance Hashable
           ContinueAsNewWorkflowExecutionDecisionAttributes
         where

instance NFData
           ContinueAsNewWorkflowExecutionDecisionAttributes
         where

instance ToJSON
           ContinueAsNewWorkflowExecutionDecisionAttributes
         where
        toJSON
          ContinueAsNewWorkflowExecutionDecisionAttributes'{..}
          = object
              (catMaybes
                 [("tagList" .=) <$> _canwedaTagList,
                  ("taskStartToCloseTimeout" .=) <$>
                    _canwedaTaskStartToCloseTimeout,
                  ("lambdaRole" .=) <$> _canwedaLambdaRole,
                  ("input" .=) <$> _canwedaInput,
                  ("workflowTypeVersion" .=) <$>
                    _canwedaWorkflowTypeVersion,
                  ("executionStartToCloseTimeout" .=) <$>
                    _canwedaExecutionStartToCloseTimeout,
                  ("taskList" .=) <$> _canwedaTaskList,
                  ("taskPriority" .=) <$> _canwedaTaskPriority,
                  ("childPolicy" .=) <$> _canwedaChildPolicy])

-- | Provides the details of the @ContinueAsNewWorkflowExecutionFailed@ event.
--
--
--
-- /See:/ 'continueAsNewWorkflowExecutionFailedEventAttributes' smart constructor.
data ContinueAsNewWorkflowExecutionFailedEventAttributes = ContinueAsNewWorkflowExecutionFailedEventAttributes'
  { _canwefeaCause :: !ContinueAsNewWorkflowExecutionFailedCause
  , _canwefeaDecisionTaskCompletedEventId :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ContinueAsNewWorkflowExecutionFailedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'canwefeaCause' - The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes.
--
-- * 'canwefeaDecisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the decision task that resulted in the @ContinueAsNewWorkflowExecution@ decision that started this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
continueAsNewWorkflowExecutionFailedEventAttributes
    :: ContinueAsNewWorkflowExecutionFailedCause -- ^ 'canwefeaCause'
    -> Integer -- ^ 'canwefeaDecisionTaskCompletedEventId'
    -> ContinueAsNewWorkflowExecutionFailedEventAttributes
continueAsNewWorkflowExecutionFailedEventAttributes pCause_ pDecisionTaskCompletedEventId_ =
  ContinueAsNewWorkflowExecutionFailedEventAttributes'
    { _canwefeaCause = pCause_
    , _canwefeaDecisionTaskCompletedEventId = pDecisionTaskCompletedEventId_
    }


-- | The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes.
canwefeaCause :: Lens' ContinueAsNewWorkflowExecutionFailedEventAttributes ContinueAsNewWorkflowExecutionFailedCause
canwefeaCause = lens _canwefeaCause (\ s a -> s{_canwefeaCause = a})

-- | The ID of the @DecisionTaskCompleted@ event corresponding to the decision task that resulted in the @ContinueAsNewWorkflowExecution@ decision that started this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
canwefeaDecisionTaskCompletedEventId :: Lens' ContinueAsNewWorkflowExecutionFailedEventAttributes Integer
canwefeaDecisionTaskCompletedEventId = lens _canwefeaDecisionTaskCompletedEventId (\ s a -> s{_canwefeaDecisionTaskCompletedEventId = a})

instance FromJSON
           ContinueAsNewWorkflowExecutionFailedEventAttributes
         where
        parseJSON
          = withObject
              "ContinueAsNewWorkflowExecutionFailedEventAttributes"
              (\ x ->
                 ContinueAsNewWorkflowExecutionFailedEventAttributes'
                   <$>
                   (x .: "cause") <*>
                     (x .: "decisionTaskCompletedEventId"))

instance Hashable
           ContinueAsNewWorkflowExecutionFailedEventAttributes
         where

instance NFData
           ContinueAsNewWorkflowExecutionFailedEventAttributes
         where

-- | Specifies a decision made by the decider. A decision can be one of these types:
--
--
--     * @CancelTimer@ – Cancels a previously started timer and records a @TimerCanceled@ event in the history.
--
--     * @CancelWorkflowExecution@ – Closes the workflow execution and records a @WorkflowExecutionCanceled@ event in the history.
--
--     * @CompleteWorkflowExecution@ – Closes the workflow execution and records a @WorkflowExecutionCompleted@ event in the history .
--
--     * @ContinueAsNewWorkflowExecution@ – Closes the workflow execution and starts a new workflow execution of the same type using the same workflow ID and a unique run Id. A @WorkflowExecutionContinuedAsNew@ event is recorded in the history.
--
--     * @FailWorkflowExecution@ – Closes the workflow execution and records a @WorkflowExecutionFailed@ event in the history.
--
--     * @RecordMarker@ – Records a @MarkerRecorded@ event in the history. Markers can be used for adding custom information in the history for instance to let deciders know that they don't need to look at the history beyond the marker event.
--
--     * @RequestCancelActivityTask@ – Attempts to cancel a previously scheduled activity task. If the activity task was scheduled but has not been assigned to a worker, then it is canceled. If the activity task was already assigned to a worker, then the worker is informed that cancellation has been requested in the response to 'RecordActivityTaskHeartbeat' .
--
--     * @RequestCancelExternalWorkflowExecution@ – Requests that a request be made to cancel the specified external workflow execution and records a @RequestCancelExternalWorkflowExecutionInitiated@ event in the history.
--
--     * @ScheduleActivityTask@ – Schedules an activity task.
--
--     * @SignalExternalWorkflowExecution@ – Requests a signal to be delivered to the specified external workflow execution and records a @SignalExternalWorkflowExecutionInitiated@ event in the history.
--
--     * @StartChildWorkflowExecution@ – Requests that a child workflow execution be started and records a @StartChildWorkflowExecutionInitiated@ event in the history. The child workflow execution is a separate workflow execution with its own history.
--
--     * @StartTimer@ – Starts a timer for this workflow execution and records a @TimerStarted@ event in the history. This timer fires after the specified delay and record a @TimerFired@ event.
--
--
--
-- __Access Control__
--
-- If you grant permission to use @RespondDecisionTaskCompleted@ , you can use IAM policies to express permissions for the list of decisions returned by this action as if they were members of the API. Treating decisions as a pseudo API maintains a uniform conceptual model and helps keep policies readable. For details and example IAM policies, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows> in the /Amazon SWF Developer Guide/ .
--
-- __Decision Failure__
--
-- Decisions can fail for several reasons
--
--     * The ordering of decisions should follow a logical flow. Some decisions might not make sense in the current context of the workflow execution and therefore fails.
--
--     * A limit on your account was reached.
--
--     * The decision lacks sufficient permissions.
--
--
--
-- One of the following events might be added to the history to indicate an error. The event attribute's @cause@ parameter indicates the cause. If @cause@ is set to @OPERATION_NOT_PERMITTED@ , the decision failed because it lacked sufficient permissions. For details and example IAM policies, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows> in the /Amazon SWF Developer Guide/ .
--
--     * @ScheduleActivityTaskFailed@ – A @ScheduleActivityTask@ decision failed. This could happen if the activity type specified in the decision isn't registered, is in a deprecated state, or the decision isn't properly configured.
--
--     * @RequestCancelActivityTaskFailed@ – A @RequestCancelActivityTask@ decision failed. This could happen if there is no open activity task with the specified activityId.
--
--     * @StartTimerFailed@ – A @StartTimer@ decision failed. This could happen if there is another open timer with the same timerId.
--
--     * @CancelTimerFailed@ – A @CancelTimer@ decision failed. This could happen if there is no open timer with the specified timerId.
--
--     * @StartChildWorkflowExecutionFailed@ – A @StartChildWorkflowExecution@ decision failed. This could happen if the workflow type specified isn't registered, is deprecated, or the decision isn't properly configured.
--
--     * @SignalExternalWorkflowExecutionFailed@ – A @SignalExternalWorkflowExecution@ decision failed. This could happen if the @workflowID@ specified in the decision was incorrect.
--
--     * @RequestCancelExternalWorkflowExecutionFailed@ – A @RequestCancelExternalWorkflowExecution@ decision failed. This could happen if the @workflowID@ specified in the decision was incorrect.
--
--     * @CancelWorkflowExecutionFailed@ – A @CancelWorkflowExecution@ decision failed. This could happen if there is an unhandled decision task pending in the workflow execution.
--
--     * @CompleteWorkflowExecutionFailed@ – A @CompleteWorkflowExecution@ decision failed. This could happen if there is an unhandled decision task pending in the workflow execution.
--
--     * @ContinueAsNewWorkflowExecutionFailed@ – A @ContinueAsNewWorkflowExecution@ decision failed. This could happen if there is an unhandled decision task pending in the workflow execution or the ContinueAsNewWorkflowExecution decision was not configured correctly.
--
--     * @FailWorkflowExecutionFailed@ – A @FailWorkflowExecution@ decision failed. This could happen if there is an unhandled decision task pending in the workflow execution.
--
--
--
-- The preceding error events might occur due to an error in the decider logic, which might put the workflow execution in an unstable state The cause field in the event structure for the error event indicates the cause of the error.
--
-- __How to Code a Decision__
--
-- You code a decision by first setting the decision type field to one of the above decision values, and then set the corresponding attributes field shown below:
--
--     * @'ScheduleActivityTaskDecisionAttributes' @
--
--     * @'RequestCancelActivityTaskDecisionAttributes' @
--
--     * @'CompleteWorkflowExecutionDecisionAttributes' @
--
--     * @'FailWorkflowExecutionDecisionAttributes' @
--
--     * @'CancelWorkflowExecutionDecisionAttributes' @
--
--     * @'ContinueAsNewWorkflowExecutionDecisionAttributes' @
--
--     * @'RecordMarkerDecisionAttributes' @
--
--     * @'StartTimerDecisionAttributes' @
--
--     * @'CancelTimerDecisionAttributes' @
--
--     * @'SignalExternalWorkflowExecutionDecisionAttributes' @
--
--     * @'RequestCancelExternalWorkflowExecutionDecisionAttributes' @
--
--     * @'StartChildWorkflowExecutionDecisionAttributes' @
--
--
--
--
-- /See:/ 'decision' smart constructor.
data Decision = Decision'
  { _dRequestCancelExternalWorkflowExecutionDecisionAttributes :: !(Maybe RequestCancelExternalWorkflowExecutionDecisionAttributes)
  , _dScheduleActivityTaskDecisionAttributes :: !(Maybe ScheduleActivityTaskDecisionAttributes)
  , _dSignalExternalWorkflowExecutionDecisionAttributes :: !(Maybe SignalExternalWorkflowExecutionDecisionAttributes)
  , _dStartTimerDecisionAttributes :: !(Maybe StartTimerDecisionAttributes)
  , _dRecordMarkerDecisionAttributes :: !(Maybe RecordMarkerDecisionAttributes)
  , _dFailWorkflowExecutionDecisionAttributes :: !(Maybe FailWorkflowExecutionDecisionAttributes)
  , _dStartChildWorkflowExecutionDecisionAttributes :: !(Maybe StartChildWorkflowExecutionDecisionAttributes)
  , _dCompleteWorkflowExecutionDecisionAttributes :: !(Maybe CompleteWorkflowExecutionDecisionAttributes)
  , _dScheduleLambdaFunctionDecisionAttributes :: !(Maybe ScheduleLambdaFunctionDecisionAttributes)
  , _dRequestCancelActivityTaskDecisionAttributes :: !(Maybe RequestCancelActivityTaskDecisionAttributes)
  , _dCancelWorkflowExecutionDecisionAttributes :: !(Maybe CancelWorkflowExecutionDecisionAttributes)
  , _dCancelTimerDecisionAttributes :: !(Maybe CancelTimerDecisionAttributes)
  , _dContinueAsNewWorkflowExecutionDecisionAttributes :: !(Maybe ContinueAsNewWorkflowExecutionDecisionAttributes)
  , _dDecisionType :: !DecisionType
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'Decision' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dRequestCancelExternalWorkflowExecutionDecisionAttributes' - Provides the details of the @RequestCancelExternalWorkflowExecution@ decision. It isn't set for other decision types.
--
-- * 'dScheduleActivityTaskDecisionAttributes' - Provides the details of the @ScheduleActivityTask@ decision. It isn't set for other decision types.
--
-- * 'dSignalExternalWorkflowExecutionDecisionAttributes' - Provides the details of the @SignalExternalWorkflowExecution@ decision. It isn't set for other decision types.
--
-- * 'dStartTimerDecisionAttributes' - Provides the details of the @StartTimer@ decision. It isn't set for other decision types.
--
-- * 'dRecordMarkerDecisionAttributes' - Provides the details of the @RecordMarker@ decision. It isn't set for other decision types.
--
-- * 'dFailWorkflowExecutionDecisionAttributes' - Provides the details of the @FailWorkflowExecution@ decision. It isn't set for other decision types.
--
-- * 'dStartChildWorkflowExecutionDecisionAttributes' - Provides the details of the @StartChildWorkflowExecution@ decision. It isn't set for other decision types.
--
-- * 'dCompleteWorkflowExecutionDecisionAttributes' - Provides the details of the @CompleteWorkflowExecution@ decision. It isn't set for other decision types.
--
-- * 'dScheduleLambdaFunctionDecisionAttributes' - Provides the details of the @ScheduleLambdaFunction@ decision. It isn't set for other decision types.
--
-- * 'dRequestCancelActivityTaskDecisionAttributes' - Provides the details of the @RequestCancelActivityTask@ decision. It isn't set for other decision types.
--
-- * 'dCancelWorkflowExecutionDecisionAttributes' - Provides the details of the @CancelWorkflowExecution@ decision. It isn't set for other decision types.
--
-- * 'dCancelTimerDecisionAttributes' - Provides the details of the @CancelTimer@ decision. It isn't set for other decision types.
--
-- * 'dContinueAsNewWorkflowExecutionDecisionAttributes' - Provides the details of the @ContinueAsNewWorkflowExecution@ decision. It isn't set for other decision types.
--
-- * 'dDecisionType' - Specifies the type of the decision.
decision
    :: DecisionType -- ^ 'dDecisionType'
    -> Decision
decision pDecisionType_ =
  Decision'
    { _dRequestCancelExternalWorkflowExecutionDecisionAttributes = Nothing
    , _dScheduleActivityTaskDecisionAttributes = Nothing
    , _dSignalExternalWorkflowExecutionDecisionAttributes = Nothing
    , _dStartTimerDecisionAttributes = Nothing
    , _dRecordMarkerDecisionAttributes = Nothing
    , _dFailWorkflowExecutionDecisionAttributes = Nothing
    , _dStartChildWorkflowExecutionDecisionAttributes = Nothing
    , _dCompleteWorkflowExecutionDecisionAttributes = Nothing
    , _dScheduleLambdaFunctionDecisionAttributes = Nothing
    , _dRequestCancelActivityTaskDecisionAttributes = Nothing
    , _dCancelWorkflowExecutionDecisionAttributes = Nothing
    , _dCancelTimerDecisionAttributes = Nothing
    , _dContinueAsNewWorkflowExecutionDecisionAttributes = Nothing
    , _dDecisionType = pDecisionType_
    }


-- | Provides the details of the @RequestCancelExternalWorkflowExecution@ decision. It isn't set for other decision types.
dRequestCancelExternalWorkflowExecutionDecisionAttributes :: Lens' Decision (Maybe RequestCancelExternalWorkflowExecutionDecisionAttributes)
dRequestCancelExternalWorkflowExecutionDecisionAttributes = lens _dRequestCancelExternalWorkflowExecutionDecisionAttributes (\ s a -> s{_dRequestCancelExternalWorkflowExecutionDecisionAttributes = a})

-- | Provides the details of the @ScheduleActivityTask@ decision. It isn't set for other decision types.
dScheduleActivityTaskDecisionAttributes :: Lens' Decision (Maybe ScheduleActivityTaskDecisionAttributes)
dScheduleActivityTaskDecisionAttributes = lens _dScheduleActivityTaskDecisionAttributes (\ s a -> s{_dScheduleActivityTaskDecisionAttributes = a})

-- | Provides the details of the @SignalExternalWorkflowExecution@ decision. It isn't set for other decision types.
dSignalExternalWorkflowExecutionDecisionAttributes :: Lens' Decision (Maybe SignalExternalWorkflowExecutionDecisionAttributes)
dSignalExternalWorkflowExecutionDecisionAttributes = lens _dSignalExternalWorkflowExecutionDecisionAttributes (\ s a -> s{_dSignalExternalWorkflowExecutionDecisionAttributes = a})

-- | Provides the details of the @StartTimer@ decision. It isn't set for other decision types.
dStartTimerDecisionAttributes :: Lens' Decision (Maybe StartTimerDecisionAttributes)
dStartTimerDecisionAttributes = lens _dStartTimerDecisionAttributes (\ s a -> s{_dStartTimerDecisionAttributes = a})

-- | Provides the details of the @RecordMarker@ decision. It isn't set for other decision types.
dRecordMarkerDecisionAttributes :: Lens' Decision (Maybe RecordMarkerDecisionAttributes)
dRecordMarkerDecisionAttributes = lens _dRecordMarkerDecisionAttributes (\ s a -> s{_dRecordMarkerDecisionAttributes = a})

-- | Provides the details of the @FailWorkflowExecution@ decision. It isn't set for other decision types.
dFailWorkflowExecutionDecisionAttributes :: Lens' Decision (Maybe FailWorkflowExecutionDecisionAttributes)
dFailWorkflowExecutionDecisionAttributes = lens _dFailWorkflowExecutionDecisionAttributes (\ s a -> s{_dFailWorkflowExecutionDecisionAttributes = a})

-- | Provides the details of the @StartChildWorkflowExecution@ decision. It isn't set for other decision types.
dStartChildWorkflowExecutionDecisionAttributes :: Lens' Decision (Maybe StartChildWorkflowExecutionDecisionAttributes)
dStartChildWorkflowExecutionDecisionAttributes = lens _dStartChildWorkflowExecutionDecisionAttributes (\ s a -> s{_dStartChildWorkflowExecutionDecisionAttributes = a})

-- | Provides the details of the @CompleteWorkflowExecution@ decision. It isn't set for other decision types.
dCompleteWorkflowExecutionDecisionAttributes :: Lens' Decision (Maybe CompleteWorkflowExecutionDecisionAttributes)
dCompleteWorkflowExecutionDecisionAttributes = lens _dCompleteWorkflowExecutionDecisionAttributes (\ s a -> s{_dCompleteWorkflowExecutionDecisionAttributes = a})

-- | Provides the details of the @ScheduleLambdaFunction@ decision. It isn't set for other decision types.
dScheduleLambdaFunctionDecisionAttributes :: Lens' Decision (Maybe ScheduleLambdaFunctionDecisionAttributes)
dScheduleLambdaFunctionDecisionAttributes = lens _dScheduleLambdaFunctionDecisionAttributes (\ s a -> s{_dScheduleLambdaFunctionDecisionAttributes = a})

-- | Provides the details of the @RequestCancelActivityTask@ decision. It isn't set for other decision types.
dRequestCancelActivityTaskDecisionAttributes :: Lens' Decision (Maybe RequestCancelActivityTaskDecisionAttributes)
dRequestCancelActivityTaskDecisionAttributes = lens _dRequestCancelActivityTaskDecisionAttributes (\ s a -> s{_dRequestCancelActivityTaskDecisionAttributes = a})

-- | Provides the details of the @CancelWorkflowExecution@ decision. It isn't set for other decision types.
dCancelWorkflowExecutionDecisionAttributes :: Lens' Decision (Maybe CancelWorkflowExecutionDecisionAttributes)
dCancelWorkflowExecutionDecisionAttributes = lens _dCancelWorkflowExecutionDecisionAttributes (\ s a -> s{_dCancelWorkflowExecutionDecisionAttributes = a})

-- | Provides the details of the @CancelTimer@ decision. It isn't set for other decision types.
dCancelTimerDecisionAttributes :: Lens' Decision (Maybe CancelTimerDecisionAttributes)
dCancelTimerDecisionAttributes = lens _dCancelTimerDecisionAttributes (\ s a -> s{_dCancelTimerDecisionAttributes = a})

-- | Provides the details of the @ContinueAsNewWorkflowExecution@ decision. It isn't set for other decision types.
dContinueAsNewWorkflowExecutionDecisionAttributes :: Lens' Decision (Maybe ContinueAsNewWorkflowExecutionDecisionAttributes)
dContinueAsNewWorkflowExecutionDecisionAttributes = lens _dContinueAsNewWorkflowExecutionDecisionAttributes (\ s a -> s{_dContinueAsNewWorkflowExecutionDecisionAttributes = a})

-- | Specifies the type of the decision.
dDecisionType :: Lens' Decision DecisionType
dDecisionType = lens _dDecisionType (\ s a -> s{_dDecisionType = a})

instance Hashable Decision where

instance NFData Decision where

instance ToJSON Decision where
        toJSON Decision'{..}
          = object
              (catMaybes
                 [("requestCancelExternalWorkflowExecutionDecisionAttributes"
                     .=)
                    <$>
                    _dRequestCancelExternalWorkflowExecutionDecisionAttributes,
                  ("scheduleActivityTaskDecisionAttributes" .=) <$>
                    _dScheduleActivityTaskDecisionAttributes,
                  ("signalExternalWorkflowExecutionDecisionAttributes"
                     .=)
                    <$>
                    _dSignalExternalWorkflowExecutionDecisionAttributes,
                  ("startTimerDecisionAttributes" .=) <$>
                    _dStartTimerDecisionAttributes,
                  ("recordMarkerDecisionAttributes" .=) <$>
                    _dRecordMarkerDecisionAttributes,
                  ("failWorkflowExecutionDecisionAttributes" .=) <$>
                    _dFailWorkflowExecutionDecisionAttributes,
                  ("startChildWorkflowExecutionDecisionAttributes" .=)
                    <$> _dStartChildWorkflowExecutionDecisionAttributes,
                  ("completeWorkflowExecutionDecisionAttributes" .=)
                    <$> _dCompleteWorkflowExecutionDecisionAttributes,
                  ("scheduleLambdaFunctionDecisionAttributes" .=) <$>
                    _dScheduleLambdaFunctionDecisionAttributes,
                  ("requestCancelActivityTaskDecisionAttributes" .=)
                    <$> _dRequestCancelActivityTaskDecisionAttributes,
                  ("cancelWorkflowExecutionDecisionAttributes" .=) <$>
                    _dCancelWorkflowExecutionDecisionAttributes,
                  ("cancelTimerDecisionAttributes" .=) <$>
                    _dCancelTimerDecisionAttributes,
                  ("continueAsNewWorkflowExecutionDecisionAttributes"
                     .=)
                    <$>
                    _dContinueAsNewWorkflowExecutionDecisionAttributes,
                  Just ("decisionType" .= _dDecisionType)])

-- | Provides the details of the @DecisionTaskCompleted@ event.
--
--
--
-- /See:/ 'decisionTaskCompletedEventAttributes' smart constructor.
data DecisionTaskCompletedEventAttributes = DecisionTaskCompletedEventAttributes'
  { _dtceaExecutionContext :: !(Maybe Text)
  , _dtceaScheduledEventId :: !Integer
  , _dtceaStartedEventId   :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'DecisionTaskCompletedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dtceaExecutionContext' - User defined context for the workflow execution.
--
-- * 'dtceaScheduledEventId' - The ID of the @DecisionTaskScheduled@ event that was recorded when this decision task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
--
-- * 'dtceaStartedEventId' - The ID of the @DecisionTaskStarted@ event recorded when this decision task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
decisionTaskCompletedEventAttributes
    :: Integer -- ^ 'dtceaScheduledEventId'
    -> Integer -- ^ 'dtceaStartedEventId'
    -> DecisionTaskCompletedEventAttributes
decisionTaskCompletedEventAttributes pScheduledEventId_ pStartedEventId_ =
  DecisionTaskCompletedEventAttributes'
    { _dtceaExecutionContext = Nothing
    , _dtceaScheduledEventId = pScheduledEventId_
    , _dtceaStartedEventId = pStartedEventId_
    }


-- | User defined context for the workflow execution.
dtceaExecutionContext :: Lens' DecisionTaskCompletedEventAttributes (Maybe Text)
dtceaExecutionContext = lens _dtceaExecutionContext (\ s a -> s{_dtceaExecutionContext = a})

-- | The ID of the @DecisionTaskScheduled@ event that was recorded when this decision task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
dtceaScheduledEventId :: Lens' DecisionTaskCompletedEventAttributes Integer
dtceaScheduledEventId = lens _dtceaScheduledEventId (\ s a -> s{_dtceaScheduledEventId = a})

-- | The ID of the @DecisionTaskStarted@ event recorded when this decision task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
dtceaStartedEventId :: Lens' DecisionTaskCompletedEventAttributes Integer
dtceaStartedEventId = lens _dtceaStartedEventId (\ s a -> s{_dtceaStartedEventId = a})

instance FromJSON
           DecisionTaskCompletedEventAttributes
         where
        parseJSON
          = withObject "DecisionTaskCompletedEventAttributes"
              (\ x ->
                 DecisionTaskCompletedEventAttributes' <$>
                   (x .:? "executionContext") <*>
                     (x .: "scheduledEventId")
                     <*> (x .: "startedEventId"))

instance Hashable
           DecisionTaskCompletedEventAttributes
         where

instance NFData DecisionTaskCompletedEventAttributes
         where

-- | Provides details about the @DecisionTaskScheduled@ event.
--
--
--
-- /See:/ 'decisionTaskScheduledEventAttributes' smart constructor.
data DecisionTaskScheduledEventAttributes = DecisionTaskScheduledEventAttributes'
  { _dtseaTaskPriority        :: !(Maybe Text)
  , _dtseaStartToCloseTimeout :: !(Maybe Text)
  , _dtseaTaskList            :: !TaskList
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'DecisionTaskScheduledEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dtseaTaskPriority' - A task priority that, if set, specifies the priority for this decision task. Valid values are integers that range from Java's @Integer.MIN_VALUE@ (-2147483648) to @Integer.MAX_VALUE@ (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/programming-priority.html Setting Task Priority> in the /Amazon SWF Developer Guide/ .
--
-- * 'dtseaStartToCloseTimeout' - The maximum duration for this decision task. The task is considered timed out if it doesn't completed within this duration. The duration is specified in seconds, an integer greater than or equal to @0@ . You can use @NONE@ to specify unlimited duration.
--
-- * 'dtseaTaskList' - The name of the task list in which the decision task was scheduled.
decisionTaskScheduledEventAttributes
    :: TaskList -- ^ 'dtseaTaskList'
    -> DecisionTaskScheduledEventAttributes
decisionTaskScheduledEventAttributes pTaskList_ =
  DecisionTaskScheduledEventAttributes'
    { _dtseaTaskPriority = Nothing
    , _dtseaStartToCloseTimeout = Nothing
    , _dtseaTaskList = pTaskList_
    }


-- | A task priority that, if set, specifies the priority for this decision task. Valid values are integers that range from Java's @Integer.MIN_VALUE@ (-2147483648) to @Integer.MAX_VALUE@ (2147483647). Higher numbers indicate higher priority. For more information about setting task priority, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/programming-priority.html Setting Task Priority> in the /Amazon SWF Developer Guide/ .
dtseaTaskPriority :: Lens' DecisionTaskScheduledEventAttributes (Maybe Text)
dtseaTaskPriority = lens _dtseaTaskPriority (\ s a -> s{_dtseaTaskPriority = a})

-- | The maximum duration for this decision task. The task is considered timed out if it doesn't completed within this duration. The duration is specified in seconds, an integer greater than or equal to @0@ . You can use @NONE@ to specify unlimited duration.
dtseaStartToCloseTimeout :: Lens' DecisionTaskScheduledEventAttributes (Maybe Text)
dtseaStartToCloseTimeout = lens _dtseaStartToCloseTimeout (\ s a -> s{_dtseaStartToCloseTimeout = a})

-- | The name of the task list in which the decision task was scheduled.
dtseaTaskList :: Lens' DecisionTaskScheduledEventAttributes TaskList
dtseaTaskList = lens _dtseaTaskList (\ s a -> s{_dtseaTaskList = a})

instance FromJSON
           DecisionTaskScheduledEventAttributes
         where
        parseJSON
          = withObject "DecisionTaskScheduledEventAttributes"
              (\ x ->
                 DecisionTaskScheduledEventAttributes' <$>
                   (x .:? "taskPriority") <*>
                     (x .:? "startToCloseTimeout")
                     <*> (x .: "taskList"))

instance Hashable
           DecisionTaskScheduledEventAttributes
         where

instance NFData DecisionTaskScheduledEventAttributes
         where

-- | Provides the details of the @DecisionTaskStarted@ event.
--
--
--
-- /See:/ 'decisionTaskStartedEventAttributes' smart constructor.
data DecisionTaskStartedEventAttributes = DecisionTaskStartedEventAttributes'
  { _dtseaIdentity         :: !(Maybe Text)
  , _dtseaScheduledEventId :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'DecisionTaskStartedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dtseaIdentity' - Identity of the decider making the request. This enables diagnostic tracing when problems arise. The form of this identity is user defined.
--
-- * 'dtseaScheduledEventId' - The ID of the @DecisionTaskScheduled@ event that was recorded when this decision task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
decisionTaskStartedEventAttributes
    :: Integer -- ^ 'dtseaScheduledEventId'
    -> DecisionTaskStartedEventAttributes
decisionTaskStartedEventAttributes pScheduledEventId_ =
  DecisionTaskStartedEventAttributes'
    {_dtseaIdentity = Nothing, _dtseaScheduledEventId = pScheduledEventId_}


-- | Identity of the decider making the request. This enables diagnostic tracing when problems arise. The form of this identity is user defined.
dtseaIdentity :: Lens' DecisionTaskStartedEventAttributes (Maybe Text)
dtseaIdentity = lens _dtseaIdentity (\ s a -> s{_dtseaIdentity = a})

-- | The ID of the @DecisionTaskScheduled@ event that was recorded when this decision task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
dtseaScheduledEventId :: Lens' DecisionTaskStartedEventAttributes Integer
dtseaScheduledEventId = lens _dtseaScheduledEventId (\ s a -> s{_dtseaScheduledEventId = a})

instance FromJSON DecisionTaskStartedEventAttributes
         where
        parseJSON
          = withObject "DecisionTaskStartedEventAttributes"
              (\ x ->
                 DecisionTaskStartedEventAttributes' <$>
                   (x .:? "identity") <*> (x .: "scheduledEventId"))

instance Hashable DecisionTaskStartedEventAttributes
         where

instance NFData DecisionTaskStartedEventAttributes
         where

-- | Provides the details of the @DecisionTaskTimedOut@ event.
--
--
--
-- /See:/ 'decisionTaskTimedOutEventAttributes' smart constructor.
data DecisionTaskTimedOutEventAttributes = DecisionTaskTimedOutEventAttributes'
  { _dttoeaTimeoutType      :: !DecisionTaskTimeoutType
  , _dttoeaScheduledEventId :: !Integer
  , _dttoeaStartedEventId   :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'DecisionTaskTimedOutEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dttoeaTimeoutType' - The type of timeout that expired before the decision task could be completed.
--
-- * 'dttoeaScheduledEventId' - The ID of the @DecisionTaskScheduled@ event that was recorded when this decision task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
--
-- * 'dttoeaStartedEventId' - The ID of the @DecisionTaskStarted@ event recorded when this decision task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
decisionTaskTimedOutEventAttributes
    :: DecisionTaskTimeoutType -- ^ 'dttoeaTimeoutType'
    -> Integer -- ^ 'dttoeaScheduledEventId'
    -> Integer -- ^ 'dttoeaStartedEventId'
    -> DecisionTaskTimedOutEventAttributes
decisionTaskTimedOutEventAttributes pTimeoutType_ pScheduledEventId_ pStartedEventId_ =
  DecisionTaskTimedOutEventAttributes'
    { _dttoeaTimeoutType = pTimeoutType_
    , _dttoeaScheduledEventId = pScheduledEventId_
    , _dttoeaStartedEventId = pStartedEventId_
    }


-- | The type of timeout that expired before the decision task could be completed.
dttoeaTimeoutType :: Lens' DecisionTaskTimedOutEventAttributes DecisionTaskTimeoutType
dttoeaTimeoutType = lens _dttoeaTimeoutType (\ s a -> s{_dttoeaTimeoutType = a})

-- | The ID of the @DecisionTaskScheduled@ event that was recorded when this decision task was scheduled. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
dttoeaScheduledEventId :: Lens' DecisionTaskTimedOutEventAttributes Integer
dttoeaScheduledEventId = lens _dttoeaScheduledEventId (\ s a -> s{_dttoeaScheduledEventId = a})

-- | The ID of the @DecisionTaskStarted@ event recorded when this decision task was started. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
dttoeaStartedEventId :: Lens' DecisionTaskTimedOutEventAttributes Integer
dttoeaStartedEventId = lens _dttoeaStartedEventId (\ s a -> s{_dttoeaStartedEventId = a})

instance FromJSON DecisionTaskTimedOutEventAttributes
         where
        parseJSON
          = withObject "DecisionTaskTimedOutEventAttributes"
              (\ x ->
                 DecisionTaskTimedOutEventAttributes' <$>
                   (x .: "timeoutType") <*> (x .: "scheduledEventId")
                     <*> (x .: "startedEventId"))

instance Hashable DecisionTaskTimedOutEventAttributes
         where

instance NFData DecisionTaskTimedOutEventAttributes
         where

-- | Contains the configuration settings of a domain.
--
--
--
-- /See:/ 'domainConfiguration' smart constructor.
newtype DomainConfiguration = DomainConfiguration'
  { _dcWorkflowExecutionRetentionPeriodInDays :: Text
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'DomainConfiguration' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dcWorkflowExecutionRetentionPeriodInDays' - The retention period for workflow executions in this domain.
domainConfiguration
    :: Text -- ^ 'dcWorkflowExecutionRetentionPeriodInDays'
    -> DomainConfiguration
domainConfiguration pWorkflowExecutionRetentionPeriodInDays_ =
  DomainConfiguration'
    { _dcWorkflowExecutionRetentionPeriodInDays =
        pWorkflowExecutionRetentionPeriodInDays_
    }


-- | The retention period for workflow executions in this domain.
dcWorkflowExecutionRetentionPeriodInDays :: Lens' DomainConfiguration Text
dcWorkflowExecutionRetentionPeriodInDays = lens _dcWorkflowExecutionRetentionPeriodInDays (\ s a -> s{_dcWorkflowExecutionRetentionPeriodInDays = a})

instance FromJSON DomainConfiguration where
        parseJSON
          = withObject "DomainConfiguration"
              (\ x ->
                 DomainConfiguration' <$>
                   (x .: "workflowExecutionRetentionPeriodInDays"))

instance Hashable DomainConfiguration where

instance NFData DomainConfiguration where

-- | Contains general information about a domain.
--
--
--
-- /See:/ 'domainInfo' smart constructor.
data DomainInfo = DomainInfo'
  { _diDescription :: !(Maybe Text)
  , _diName        :: !Text
  , _diStatus      :: !RegistrationStatus
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'DomainInfo' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'diDescription' - The description of the domain provided through 'RegisterDomain' .
--
-- * 'diName' - The name of the domain. This name is unique within the account.
--
-- * 'diStatus' - The status of the domain:     * @REGISTERED@ – The domain is properly registered and available. You can use this domain for registering types and creating new workflow executions.      * @DEPRECATED@ – The domain was deprecated using 'DeprecateDomain' , but is still in use. You should not create new workflow executions in this domain.
domainInfo
    :: Text -- ^ 'diName'
    -> RegistrationStatus -- ^ 'diStatus'
    -> DomainInfo
domainInfo pName_ pStatus_ =
  DomainInfo' {_diDescription = Nothing, _diName = pName_, _diStatus = pStatus_}


-- | The description of the domain provided through 'RegisterDomain' .
diDescription :: Lens' DomainInfo (Maybe Text)
diDescription = lens _diDescription (\ s a -> s{_diDescription = a})

-- | The name of the domain. This name is unique within the account.
diName :: Lens' DomainInfo Text
diName = lens _diName (\ s a -> s{_diName = a})

-- | The status of the domain:     * @REGISTERED@ – The domain is properly registered and available. You can use this domain for registering types and creating new workflow executions.      * @DEPRECATED@ – The domain was deprecated using 'DeprecateDomain' , but is still in use. You should not create new workflow executions in this domain.
diStatus :: Lens' DomainInfo RegistrationStatus
diStatus = lens _diStatus (\ s a -> s{_diStatus = a})

instance FromJSON DomainInfo where
        parseJSON
          = withObject "DomainInfo"
              (\ x ->
                 DomainInfo' <$>
                   (x .:? "description") <*> (x .: "name") <*>
                     (x .: "status"))

instance Hashable DomainInfo where

instance NFData DomainInfo where

-- | Used to filter the workflow executions in visibility APIs by various time-based rules. Each parameter, if specified, defines a rule that must be satisfied by each returned query result. The parameter values are in the <https://en.wikipedia.org/wiki/Unix_time Unix Time format> . For example: @"oldestDate": 1325376070.@
--
--
--
-- /See:/ 'executionTimeFilter' smart constructor.
data ExecutionTimeFilter = ExecutionTimeFilter'
  { _etfLatestDate :: !(Maybe POSIX)
  , _etfOldestDate :: !POSIX
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ExecutionTimeFilter' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'etfLatestDate' - Specifies the latest start or close date and time to return.
--
-- * 'etfOldestDate' - Specifies the oldest start or close date and time to return.
executionTimeFilter
    :: UTCTime -- ^ 'etfOldestDate'
    -> ExecutionTimeFilter
executionTimeFilter pOldestDate_ =
  ExecutionTimeFilter'
    {_etfLatestDate = Nothing, _etfOldestDate = _Time # pOldestDate_}


-- | Specifies the latest start or close date and time to return.
etfLatestDate :: Lens' ExecutionTimeFilter (Maybe UTCTime)
etfLatestDate = lens _etfLatestDate (\ s a -> s{_etfLatestDate = a}) . mapping _Time

-- | Specifies the oldest start or close date and time to return.
etfOldestDate :: Lens' ExecutionTimeFilter UTCTime
etfOldestDate = lens _etfOldestDate (\ s a -> s{_etfOldestDate = a}) . _Time

instance Hashable ExecutionTimeFilter where

instance NFData ExecutionTimeFilter where

instance ToJSON ExecutionTimeFilter where
        toJSON ExecutionTimeFilter'{..}
          = object
              (catMaybes
                 [("latestDate" .=) <$> _etfLatestDate,
                  Just ("oldestDate" .= _etfOldestDate)])

-- | Provides the details of the @ExternalWorkflowExecutionCancelRequested@ event.
--
--
--
-- /See:/ 'externalWorkflowExecutionCancelRequestedEventAttributes' smart constructor.
data ExternalWorkflowExecutionCancelRequestedEventAttributes = ExternalWorkflowExecutionCancelRequestedEventAttributes'
  { _ewecreaWorkflowExecution :: !WorkflowExecution
  , _ewecreaInitiatedEventId  :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ExternalWorkflowExecutionCancelRequestedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ewecreaWorkflowExecution' - The external workflow execution to which the cancellation request was delivered.
--
-- * 'ewecreaInitiatedEventId' - The ID of the @RequestCancelExternalWorkflowExecutionInitiated@ event corresponding to the @RequestCancelExternalWorkflowExecution@ decision to cancel this external workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
externalWorkflowExecutionCancelRequestedEventAttributes
    :: WorkflowExecution -- ^ 'ewecreaWorkflowExecution'
    -> Integer -- ^ 'ewecreaInitiatedEventId'
    -> ExternalWorkflowExecutionCancelRequestedEventAttributes
externalWorkflowExecutionCancelRequestedEventAttributes pWorkflowExecution_ pInitiatedEventId_ =
  ExternalWorkflowExecutionCancelRequestedEventAttributes'
    { _ewecreaWorkflowExecution = pWorkflowExecution_
    , _ewecreaInitiatedEventId = pInitiatedEventId_
    }


-- | The external workflow execution to which the cancellation request was delivered.
ewecreaWorkflowExecution :: Lens' ExternalWorkflowExecutionCancelRequestedEventAttributes WorkflowExecution
ewecreaWorkflowExecution = lens _ewecreaWorkflowExecution (\ s a -> s{_ewecreaWorkflowExecution = a})

-- | The ID of the @RequestCancelExternalWorkflowExecutionInitiated@ event corresponding to the @RequestCancelExternalWorkflowExecution@ decision to cancel this external workflow execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
ewecreaInitiatedEventId :: Lens' ExternalWorkflowExecutionCancelRequestedEventAttributes Integer
ewecreaInitiatedEventId = lens _ewecreaInitiatedEventId (\ s a -> s{_ewecreaInitiatedEventId = a})

instance FromJSON
           ExternalWorkflowExecutionCancelRequestedEventAttributes
         where
        parseJSON
          = withObject
              "ExternalWorkflowExecutionCancelRequestedEventAttributes"
              (\ x ->
                 ExternalWorkflowExecutionCancelRequestedEventAttributes'
                   <$>
                   (x .: "workflowExecution") <*>
                     (x .: "initiatedEventId"))

instance Hashable
           ExternalWorkflowExecutionCancelRequestedEventAttributes
         where

instance NFData
           ExternalWorkflowExecutionCancelRequestedEventAttributes
         where

-- | Provides the details of the @ExternalWorkflowExecutionSignaled@ event.
--
--
--
-- /See:/ 'externalWorkflowExecutionSignaledEventAttributes' smart constructor.
data ExternalWorkflowExecutionSignaledEventAttributes = ExternalWorkflowExecutionSignaledEventAttributes'
  { _eweseaWorkflowExecution :: !WorkflowExecution
  , _eweseaInitiatedEventId  :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'ExternalWorkflowExecutionSignaledEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'eweseaWorkflowExecution' - The external workflow execution that the signal was delivered to.
--
-- * 'eweseaInitiatedEventId' - The ID of the @SignalExternalWorkflowExecutionInitiated@ event corresponding to the @SignalExternalWorkflowExecution@ decision to request this signal. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
externalWorkflowExecutionSignaledEventAttributes
    :: WorkflowExecution -- ^ 'eweseaWorkflowExecution'
    -> Integer -- ^ 'eweseaInitiatedEventId'
    -> ExternalWorkflowExecutionSignaledEventAttributes
externalWorkflowExecutionSignaledEventAttributes pWorkflowExecution_ pInitiatedEventId_ =
  ExternalWorkflowExecutionSignaledEventAttributes'
    { _eweseaWorkflowExecution = pWorkflowExecution_
    , _eweseaInitiatedEventId = pInitiatedEventId_
    }


-- | The external workflow execution that the signal was delivered to.
eweseaWorkflowExecution :: Lens' ExternalWorkflowExecutionSignaledEventAttributes WorkflowExecution
eweseaWorkflowExecution = lens _eweseaWorkflowExecution (\ s a -> s{_eweseaWorkflowExecution = a})

-- | The ID of the @SignalExternalWorkflowExecutionInitiated@ event corresponding to the @SignalExternalWorkflowExecution@ decision to request this signal. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
eweseaInitiatedEventId :: Lens' ExternalWorkflowExecutionSignaledEventAttributes Integer
eweseaInitiatedEventId = lens _eweseaInitiatedEventId (\ s a -> s{_eweseaInitiatedEventId = a})

instance FromJSON
           ExternalWorkflowExecutionSignaledEventAttributes
         where
        parseJSON
          = withObject
              "ExternalWorkflowExecutionSignaledEventAttributes"
              (\ x ->
                 ExternalWorkflowExecutionSignaledEventAttributes' <$>
                   (x .: "workflowExecution") <*>
                     (x .: "initiatedEventId"))

instance Hashable
           ExternalWorkflowExecutionSignaledEventAttributes
         where

instance NFData
           ExternalWorkflowExecutionSignaledEventAttributes
         where

-- | Provides the details of the @FailWorkflowExecution@ decision.
--
--
-- __Access Control__
--
-- You can use IAM policies to control this decision's access to Amazon SWF resources as follows:
--
--     * Use a @Resource@ element with the domain name to limit the action to only specified domains.
--
--     * Use an @Action@ element to allow or deny permission to call this action.
--
--     * You cannot use an IAM policy to constrain this action's parameters.
--
--
--
-- If the caller doesn't have sufficient permissions to invoke the action, or the parameter values fall outside the specified constraints, the action fails. The associated event attribute's @cause@ parameter is set to @OPERATION_NOT_PERMITTED@ . For details and example IAM policies, see <http://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows> in the /Amazon SWF Developer Guide/ .
--
--
-- /See:/ 'failWorkflowExecutionDecisionAttributes' smart constructor.
data FailWorkflowExecutionDecisionAttributes = FailWorkflowExecutionDecisionAttributes'
  { _fwedaReason  :: !(Maybe Text)
  , _fwedaDetails :: !(Maybe Text)
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'FailWorkflowExecutionDecisionAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'fwedaReason' - A descriptive reason for the failure that may help in diagnostics.
--
-- * 'fwedaDetails' - Details of the failure.
failWorkflowExecutionDecisionAttributes
    :: FailWorkflowExecutionDecisionAttributes
failWorkflowExecutionDecisionAttributes =
  FailWorkflowExecutionDecisionAttributes'
    {_fwedaReason = Nothing, _fwedaDetails = Nothing}


-- | A descriptive reason for the failure that may help in diagnostics.
fwedaReason :: Lens' FailWorkflowExecutionDecisionAttributes (Maybe Text)
fwedaReason = lens _fwedaReason (\ s a -> s{_fwedaReason = a})

-- | Details of the failure.
fwedaDetails :: Lens' FailWorkflowExecutionDecisionAttributes (Maybe Text)
fwedaDetails = lens _fwedaDetails (\ s a -> s{_fwedaDetails = a})

instance Hashable
           FailWorkflowExecutionDecisionAttributes
         where

instance NFData
           FailWorkflowExecutionDecisionAttributes
         where

instance ToJSON
           FailWorkflowExecutionDecisionAttributes
         where
        toJSON FailWorkflowExecutionDecisionAttributes'{..}
          = object
              (catMaybes
                 [("reason" .=) <$> _fwedaReason,
                  ("details" .=) <$> _fwedaDetails])

-- | Provides the details of the @FailWorkflowExecutionFailed@ event.
--
--
--
-- /See:/ 'failWorkflowExecutionFailedEventAttributes' smart constructor.
data FailWorkflowExecutionFailedEventAttributes = FailWorkflowExecutionFailedEventAttributes'
  { _fwefeaCause                        :: !FailWorkflowExecutionFailedCause
  , _fwefeaDecisionTaskCompletedEventId :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'FailWorkflowExecutionFailedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'fwefeaCause' - The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes.
--
-- * 'fwefeaDecisionTaskCompletedEventId' - The ID of the @DecisionTaskCompleted@ event corresponding to the decision task that resulted in the @FailWorkflowExecution@ decision to fail this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
failWorkflowExecutionFailedEventAttributes
    :: FailWorkflowExecutionFailedCause -- ^ 'fwefeaCause'
    -> Integer -- ^ 'fwefeaDecisionTaskCompletedEventId'
    -> FailWorkflowExecutionFailedEventAttributes
failWorkflowExecutionFailedEventAttributes pCause_ pDecisionTaskCompletedEventId_ =
  FailWorkflowExecutionFailedEventAttributes'
    { _fwefeaCause = pCause_
    , _fwefeaDecisionTaskCompletedEventId = pDecisionTaskCompletedEventId_
    }


-- | The cause of the failure. This information is generated by the system and can be useful for diagnostic purposes.
fwefeaCause :: Lens' FailWorkflowExecutionFailedEventAttributes FailWorkflowExecutionFailedCause
fwefeaCause = lens _fwefeaCause (\ s a -> s{_fwefeaCause = a})

-- | The ID of the @DecisionTaskCompleted@ event corresponding to the decision task that resulted in the @FailWorkflowExecution@ decision to fail this execution. This information can be useful for diagnosing problems by tracing back the chain of events leading up to this event.
fwefeaDecisionTaskCompletedEventId :: Lens' FailWorkflowExecutionFailedEventAttributes Integer
fwefeaDecisionTaskCompletedEventId = lens _fwefeaDecisionTaskCompletedEventId (\ s a -> s{_fwefeaDecisionTaskCompletedEventId = a})

instance FromJSON
           FailWorkflowExecutionFailedEventAttributes
         where
        parseJSON
          = withObject
              "FailWorkflowExecutionFailedEventAttributes"
              (\ x ->
                 FailWorkflowExecutionFailedEventAttributes' <$>
                   (x .: "cause") <*>
                     (x .: "decisionTaskCompletedEventId"))

instance Hashable
           FailWorkflowExecutionFailedEventAttributes
         where

instance NFData
           FailWorkflowExecutionFailedEventAttributes
         where

-- | Event within a workflow execution. A history event can be one of these types:
--
--
--     * @ActivityTaskCancelRequested@ – A @RequestCancelActivityTask@ decision was received by the system.
--
--     * @ActivityTaskCanceled@ – The activity task was successfully canceled.
--
--     * @ActivityTaskCompleted@ – An activity worker successfully completed an activity task by calling 'RespondActivityTaskCompleted' .
--
--     * @ActivityTaskFailed@ – An activity worker failed an activity task by calling 'RespondActivityTaskFailed' .
--
--     * @ActivityTaskScheduled@ – An activity task was scheduled for execution.
--
--     * @ActivityTaskStarted@ – The scheduled activity task was dispatched to a worker.
--
--     * @ActivityTaskTimedOut@ – The activity task timed out.
--
--     * @CancelTimerFailed@ – Failed to process CancelTimer decision. This happens when the decision isn't configured properly, for example no timer exists with the specified timer Id.
--
--     * @CancelWorkflowExecutionFailed@ – A request to cancel a workflow execution failed.
--
--     * @ChildWorkflowExecutionCanceled@ – A child workflow execution, started by this workflow execution, was canceled and closed.
--
--     * @ChildWorkflowExecutionCompleted@ – A child workflow execution, started by this workflow execution, completed successfully and was closed.
--
--     * @ChildWorkflowExecutionFailed@ – A child workflow execution, started by this workflow execution, failed to complete successfully and was closed.
--
--     * @ChildWorkflowExecutionStarted@ – A child workflow execution was successfully started.
--
--     * @ChildWorkflowExecutionTerminated@ – A child workflow execution, started by this workflow execution, was terminated.
--
--     * @ChildWorkflowExecutionTimedOut@ – A child workflow execution, started by this workflow execution, timed out and was closed.
--
--     * @CompleteWorkflowExecutionFailed@ – The workflow execution failed to complete.
--
--     * @ContinueAsNewWorkflowExecutionFailed@ – The workflow execution failed to complete after being continued as a new workflow execution.
--
--     * @DecisionTaskCompleted@ – The decider successfully completed a decision task by calling 'RespondDecisionTaskCompleted' .
--
--     * @DecisionTaskScheduled@ – A decision task was scheduled for the workflow execution.
--
--     * @DecisionTaskStarted@ – The decision task was dispatched to a decider.
--
--     * @DecisionTaskTimedOut@ – The decision task timed out.
--
--     * @ExternalWorkflowExecutionCancelRequested@ – Request to cancel an external workflow execution was successfully delivered to the target execution.
--
--     * @ExternalWorkflowExecutionSignaled@ – A signal, requested by this workflow execution, was successfully delivered to the target external workflow execution.
--
--     * @FailWorkflowExecutionFailed@ – A request to mark a workflow execution as failed, itself failed.
--
--     * @MarkerRecorded@ – A marker was recorded in the workflow history as the result of a @RecordMarker@ decision.
--
--     * @RecordMarkerFailed@ – A @RecordMarker@ decision was returned as failed.
--
--     * @RequestCancelActivityTaskFailed@ – Failed to process RequestCancelActivityTask decision. This happens when the decision isn't configured properly.
--
--     * @RequestCancelExternalWorkflowExecutionFailed@ – Request to cancel an external workflow execution failed.
--
--     * @RequestCancelExternalWorkflowExecutionInitiated@ – A request was made to request the cancellation of an external workflow execution.
--
--     * @ScheduleActivityTaskFailed@ – Failed to process ScheduleActivityTask decision. This happens when the decision isn't configured properly, for example the activity type specified isn't registered.
--
--     * @SignalExternalWorkflowExecutionFailed@ – The request to signal an external workflow execution failed.
--
--     * @SignalExternalWorkflowExecutionInitiated@ – A request to signal an external workflow was made.
--
--     * @StartActivityTaskFailed@ – A scheduled activity task failed to start.
--
--     * @StartChildWorkflowExecutionFailed@ – Failed to process StartChildWorkflowExecution decision. This happens when the decision isn't configured properly, for example the workflow type specified isn't registered.
--
--     * @StartChildWorkflowExecutionInitiated@ – A request was made to start a child workflow execution.
--
--     * @StartTimerFailed@ – Failed to process StartTimer decision. This happens when the decision isn't configured properly, for example a timer already exists with the specified timer Id.
--
--     * @TimerCanceled@ – A timer, previously started for this workflow execution, was successfully canceled.
--
--     * @TimerFired@ – A timer, previously started for this workflow execution, fired.
--
--     * @TimerStarted@ – A timer was started for the workflow execution due to a @StartTimer@ decision.
--
--     * @WorkflowExecutionCancelRequested@ – A request to cancel this workflow execution was made.
--
--     * @WorkflowExecutionCanceled@ – The workflow execution was successfully canceled and closed.
--
--     * @WorkflowExecutionCompleted@ – The workflow execution was closed due to successful completion.
--
--     * @WorkflowExecutionContinuedAsNew@ – The workflow execution was closed and a new execution of the same type was created with the same workflowId.
--
--     * @WorkflowExecutionFailed@ – The workflow execution closed due to a failure.
--
--     * @WorkflowExecutionSignaled@ – An external signal was received for the workflow execution.
--
--     * @WorkflowExecutionStarted@ – The workflow execution was started.
--
--     * @WorkflowExecutionTerminated@ – The workflow execution was terminated.
--
--     * @WorkflowExecutionTimedOut@ – The workflow execution was closed because a time out was exceeded.
--
--
--
--
-- /See:/ 'historyEvent' smart constructor.
data HistoryEvent = HistoryEvent'
  { _heWorkflowExecutionCancelRequestedEventAttributes :: !(Maybe WorkflowExecutionCancelRequestedEventAttributes)
  , _heRecordMarkerFailedEventAttributes :: !(Maybe RecordMarkerFailedEventAttributes)
  , _heRequestCancelExternalWorkflowExecutionInitiatedEventAttributes :: !(Maybe RequestCancelExternalWorkflowExecutionInitiatedEventAttributes)
  , _heLambdaFunctionStartedEventAttributes :: !(Maybe LambdaFunctionStartedEventAttributes)
  , _heDecisionTaskScheduledEventAttributes :: !(Maybe DecisionTaskScheduledEventAttributes)
  , _heWorkflowExecutionCompletedEventAttributes :: !(Maybe WorkflowExecutionCompletedEventAttributes)
  , _heStartTimerFailedEventAttributes :: !(Maybe StartTimerFailedEventAttributes)
  , _heActivityTaskScheduledEventAttributes :: !(Maybe ActivityTaskScheduledEventAttributes)
  , _heScheduleActivityTaskFailedEventAttributes :: !(Maybe ScheduleActivityTaskFailedEventAttributes)
  , _heChildWorkflowExecutionCompletedEventAttributes :: !(Maybe ChildWorkflowExecutionCompletedEventAttributes)
  , _heMarkerRecordedEventAttributes :: !(Maybe MarkerRecordedEventAttributes)
  , _heScheduleLambdaFunctionFailedEventAttributes :: !(Maybe ScheduleLambdaFunctionFailedEventAttributes)
  , _heCompleteWorkflowExecutionFailedEventAttributes :: !(Maybe CompleteWorkflowExecutionFailedEventAttributes)
  , _heLambdaFunctionCompletedEventAttributes :: !(Maybe LambdaFunctionCompletedEventAttributes)
  , _heRequestCancelExternalWorkflowExecutionFailedEventAttributes :: !(Maybe RequestCancelExternalWorkflowExecutionFailedEventAttributes)
  , _heTimerCanceledEventAttributes :: !(Maybe TimerCanceledEventAttributes)
  , _heWorkflowExecutionStartedEventAttributes :: !(Maybe WorkflowExecutionStartedEventAttributes)
  , _heActivityTaskCompletedEventAttributes :: !(Maybe ActivityTaskCompletedEventAttributes)
  , _heDecisionTaskTimedOutEventAttributes :: !(Maybe DecisionTaskTimedOutEventAttributes)
  , _heCancelTimerFailedEventAttributes :: !(Maybe CancelTimerFailedEventAttributes)
  , _heChildWorkflowExecutionStartedEventAttributes :: !(Maybe ChildWorkflowExecutionStartedEventAttributes)
  , _heActivityTaskCanceledEventAttributes :: !(Maybe ActivityTaskCanceledEventAttributes)
  , _heActivityTaskTimedOutEventAttributes :: !(Maybe ActivityTaskTimedOutEventAttributes)
  , _heDecisionTaskStartedEventAttributes :: !(Maybe DecisionTaskStartedEventAttributes)
  , _heWorkflowExecutionTerminatedEventAttributes :: !(Maybe WorkflowExecutionTerminatedEventAttributes)
  , _heChildWorkflowExecutionCanceledEventAttributes :: !(Maybe ChildWorkflowExecutionCanceledEventAttributes)
  , _heRequestCancelActivityTaskFailedEventAttributes :: !(Maybe RequestCancelActivityTaskFailedEventAttributes)
  , _heLambdaFunctionScheduledEventAttributes :: !(Maybe LambdaFunctionScheduledEventAttributes)
  , _heChildWorkflowExecutionTimedOutEventAttributes :: !(Maybe ChildWorkflowExecutionTimedOutEventAttributes)
  , _heCancelWorkflowExecutionFailedEventAttributes :: !(Maybe CancelWorkflowExecutionFailedEventAttributes)
  , _heStartChildWorkflowExecutionInitiatedEventAttributes :: !(Maybe StartChildWorkflowExecutionInitiatedEventAttributes)
  , _heSignalExternalWorkflowExecutionFailedEventAttributes :: !(Maybe SignalExternalWorkflowExecutionFailedEventAttributes)
  , _heActivityTaskStartedEventAttributes :: !(Maybe ActivityTaskStartedEventAttributes)
  , _heStartLambdaFunctionFailedEventAttributes :: !(Maybe StartLambdaFunctionFailedEventAttributes)
  , _heChildWorkflowExecutionTerminatedEventAttributes :: !(Maybe ChildWorkflowExecutionTerminatedEventAttributes)
  , _heLambdaFunctionFailedEventAttributes :: !(Maybe LambdaFunctionFailedEventAttributes)
  , _heWorkflowExecutionCanceledEventAttributes :: !(Maybe WorkflowExecutionCanceledEventAttributes)
  , _heTimerStartedEventAttributes :: !(Maybe TimerStartedEventAttributes)
  , _heActivityTaskCancelRequestedEventAttributes :: !(Maybe ActivityTaskCancelRequestedEventAttributes)
  , _heWorkflowExecutionTimedOutEventAttributes :: !(Maybe WorkflowExecutionTimedOutEventAttributes)
  , _heWorkflowExecutionSignaledEventAttributes :: !(Maybe WorkflowExecutionSignaledEventAttributes)
  , _heTimerFiredEventAttributes :: !(Maybe TimerFiredEventAttributes)
  , _heActivityTaskFailedEventAttributes :: !(Maybe ActivityTaskFailedEventAttributes)
  , _heExternalWorkflowExecutionSignaledEventAttributes :: !(Maybe ExternalWorkflowExecutionSignaledEventAttributes)
  , _heDecisionTaskCompletedEventAttributes :: !(Maybe DecisionTaskCompletedEventAttributes)
  , _heStartChildWorkflowExecutionFailedEventAttributes :: !(Maybe StartChildWorkflowExecutionFailedEventAttributes)
  , _heChildWorkflowExecutionFailedEventAttributes :: !(Maybe ChildWorkflowExecutionFailedEventAttributes)
  , _heFailWorkflowExecutionFailedEventAttributes :: !(Maybe FailWorkflowExecutionFailedEventAttributes)
  , _heContinueAsNewWorkflowExecutionFailedEventAttributes :: !(Maybe ContinueAsNewWorkflowExecutionFailedEventAttributes)
  , _heSignalExternalWorkflowExecutionInitiatedEventAttributes :: !(Maybe SignalExternalWorkflowExecutionInitiatedEventAttributes)
  , _heLambdaFunctionTimedOutEventAttributes :: !(Maybe LambdaFunctionTimedOutEventAttributes)
  , _heWorkflowExecutionFailedEventAttributes :: !(Maybe WorkflowExecutionFailedEventAttributes)
  , _heWorkflowExecutionContinuedAsNewEventAttributes :: !(Maybe WorkflowExecutionContinuedAsNewEventAttributes)
  , _heExternalWorkflowExecutionCancelRequestedEventAttributes :: !(Maybe ExternalWorkflowExecutionCancelRequestedEventAttributes)
  , _heEventTimestamp :: !POSIX
  , _heEventType :: !EventType
  , _heEventId :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'HistoryEvent' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'heWorkflowExecutionCancelRequestedEventAttributes' - If the event is of type @WorkflowExecutionCancelRequested@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heRecordMarkerFailedEventAttributes' - If the event is of type @DecisionTaskFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heRequestCancelExternalWorkflowExecutionInitiatedEventAttributes' - If the event is of type @RequestCancelExternalWorkflowExecutionInitiated@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heLambdaFunctionStartedEventAttributes' - Provides the details of the @LambdaFunctionStarted@ event. It isn't set for other event types.
--
-- * 'heDecisionTaskScheduledEventAttributes' - If the event is of type @DecisionTaskScheduled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heWorkflowExecutionCompletedEventAttributes' - If the event is of type @WorkflowExecutionCompleted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heStartTimerFailedEventAttributes' - If the event is of type @StartTimerFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heActivityTaskScheduledEventAttributes' - If the event is of type @ActivityTaskScheduled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heScheduleActivityTaskFailedEventAttributes' - If the event is of type @ScheduleActivityTaskFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heChildWorkflowExecutionCompletedEventAttributes' - If the event is of type @ChildWorkflowExecutionCompleted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heMarkerRecordedEventAttributes' - If the event is of type @MarkerRecorded@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heScheduleLambdaFunctionFailedEventAttributes' - Provides the details of the @ScheduleLambdaFunctionFailed@ event. It isn't set for other event types.
--
-- * 'heCompleteWorkflowExecutionFailedEventAttributes' - If the event is of type @CompleteWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heLambdaFunctionCompletedEventAttributes' - Provides the details of the @LambdaFunctionCompleted@ event. It isn't set for other event types.
--
-- * 'heRequestCancelExternalWorkflowExecutionFailedEventAttributes' - If the event is of type @RequestCancelExternalWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heTimerCanceledEventAttributes' - If the event is of type @TimerCanceled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heWorkflowExecutionStartedEventAttributes' - If the event is of type @WorkflowExecutionStarted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heActivityTaskCompletedEventAttributes' - If the event is of type @ActivityTaskCompleted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heDecisionTaskTimedOutEventAttributes' - If the event is of type @DecisionTaskTimedOut@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heCancelTimerFailedEventAttributes' - If the event is of type @CancelTimerFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heChildWorkflowExecutionStartedEventAttributes' - If the event is of type @ChildWorkflowExecutionStarted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heActivityTaskCanceledEventAttributes' - If the event is of type @ActivityTaskCanceled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heActivityTaskTimedOutEventAttributes' - If the event is of type @ActivityTaskTimedOut@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heDecisionTaskStartedEventAttributes' - If the event is of type @DecisionTaskStarted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heWorkflowExecutionTerminatedEventAttributes' - If the event is of type @WorkflowExecutionTerminated@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heChildWorkflowExecutionCanceledEventAttributes' - If the event is of type @ChildWorkflowExecutionCanceled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heRequestCancelActivityTaskFailedEventAttributes' - If the event is of type @RequestCancelActivityTaskFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heLambdaFunctionScheduledEventAttributes' - Provides the details of the @LambdaFunctionScheduled@ event. It isn't set for other event types.
--
-- * 'heChildWorkflowExecutionTimedOutEventAttributes' - If the event is of type @ChildWorkflowExecutionTimedOut@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heCancelWorkflowExecutionFailedEventAttributes' - If the event is of type @CancelWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heStartChildWorkflowExecutionInitiatedEventAttributes' - If the event is of type @StartChildWorkflowExecutionInitiated@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heSignalExternalWorkflowExecutionFailedEventAttributes' - If the event is of type @SignalExternalWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heActivityTaskStartedEventAttributes' - If the event is of type @ActivityTaskStarted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heStartLambdaFunctionFailedEventAttributes' - Provides the details of the @StartLambdaFunctionFailed@ event. It isn't set for other event types.
--
-- * 'heChildWorkflowExecutionTerminatedEventAttributes' - If the event is of type @ChildWorkflowExecutionTerminated@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heLambdaFunctionFailedEventAttributes' - Provides the details of the @LambdaFunctionFailed@ event. It isn't set for other event types.
--
-- * 'heWorkflowExecutionCanceledEventAttributes' - If the event is of type @WorkflowExecutionCanceled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heTimerStartedEventAttributes' - If the event is of type @TimerStarted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heActivityTaskCancelRequestedEventAttributes' - If the event is of type @ActivityTaskcancelRequested@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heWorkflowExecutionTimedOutEventAttributes' - If the event is of type @WorkflowExecutionTimedOut@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heWorkflowExecutionSignaledEventAttributes' - If the event is of type @WorkflowExecutionSignaled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heTimerFiredEventAttributes' - If the event is of type @TimerFired@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heActivityTaskFailedEventAttributes' - If the event is of type @ActivityTaskFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heExternalWorkflowExecutionSignaledEventAttributes' - If the event is of type @ExternalWorkflowExecutionSignaled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heDecisionTaskCompletedEventAttributes' - If the event is of type @DecisionTaskCompleted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heStartChildWorkflowExecutionFailedEventAttributes' - If the event is of type @StartChildWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heChildWorkflowExecutionFailedEventAttributes' - If the event is of type @ChildWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heFailWorkflowExecutionFailedEventAttributes' - If the event is of type @FailWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heContinueAsNewWorkflowExecutionFailedEventAttributes' - If the event is of type @ContinueAsNewWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heSignalExternalWorkflowExecutionInitiatedEventAttributes' - If the event is of type @SignalExternalWorkflowExecutionInitiated@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heLambdaFunctionTimedOutEventAttributes' - Provides the details of the @LambdaFunctionTimedOut@ event. It isn't set for other event types.
--
-- * 'heWorkflowExecutionFailedEventAttributes' - If the event is of type @WorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heWorkflowExecutionContinuedAsNewEventAttributes' - If the event is of type @WorkflowExecutionContinuedAsNew@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heExternalWorkflowExecutionCancelRequestedEventAttributes' - If the event is of type @ExternalWorkflowExecutionCancelRequested@ then this member is set and provides detailed information about the event. It isn't set for other event types.
--
-- * 'heEventTimestamp' - The date and time when the event occurred.
--
-- * 'heEventType' - The type of the history event.
--
-- * 'heEventId' - The system generated ID of the event. This ID uniquely identifies the event with in the workflow execution history.
historyEvent
    :: UTCTime -- ^ 'heEventTimestamp'
    -> EventType -- ^ 'heEventType'
    -> Integer -- ^ 'heEventId'
    -> HistoryEvent
historyEvent pEventTimestamp_ pEventType_ pEventId_ =
  HistoryEvent'
    { _heWorkflowExecutionCancelRequestedEventAttributes = Nothing
    , _heRecordMarkerFailedEventAttributes = Nothing
    , _heRequestCancelExternalWorkflowExecutionInitiatedEventAttributes =
        Nothing
    , _heLambdaFunctionStartedEventAttributes = Nothing
    , _heDecisionTaskScheduledEventAttributes = Nothing
    , _heWorkflowExecutionCompletedEventAttributes = Nothing
    , _heStartTimerFailedEventAttributes = Nothing
    , _heActivityTaskScheduledEventAttributes = Nothing
    , _heScheduleActivityTaskFailedEventAttributes = Nothing
    , _heChildWorkflowExecutionCompletedEventAttributes = Nothing
    , _heMarkerRecordedEventAttributes = Nothing
    , _heScheduleLambdaFunctionFailedEventAttributes = Nothing
    , _heCompleteWorkflowExecutionFailedEventAttributes = Nothing
    , _heLambdaFunctionCompletedEventAttributes = Nothing
    , _heRequestCancelExternalWorkflowExecutionFailedEventAttributes = Nothing
    , _heTimerCanceledEventAttributes = Nothing
    , _heWorkflowExecutionStartedEventAttributes = Nothing
    , _heActivityTaskCompletedEventAttributes = Nothing
    , _heDecisionTaskTimedOutEventAttributes = Nothing
    , _heCancelTimerFailedEventAttributes = Nothing
    , _heChildWorkflowExecutionStartedEventAttributes = Nothing
    , _heActivityTaskCanceledEventAttributes = Nothing
    , _heActivityTaskTimedOutEventAttributes = Nothing
    , _heDecisionTaskStartedEventAttributes = Nothing
    , _heWorkflowExecutionTerminatedEventAttributes = Nothing
    , _heChildWorkflowExecutionCanceledEventAttributes = Nothing
    , _heRequestCancelActivityTaskFailedEventAttributes = Nothing
    , _heLambdaFunctionScheduledEventAttributes = Nothing
    , _heChildWorkflowExecutionTimedOutEventAttributes = Nothing
    , _heCancelWorkflowExecutionFailedEventAttributes = Nothing
    , _heStartChildWorkflowExecutionInitiatedEventAttributes = Nothing
    , _heSignalExternalWorkflowExecutionFailedEventAttributes = Nothing
    , _heActivityTaskStartedEventAttributes = Nothing
    , _heStartLambdaFunctionFailedEventAttributes = Nothing
    , _heChildWorkflowExecutionTerminatedEventAttributes = Nothing
    , _heLambdaFunctionFailedEventAttributes = Nothing
    , _heWorkflowExecutionCanceledEventAttributes = Nothing
    , _heTimerStartedEventAttributes = Nothing
    , _heActivityTaskCancelRequestedEventAttributes = Nothing
    , _heWorkflowExecutionTimedOutEventAttributes = Nothing
    , _heWorkflowExecutionSignaledEventAttributes = Nothing
    , _heTimerFiredEventAttributes = Nothing
    , _heActivityTaskFailedEventAttributes = Nothing
    , _heExternalWorkflowExecutionSignaledEventAttributes = Nothing
    , _heDecisionTaskCompletedEventAttributes = Nothing
    , _heStartChildWorkflowExecutionFailedEventAttributes = Nothing
    , _heChildWorkflowExecutionFailedEventAttributes = Nothing
    , _heFailWorkflowExecutionFailedEventAttributes = Nothing
    , _heContinueAsNewWorkflowExecutionFailedEventAttributes = Nothing
    , _heSignalExternalWorkflowExecutionInitiatedEventAttributes = Nothing
    , _heLambdaFunctionTimedOutEventAttributes = Nothing
    , _heWorkflowExecutionFailedEventAttributes = Nothing
    , _heWorkflowExecutionContinuedAsNewEventAttributes = Nothing
    , _heExternalWorkflowExecutionCancelRequestedEventAttributes = Nothing
    , _heEventTimestamp = _Time # pEventTimestamp_
    , _heEventType = pEventType_
    , _heEventId = pEventId_
    }


-- | If the event is of type @WorkflowExecutionCancelRequested@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heWorkflowExecutionCancelRequestedEventAttributes :: Lens' HistoryEvent (Maybe WorkflowExecutionCancelRequestedEventAttributes)
heWorkflowExecutionCancelRequestedEventAttributes = lens _heWorkflowExecutionCancelRequestedEventAttributes (\ s a -> s{_heWorkflowExecutionCancelRequestedEventAttributes = a})

-- | If the event is of type @DecisionTaskFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heRecordMarkerFailedEventAttributes :: Lens' HistoryEvent (Maybe RecordMarkerFailedEventAttributes)
heRecordMarkerFailedEventAttributes = lens _heRecordMarkerFailedEventAttributes (\ s a -> s{_heRecordMarkerFailedEventAttributes = a})

-- | If the event is of type @RequestCancelExternalWorkflowExecutionInitiated@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heRequestCancelExternalWorkflowExecutionInitiatedEventAttributes :: Lens' HistoryEvent (Maybe RequestCancelExternalWorkflowExecutionInitiatedEventAttributes)
heRequestCancelExternalWorkflowExecutionInitiatedEventAttributes = lens _heRequestCancelExternalWorkflowExecutionInitiatedEventAttributes (\ s a -> s{_heRequestCancelExternalWorkflowExecutionInitiatedEventAttributes = a})

-- | Provides the details of the @LambdaFunctionStarted@ event. It isn't set for other event types.
heLambdaFunctionStartedEventAttributes :: Lens' HistoryEvent (Maybe LambdaFunctionStartedEventAttributes)
heLambdaFunctionStartedEventAttributes = lens _heLambdaFunctionStartedEventAttributes (\ s a -> s{_heLambdaFunctionStartedEventAttributes = a})

-- | If the event is of type @DecisionTaskScheduled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heDecisionTaskScheduledEventAttributes :: Lens' HistoryEvent (Maybe DecisionTaskScheduledEventAttributes)
heDecisionTaskScheduledEventAttributes = lens _heDecisionTaskScheduledEventAttributes (\ s a -> s{_heDecisionTaskScheduledEventAttributes = a})

-- | If the event is of type @WorkflowExecutionCompleted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heWorkflowExecutionCompletedEventAttributes :: Lens' HistoryEvent (Maybe WorkflowExecutionCompletedEventAttributes)
heWorkflowExecutionCompletedEventAttributes = lens _heWorkflowExecutionCompletedEventAttributes (\ s a -> s{_heWorkflowExecutionCompletedEventAttributes = a})

-- | If the event is of type @StartTimerFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heStartTimerFailedEventAttributes :: Lens' HistoryEvent (Maybe StartTimerFailedEventAttributes)
heStartTimerFailedEventAttributes = lens _heStartTimerFailedEventAttributes (\ s a -> s{_heStartTimerFailedEventAttributes = a})

-- | If the event is of type @ActivityTaskScheduled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heActivityTaskScheduledEventAttributes :: Lens' HistoryEvent (Maybe ActivityTaskScheduledEventAttributes)
heActivityTaskScheduledEventAttributes = lens _heActivityTaskScheduledEventAttributes (\ s a -> s{_heActivityTaskScheduledEventAttributes = a})

-- | If the event is of type @ScheduleActivityTaskFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heScheduleActivityTaskFailedEventAttributes :: Lens' HistoryEvent (Maybe ScheduleActivityTaskFailedEventAttributes)
heScheduleActivityTaskFailedEventAttributes = lens _heScheduleActivityTaskFailedEventAttributes (\ s a -> s{_heScheduleActivityTaskFailedEventAttributes = a})

-- | If the event is of type @ChildWorkflowExecutionCompleted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heChildWorkflowExecutionCompletedEventAttributes :: Lens' HistoryEvent (Maybe ChildWorkflowExecutionCompletedEventAttributes)
heChildWorkflowExecutionCompletedEventAttributes = lens _heChildWorkflowExecutionCompletedEventAttributes (\ s a -> s{_heChildWorkflowExecutionCompletedEventAttributes = a})

-- | If the event is of type @MarkerRecorded@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heMarkerRecordedEventAttributes :: Lens' HistoryEvent (Maybe MarkerRecordedEventAttributes)
heMarkerRecordedEventAttributes = lens _heMarkerRecordedEventAttributes (\ s a -> s{_heMarkerRecordedEventAttributes = a})

-- | Provides the details of the @ScheduleLambdaFunctionFailed@ event. It isn't set for other event types.
heScheduleLambdaFunctionFailedEventAttributes :: Lens' HistoryEvent (Maybe ScheduleLambdaFunctionFailedEventAttributes)
heScheduleLambdaFunctionFailedEventAttributes = lens _heScheduleLambdaFunctionFailedEventAttributes (\ s a -> s{_heScheduleLambdaFunctionFailedEventAttributes = a})

-- | If the event is of type @CompleteWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heCompleteWorkflowExecutionFailedEventAttributes :: Lens' HistoryEvent (Maybe CompleteWorkflowExecutionFailedEventAttributes)
heCompleteWorkflowExecutionFailedEventAttributes = lens _heCompleteWorkflowExecutionFailedEventAttributes (\ s a -> s{_heCompleteWorkflowExecutionFailedEventAttributes = a})

-- | Provides the details of the @LambdaFunctionCompleted@ event. It isn't set for other event types.
heLambdaFunctionCompletedEventAttributes :: Lens' HistoryEvent (Maybe LambdaFunctionCompletedEventAttributes)
heLambdaFunctionCompletedEventAttributes = lens _heLambdaFunctionCompletedEventAttributes (\ s a -> s{_heLambdaFunctionCompletedEventAttributes = a})

-- | If the event is of type @RequestCancelExternalWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heRequestCancelExternalWorkflowExecutionFailedEventAttributes :: Lens' HistoryEvent (Maybe RequestCancelExternalWorkflowExecutionFailedEventAttributes)
heRequestCancelExternalWorkflowExecutionFailedEventAttributes = lens _heRequestCancelExternalWorkflowExecutionFailedEventAttributes (\ s a -> s{_heRequestCancelExternalWorkflowExecutionFailedEventAttributes = a})

-- | If the event is of type @TimerCanceled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heTimerCanceledEventAttributes :: Lens' HistoryEvent (Maybe TimerCanceledEventAttributes)
heTimerCanceledEventAttributes = lens _heTimerCanceledEventAttributes (\ s a -> s{_heTimerCanceledEventAttributes = a})

-- | If the event is of type @WorkflowExecutionStarted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heWorkflowExecutionStartedEventAttributes :: Lens' HistoryEvent (Maybe WorkflowExecutionStartedEventAttributes)
heWorkflowExecutionStartedEventAttributes = lens _heWorkflowExecutionStartedEventAttributes (\ s a -> s{_heWorkflowExecutionStartedEventAttributes = a})

-- | If the event is of type @ActivityTaskCompleted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heActivityTaskCompletedEventAttributes :: Lens' HistoryEvent (Maybe ActivityTaskCompletedEventAttributes)
heActivityTaskCompletedEventAttributes = lens _heActivityTaskCompletedEventAttributes (\ s a -> s{_heActivityTaskCompletedEventAttributes = a})

-- | If the event is of type @DecisionTaskTimedOut@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heDecisionTaskTimedOutEventAttributes :: Lens' HistoryEvent (Maybe DecisionTaskTimedOutEventAttributes)
heDecisionTaskTimedOutEventAttributes = lens _heDecisionTaskTimedOutEventAttributes (\ s a -> s{_heDecisionTaskTimedOutEventAttributes = a})

-- | If the event is of type @CancelTimerFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heCancelTimerFailedEventAttributes :: Lens' HistoryEvent (Maybe CancelTimerFailedEventAttributes)
heCancelTimerFailedEventAttributes = lens _heCancelTimerFailedEventAttributes (\ s a -> s{_heCancelTimerFailedEventAttributes = a})

-- | If the event is of type @ChildWorkflowExecutionStarted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heChildWorkflowExecutionStartedEventAttributes :: Lens' HistoryEvent (Maybe ChildWorkflowExecutionStartedEventAttributes)
heChildWorkflowExecutionStartedEventAttributes = lens _heChildWorkflowExecutionStartedEventAttributes (\ s a -> s{_heChildWorkflowExecutionStartedEventAttributes = a})

-- | If the event is of type @ActivityTaskCanceled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heActivityTaskCanceledEventAttributes :: Lens' HistoryEvent (Maybe ActivityTaskCanceledEventAttributes)
heActivityTaskCanceledEventAttributes = lens _heActivityTaskCanceledEventAttributes (\ s a -> s{_heActivityTaskCanceledEventAttributes = a})

-- | If the event is of type @ActivityTaskTimedOut@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heActivityTaskTimedOutEventAttributes :: Lens' HistoryEvent (Maybe ActivityTaskTimedOutEventAttributes)
heActivityTaskTimedOutEventAttributes = lens _heActivityTaskTimedOutEventAttributes (\ s a -> s{_heActivityTaskTimedOutEventAttributes = a})

-- | If the event is of type @DecisionTaskStarted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heDecisionTaskStartedEventAttributes :: Lens' HistoryEvent (Maybe DecisionTaskStartedEventAttributes)
heDecisionTaskStartedEventAttributes = lens _heDecisionTaskStartedEventAttributes (\ s a -> s{_heDecisionTaskStartedEventAttributes = a})

-- | If the event is of type @WorkflowExecutionTerminated@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heWorkflowExecutionTerminatedEventAttributes :: Lens' HistoryEvent (Maybe WorkflowExecutionTerminatedEventAttributes)
heWorkflowExecutionTerminatedEventAttributes = lens _heWorkflowExecutionTerminatedEventAttributes (\ s a -> s{_heWorkflowExecutionTerminatedEventAttributes = a})

-- | If the event is of type @ChildWorkflowExecutionCanceled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heChildWorkflowExecutionCanceledEventAttributes :: Lens' HistoryEvent (Maybe ChildWorkflowExecutionCanceledEventAttributes)
heChildWorkflowExecutionCanceledEventAttributes = lens _heChildWorkflowExecutionCanceledEventAttributes (\ s a -> s{_heChildWorkflowExecutionCanceledEventAttributes = a})

-- | If the event is of type @RequestCancelActivityTaskFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heRequestCancelActivityTaskFailedEventAttributes :: Lens' HistoryEvent (Maybe RequestCancelActivityTaskFailedEventAttributes)
heRequestCancelActivityTaskFailedEventAttributes = lens _heRequestCancelActivityTaskFailedEventAttributes (\ s a -> s{_heRequestCancelActivityTaskFailedEventAttributes = a})

-- | Provides the details of the @LambdaFunctionScheduled@ event. It isn't set for other event types.
heLambdaFunctionScheduledEventAttributes :: Lens' HistoryEvent (Maybe LambdaFunctionScheduledEventAttributes)
heLambdaFunctionScheduledEventAttributes = lens _heLambdaFunctionScheduledEventAttributes (\ s a -> s{_heLambdaFunctionScheduledEventAttributes = a})

-- | If the event is of type @ChildWorkflowExecutionTimedOut@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heChildWorkflowExecutionTimedOutEventAttributes :: Lens' HistoryEvent (Maybe ChildWorkflowExecutionTimedOutEventAttributes)
heChildWorkflowExecutionTimedOutEventAttributes = lens _heChildWorkflowExecutionTimedOutEventAttributes (\ s a -> s{_heChildWorkflowExecutionTimedOutEventAttributes = a})

-- | If the event is of type @CancelWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heCancelWorkflowExecutionFailedEventAttributes :: Lens' HistoryEvent (Maybe CancelWorkflowExecutionFailedEventAttributes)
heCancelWorkflowExecutionFailedEventAttributes = lens _heCancelWorkflowExecutionFailedEventAttributes (\ s a -> s{_heCancelWorkflowExecutionFailedEventAttributes = a})

-- | If the event is of type @StartChildWorkflowExecutionInitiated@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heStartChildWorkflowExecutionInitiatedEventAttributes :: Lens' HistoryEvent (Maybe StartChildWorkflowExecutionInitiatedEventAttributes)
heStartChildWorkflowExecutionInitiatedEventAttributes = lens _heStartChildWorkflowExecutionInitiatedEventAttributes (\ s a -> s{_heStartChildWorkflowExecutionInitiatedEventAttributes = a})

-- | If the event is of type @SignalExternalWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heSignalExternalWorkflowExecutionFailedEventAttributes :: Lens' HistoryEvent (Maybe SignalExternalWorkflowExecutionFailedEventAttributes)
heSignalExternalWorkflowExecutionFailedEventAttributes = lens _heSignalExternalWorkflowExecutionFailedEventAttributes (\ s a -> s{_heSignalExternalWorkflowExecutionFailedEventAttributes = a})

-- | If the event is of type @ActivityTaskStarted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heActivityTaskStartedEventAttributes :: Lens' HistoryEvent (Maybe ActivityTaskStartedEventAttributes)
heActivityTaskStartedEventAttributes = lens _heActivityTaskStartedEventAttributes (\ s a -> s{_heActivityTaskStartedEventAttributes = a})

-- | Provides the details of the @StartLambdaFunctionFailed@ event. It isn't set for other event types.
heStartLambdaFunctionFailedEventAttributes :: Lens' HistoryEvent (Maybe StartLambdaFunctionFailedEventAttributes)
heStartLambdaFunctionFailedEventAttributes = lens _heStartLambdaFunctionFailedEventAttributes (\ s a -> s{_heStartLambdaFunctionFailedEventAttributes = a})

-- | If the event is of type @ChildWorkflowExecutionTerminated@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heChildWorkflowExecutionTerminatedEventAttributes :: Lens' HistoryEvent (Maybe ChildWorkflowExecutionTerminatedEventAttributes)
heChildWorkflowExecutionTerminatedEventAttributes = lens _heChildWorkflowExecutionTerminatedEventAttributes (\ s a -> s{_heChildWorkflowExecutionTerminatedEventAttributes = a})

-- | Provides the details of the @LambdaFunctionFailed@ event. It isn't set for other event types.
heLambdaFunctionFailedEventAttributes :: Lens' HistoryEvent (Maybe LambdaFunctionFailedEventAttributes)
heLambdaFunctionFailedEventAttributes = lens _heLambdaFunctionFailedEventAttributes (\ s a -> s{_heLambdaFunctionFailedEventAttributes = a})

-- | If the event is of type @WorkflowExecutionCanceled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heWorkflowExecutionCanceledEventAttributes :: Lens' HistoryEvent (Maybe WorkflowExecutionCanceledEventAttributes)
heWorkflowExecutionCanceledEventAttributes = lens _heWorkflowExecutionCanceledEventAttributes (\ s a -> s{_heWorkflowExecutionCanceledEventAttributes = a})

-- | If the event is of type @TimerStarted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heTimerStartedEventAttributes :: Lens' HistoryEvent (Maybe TimerStartedEventAttributes)
heTimerStartedEventAttributes = lens _heTimerStartedEventAttributes (\ s a -> s{_heTimerStartedEventAttributes = a})

-- | If the event is of type @ActivityTaskcancelRequested@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heActivityTaskCancelRequestedEventAttributes :: Lens' HistoryEvent (Maybe ActivityTaskCancelRequestedEventAttributes)
heActivityTaskCancelRequestedEventAttributes = lens _heActivityTaskCancelRequestedEventAttributes (\ s a -> s{_heActivityTaskCancelRequestedEventAttributes = a})

-- | If the event is of type @WorkflowExecutionTimedOut@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heWorkflowExecutionTimedOutEventAttributes :: Lens' HistoryEvent (Maybe WorkflowExecutionTimedOutEventAttributes)
heWorkflowExecutionTimedOutEventAttributes = lens _heWorkflowExecutionTimedOutEventAttributes (\ s a -> s{_heWorkflowExecutionTimedOutEventAttributes = a})

-- | If the event is of type @WorkflowExecutionSignaled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heWorkflowExecutionSignaledEventAttributes :: Lens' HistoryEvent (Maybe WorkflowExecutionSignaledEventAttributes)
heWorkflowExecutionSignaledEventAttributes = lens _heWorkflowExecutionSignaledEventAttributes (\ s a -> s{_heWorkflowExecutionSignaledEventAttributes = a})

-- | If the event is of type @TimerFired@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heTimerFiredEventAttributes :: Lens' HistoryEvent (Maybe TimerFiredEventAttributes)
heTimerFiredEventAttributes = lens _heTimerFiredEventAttributes (\ s a -> s{_heTimerFiredEventAttributes = a})

-- | If the event is of type @ActivityTaskFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heActivityTaskFailedEventAttributes :: Lens' HistoryEvent (Maybe ActivityTaskFailedEventAttributes)
heActivityTaskFailedEventAttributes = lens _heActivityTaskFailedEventAttributes (\ s a -> s{_heActivityTaskFailedEventAttributes = a})

-- | If the event is of type @ExternalWorkflowExecutionSignaled@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heExternalWorkflowExecutionSignaledEventAttributes :: Lens' HistoryEvent (Maybe ExternalWorkflowExecutionSignaledEventAttributes)
heExternalWorkflowExecutionSignaledEventAttributes = lens _heExternalWorkflowExecutionSignaledEventAttributes (\ s a -> s{_heExternalWorkflowExecutionSignaledEventAttributes = a})

-- | If the event is of type @DecisionTaskCompleted@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heDecisionTaskCompletedEventAttributes :: Lens' HistoryEvent (Maybe DecisionTaskCompletedEventAttributes)
heDecisionTaskCompletedEventAttributes = lens _heDecisionTaskCompletedEventAttributes (\ s a -> s{_heDecisionTaskCompletedEventAttributes = a})

-- | If the event is of type @StartChildWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heStartChildWorkflowExecutionFailedEventAttributes :: Lens' HistoryEvent (Maybe StartChildWorkflowExecutionFailedEventAttributes)
heStartChildWorkflowExecutionFailedEventAttributes = lens _heStartChildWorkflowExecutionFailedEventAttributes (\ s a -> s{_heStartChildWorkflowExecutionFailedEventAttributes = a})

-- | If the event is of type @ChildWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heChildWorkflowExecutionFailedEventAttributes :: Lens' HistoryEvent (Maybe ChildWorkflowExecutionFailedEventAttributes)
heChildWorkflowExecutionFailedEventAttributes = lens _heChildWorkflowExecutionFailedEventAttributes (\ s a -> s{_heChildWorkflowExecutionFailedEventAttributes = a})

-- | If the event is of type @FailWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heFailWorkflowExecutionFailedEventAttributes :: Lens' HistoryEvent (Maybe FailWorkflowExecutionFailedEventAttributes)
heFailWorkflowExecutionFailedEventAttributes = lens _heFailWorkflowExecutionFailedEventAttributes (\ s a -> s{_heFailWorkflowExecutionFailedEventAttributes = a})

-- | If the event is of type @ContinueAsNewWorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heContinueAsNewWorkflowExecutionFailedEventAttributes :: Lens' HistoryEvent (Maybe ContinueAsNewWorkflowExecutionFailedEventAttributes)
heContinueAsNewWorkflowExecutionFailedEventAttributes = lens _heContinueAsNewWorkflowExecutionFailedEventAttributes (\ s a -> s{_heContinueAsNewWorkflowExecutionFailedEventAttributes = a})

-- | If the event is of type @SignalExternalWorkflowExecutionInitiated@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heSignalExternalWorkflowExecutionInitiatedEventAttributes :: Lens' HistoryEvent (Maybe SignalExternalWorkflowExecutionInitiatedEventAttributes)
heSignalExternalWorkflowExecutionInitiatedEventAttributes = lens _heSignalExternalWorkflowExecutionInitiatedEventAttributes (\ s a -> s{_heSignalExternalWorkflowExecutionInitiatedEventAttributes = a})

-- | Provides the details of the @LambdaFunctionTimedOut@ event. It isn't set for other event types.
heLambdaFunctionTimedOutEventAttributes :: Lens' HistoryEvent (Maybe LambdaFunctionTimedOutEventAttributes)
heLambdaFunctionTimedOutEventAttributes = lens _heLambdaFunctionTimedOutEventAttributes (\ s a -> s{_heLambdaFunctionTimedOutEventAttributes = a})

-- | If the event is of type @WorkflowExecutionFailed@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heWorkflowExecutionFailedEventAttributes :: Lens' HistoryEvent (Maybe WorkflowExecutionFailedEventAttributes)
heWorkflowExecutionFailedEventAttributes = lens _heWorkflowExecutionFailedEventAttributes (\ s a -> s{_heWorkflowExecutionFailedEventAttributes = a})

-- | If the event is of type @WorkflowExecutionContinuedAsNew@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heWorkflowExecutionContinuedAsNewEventAttributes :: Lens' HistoryEvent (Maybe WorkflowExecutionContinuedAsNewEventAttributes)
heWorkflowExecutionContinuedAsNewEventAttributes = lens _heWorkflowExecutionContinuedAsNewEventAttributes (\ s a -> s{_heWorkflowExecutionContinuedAsNewEventAttributes = a})

-- | If the event is of type @ExternalWorkflowExecutionCancelRequested@ then this member is set and provides detailed information about the event. It isn't set for other event types.
heExternalWorkflowExecutionCancelRequestedEventAttributes :: Lens' HistoryEvent (Maybe ExternalWorkflowExecutionCancelRequestedEventAttributes)
heExternalWorkflowExecutionCancelRequestedEventAttributes = lens _heExternalWorkflowExecutionCancelRequestedEventAttributes (\ s a -> s{_heExternalWorkflowExecutionCancelRequestedEventAttributes = a})

-- | The date and time when the event occurred.
heEventTimestamp :: Lens' HistoryEvent UTCTime
heEventTimestamp = lens _heEventTimestamp (\ s a -> s{_heEventTimestamp = a}) . _Time

-- | The type of the history event.
heEventType :: Lens' HistoryEvent EventType
heEventType = lens _heEventType (\ s a -> s{_heEventType = a})

-- | The system generated ID of the event. This ID uniquely identifies the event with in the workflow execution history.
heEventId :: Lens' HistoryEvent Integer
heEventId = lens _heEventId (\ s a -> s{_heEventId = a})

instance FromJSON HistoryEvent where
        parseJSON
          = withObject "HistoryEvent"
              (\ x ->
                 HistoryEvent' <$>
                   (x .:?
                      "workflowExecutionCancelRequestedEventAttributes")
                     <*> (x .:? "recordMarkerFailedEventAttributes")
                     <*>
                     (x .:?
                        "requestCancelExternalWorkflowExecutionInitiatedEventAttributes")
                     <*> (x .:? "lambdaFunctionStartedEventAttributes")
                     <*> (x .:? "decisionTaskScheduledEventAttributes")
                     <*>
                     (x .:? "workflowExecutionCompletedEventAttributes")
                     <*> (x .:? "startTimerFailedEventAttributes")
                     <*> (x .:? "activityTaskScheduledEventAttributes")
                     <*>
                     (x .:? "scheduleActivityTaskFailedEventAttributes")
                     <*>
                     (x .:?
                        "childWorkflowExecutionCompletedEventAttributes")
                     <*> (x .:? "markerRecordedEventAttributes")
                     <*>
                     (x .:? "scheduleLambdaFunctionFailedEventAttributes")
                     <*>
                     (x .:?
                        "completeWorkflowExecutionFailedEventAttributes")
                     <*> (x .:? "lambdaFunctionCompletedEventAttributes")
                     <*>
                     (x .:?
                        "requestCancelExternalWorkflowExecutionFailedEventAttributes")
                     <*> (x .:? "timerCanceledEventAttributes")
                     <*> (x .:? "workflowExecutionStartedEventAttributes")
                     <*> (x .:? "activityTaskCompletedEventAttributes")
                     <*> (x .:? "decisionTaskTimedOutEventAttributes")
                     <*> (x .:? "cancelTimerFailedEventAttributes")
                     <*>
                     (x .:?
                        "childWorkflowExecutionStartedEventAttributes")
                     <*> (x .:? "activityTaskCanceledEventAttributes")
                     <*> (x .:? "activityTaskTimedOutEventAttributes")
                     <*> (x .:? "decisionTaskStartedEventAttributes")
                     <*>
                     (x .:? "workflowExecutionTerminatedEventAttributes")
                     <*>
                     (x .:?
                        "childWorkflowExecutionCanceledEventAttributes")
                     <*>
                     (x .:?
                        "requestCancelActivityTaskFailedEventAttributes")
                     <*> (x .:? "lambdaFunctionScheduledEventAttributes")
                     <*>
                     (x .:?
                        "childWorkflowExecutionTimedOutEventAttributes")
                     <*>
                     (x .:?
                        "cancelWorkflowExecutionFailedEventAttributes")
                     <*>
                     (x .:?
                        "startChildWorkflowExecutionInitiatedEventAttributes")
                     <*>
                     (x .:?
                        "signalExternalWorkflowExecutionFailedEventAttributes")
                     <*> (x .:? "activityTaskStartedEventAttributes")
                     <*>
                     (x .:? "startLambdaFunctionFailedEventAttributes")
                     <*>
                     (x .:?
                        "childWorkflowExecutionTerminatedEventAttributes")
                     <*> (x .:? "lambdaFunctionFailedEventAttributes")
                     <*>
                     (x .:? "workflowExecutionCanceledEventAttributes")
                     <*> (x .:? "timerStartedEventAttributes")
                     <*>
                     (x .:? "activityTaskCancelRequestedEventAttributes")
                     <*>
                     (x .:? "workflowExecutionTimedOutEventAttributes")
                     <*>
                     (x .:? "workflowExecutionSignaledEventAttributes")
                     <*> (x .:? "timerFiredEventAttributes")
                     <*> (x .:? "activityTaskFailedEventAttributes")
                     <*>
                     (x .:?
                        "externalWorkflowExecutionSignaledEventAttributes")
                     <*> (x .:? "decisionTaskCompletedEventAttributes")
                     <*>
                     (x .:?
                        "startChildWorkflowExecutionFailedEventAttributes")
                     <*>
                     (x .:? "childWorkflowExecutionFailedEventAttributes")
                     <*>
                     (x .:? "failWorkflowExecutionFailedEventAttributes")
                     <*>
                     (x .:?
                        "continueAsNewWorkflowExecutionFailedEventAttributes")
                     <*>
                     (x .:?
                        "signalExternalWorkflowExecutionInitiatedEventAttributes")
                     <*> (x .:? "lambdaFunctionTimedOutEventAttributes")
                     <*> (x .:? "workflowExecutionFailedEventAttributes")
                     <*>
                     (x .:?
                        "workflowExecutionContinuedAsNewEventAttributes")
                     <*>
                     (x .:?
                        "externalWorkflowExecutionCancelRequestedEventAttributes")
                     <*> (x .: "eventTimestamp")
                     <*> (x .: "eventType")
                     <*> (x .: "eventId"))

instance Hashable HistoryEvent where

instance NFData HistoryEvent where

-- | Provides the details of the @LambdaFunctionCompleted@ event. It isn't set for other event types.
--
--
--
-- /See:/ 'lambdaFunctionCompletedEventAttributes' smart constructor.
data LambdaFunctionCompletedEventAttributes = LambdaFunctionCompletedEventAttributes'
  { _lfceaResult           :: !(Maybe Text)
  , _lfceaScheduledEventId :: !Integer
  , _lfceaStartedEventId   :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'LambdaFunctionCompletedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lfceaResult' - The results of the Lambda task.
--
-- * 'lfceaScheduledEventId' - The ID of the @LambdaFunctionScheduled@ event that was recorded when this Lambda task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
--
-- * 'lfceaStartedEventId' - The ID of the @LambdaFunctionStarted@ event recorded when this activity task started. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
lambdaFunctionCompletedEventAttributes
    :: Integer -- ^ 'lfceaScheduledEventId'
    -> Integer -- ^ 'lfceaStartedEventId'
    -> LambdaFunctionCompletedEventAttributes
lambdaFunctionCompletedEventAttributes pScheduledEventId_ pStartedEventId_ =
  LambdaFunctionCompletedEventAttributes'
    { _lfceaResult = Nothing
    , _lfceaScheduledEventId = pScheduledEventId_
    , _lfceaStartedEventId = pStartedEventId_
    }


-- | The results of the Lambda task.
lfceaResult :: Lens' LambdaFunctionCompletedEventAttributes (Maybe Text)
lfceaResult = lens _lfceaResult (\ s a -> s{_lfceaResult = a})

-- | The ID of the @LambdaFunctionScheduled@ event that was recorded when this Lambda task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
lfceaScheduledEventId :: Lens' LambdaFunctionCompletedEventAttributes Integer
lfceaScheduledEventId = lens _lfceaScheduledEventId (\ s a -> s{_lfceaScheduledEventId = a})

-- | The ID of the @LambdaFunctionStarted@ event recorded when this activity task started. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
lfceaStartedEventId :: Lens' LambdaFunctionCompletedEventAttributes Integer
lfceaStartedEventId = lens _lfceaStartedEventId (\ s a -> s{_lfceaStartedEventId = a})

instance FromJSON
           LambdaFunctionCompletedEventAttributes
         where
        parseJSON
          = withObject "LambdaFunctionCompletedEventAttributes"
              (\ x ->
                 LambdaFunctionCompletedEventAttributes' <$>
                   (x .:? "result") <*> (x .: "scheduledEventId") <*>
                     (x .: "startedEventId"))

instance Hashable
           LambdaFunctionCompletedEventAttributes
         where

instance NFData
           LambdaFunctionCompletedEventAttributes
         where

-- | Provides the details of the @LambdaFunctionFailed@ event. It isn't set for other event types.
--
--
--
-- /See:/ 'lambdaFunctionFailedEventAttributes' smart constructor.
data LambdaFunctionFailedEventAttributes = LambdaFunctionFailedEventAttributes'
  { _lffeaReason           :: !(Maybe Text)
  , _lffeaDetails          :: !(Maybe Text)
  , _lffeaScheduledEventId :: !Integer
  , _lffeaStartedEventId   :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'LambdaFunctionFailedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lffeaReason' - The reason provided for the failure.
--
-- * 'lffeaDetails' - The details of the failure.
--
-- * 'lffeaScheduledEventId' - The ID of the @LambdaFunctionScheduled@ event that was recorded when this activity task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
--
-- * 'lffeaStartedEventId' - The ID of the @LambdaFunctionStarted@ event recorded when this activity task started. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
lambdaFunctionFailedEventAttributes
    :: Integer -- ^ 'lffeaScheduledEventId'
    -> Integer -- ^ 'lffeaStartedEventId'
    -> LambdaFunctionFailedEventAttributes
lambdaFunctionFailedEventAttributes pScheduledEventId_ pStartedEventId_ =
  LambdaFunctionFailedEventAttributes'
    { _lffeaReason = Nothing
    , _lffeaDetails = Nothing
    , _lffeaScheduledEventId = pScheduledEventId_
    , _lffeaStartedEventId = pStartedEventId_
    }


-- | The reason provided for the failure.
lffeaReason :: Lens' LambdaFunctionFailedEventAttributes (Maybe Text)
lffeaReason = lens _lffeaReason (\ s a -> s{_lffeaReason = a})

-- | The details of the failure.
lffeaDetails :: Lens' LambdaFunctionFailedEventAttributes (Maybe Text)
lffeaDetails = lens _lffeaDetails (\ s a -> s{_lffeaDetails = a})

-- | The ID of the @LambdaFunctionScheduled@ event that was recorded when this activity task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
lffeaScheduledEventId :: Lens' LambdaFunctionFailedEventAttributes Integer
lffeaScheduledEventId = lens _lffeaScheduledEventId (\ s a -> s{_lffeaScheduledEventId = a})

-- | The ID of the @LambdaFunctionStarted@ event recorded when this activity task started. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
lffeaStartedEventId :: Lens' LambdaFunctionFailedEventAttributes Integer
lffeaStartedEventId = lens _lffeaStartedEventId (\ s a -> s{_lffeaStartedEventId = a})

instance FromJSON LambdaFunctionFailedEventAttributes
         where
        parseJSON
          = withObject "LambdaFunctionFailedEventAttributes"
              (\ x ->
                 LambdaFunctionFailedEventAttributes' <$>
                   (x .:? "reason") <*> (x .:? "details") <*>
                     (x .: "scheduledEventId")
                     <*> (x .: "startedEventId"))

instance Hashable LambdaFunctionFailedEventAttributes
         where

instance NFData LambdaFunctionFailedEventAttributes
         where

-- | Provides the details of the @LambdaFunctionScheduled@ event. It isn't set for other event types.
--
--
--
-- /See:/ 'lambdaFunctionScheduledEventAttributes' smart constructor.
data LambdaFunctionScheduledEventAttributes = LambdaFunctionScheduledEventAttributes'
  { _lfseaControl                      :: !(Maybe Text)
  , _lfseaInput                        :: !(Maybe Text)
  , _lfseaStartToCloseTimeout          :: !(Maybe Text)
  , _lfseaId                           :: !Text
  , _lfseaName                         :: !Text
  , _lfseaDecisionTaskCompletedEventId :: !Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'LambdaFunctionScheduledEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lfseaControl' - Data attached to the event that the decider can use in subsequent workflow tasks. This data isn't sent to the Lambda task.
--
-- * 'lfseaInput' - The input provided to the Lambda task.
--
-- * 'lfseaStartToCloseTimeout' - The maximum amount of time a worker can take to process the Lambda task.
--
-- * 'lfseaId' - The unique ID of the Lambda task.
--
-- * 'lfseaName' - The name of the Lambda function.
--
-- * 'lfseaDecisionTaskCompletedEventId' - The ID of the @LambdaFunctionCompleted@ event corresponding to the decision that resulted in scheduling this activity task. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
lambdaFunctionScheduledEventAttributes
    :: Text -- ^ 'lfseaId'
    -> Text -- ^ 'lfseaName'
    -> Integer -- ^ 'lfseaDecisionTaskCompletedEventId'
    -> LambdaFunctionScheduledEventAttributes
lambdaFunctionScheduledEventAttributes pId_ pName_ pDecisionTaskCompletedEventId_ =
  LambdaFunctionScheduledEventAttributes'
    { _lfseaControl = Nothing
    , _lfseaInput = Nothing
    , _lfseaStartToCloseTimeout = Nothing
    , _lfseaId = pId_
    , _lfseaName = pName_
    , _lfseaDecisionTaskCompletedEventId = pDecisionTaskCompletedEventId_
    }


-- | Data attached to the event that the decider can use in subsequent workflow tasks. This data isn't sent to the Lambda task.
lfseaControl :: Lens' LambdaFunctionScheduledEventAttributes (Maybe Text)
lfseaControl = lens _lfseaControl (\ s a -> s{_lfseaControl = a})

-- | The input provided to the Lambda task.
lfseaInput :: Lens' LambdaFunctionScheduledEventAttributes (Maybe Text)
lfseaInput = lens _lfseaInput (\ s a -> s{_lfseaInput = a})

-- | The maximum amount of time a worker can take to process the Lambda task.
lfseaStartToCloseTimeout :: Lens' LambdaFunctionScheduledEventAttributes (Maybe Text)
lfseaStartToCloseTimeout = lens _lfseaStartToCloseTimeout (\ s a -> s{_lfseaStartToCloseTimeout = a})

-- | The unique ID of the Lambda task.
lfseaId :: Lens' LambdaFunctionScheduledEventAttributes Text
lfseaId = lens _lfseaId (\ s a -> s{_lfseaId = a})

-- | The name of the Lambda function.
lfseaName :: Lens' LambdaFunctionScheduledEventAttributes Text
lfseaName = lens _lfseaName (\ s a -> s{_lfseaName = a})

-- | The ID of the @LambdaFunctionCompleted@ event corresponding to the decision that resulted in scheduling this activity task. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
lfseaDecisionTaskCompletedEventId :: Lens' LambdaFunctionScheduledEventAttributes Integer
lfseaDecisionTaskCompletedEventId = lens _lfseaDecisionTaskCompletedEventId (\ s a -> s{_lfseaDecisionTaskCompletedEventId = a})

instance FromJSON
           LambdaFunctionScheduledEventAttributes
         where
        parseJSON
          = withObject "LambdaFunctionScheduledEventAttributes"
              (\ x ->
                 LambdaFunctionScheduledEventAttributes' <$>
                   (x .:? "control") <*> (x .:? "input") <*>
                     (x .:? "startToCloseTimeout")
                     <*> (x .: "id")
                     <*> (x .: "name")
                     <*> (x .: "decisionTaskCompletedEventId"))

instance Hashable
           LambdaFunctionScheduledEventAttributes
         where

instance NFData
           LambdaFunctionScheduledEventAttributes
         where

-- | Provides the details of the @LambdaFunctionStarted@ event. It isn't set for other event types.
--
--
--
-- /See:/ 'lambdaFunctionStartedEventAttributes' smart constructor.
newtype LambdaFunctionStartedEventAttributes = LambdaFunctionStartedEventAttributes'
  { _lfseaScheduledEventId :: Integer
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'LambdaFunctionStartedEventAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lfseaScheduledEventId' - The ID of the @LambdaFunctionScheduled@ event that was recorded when this activity task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
lambdaFunctionStartedEventAttributes
    :: Integer -- ^ 'lfseaScheduledEventId'
    -> LambdaFunctionStartedEventAttributes
lambdaFunctionStartedEventAttributes pScheduledEventId_ =
  LambdaFunctionStartedEventAttributes'
    {_lfseaScheduledEventId = pScheduledEventId_}


-- | The ID of the @LambdaFunctionScheduled@ event that was recorded when this activity task was scheduled. To help diagnose issues, use this information to trace back the chain of events leading up to this event.
lfseaScheduledEventId :: Lens' LambdaFunctionStartedEventAttributes Integer
lfseaScheduledEventId = lens _lfseaScheduledEventId (\ s a -> s{_lfseaScheduledEventId = a})

instance FromJSON
           LambdaFunctionStartedEventAttributes
         where
        parseJSON
          = withObject "LambdaFunctionStartedEventAttributes"