from collections.abc import Iterable
from datetime import datetime
from enum import Enum
from typing import IO, Optional, TypedDict

from ..exceptions import AWSError as ServiceException

AliasDescription = str
Arn = str
CharacterRestrictedName = str
ClientToken = str
ConnectorParameters = str
Definition = str
Enabled = bool
ErrorMessage = str
EvaluationFailureLocation = str
HTTPBody = str
HTTPHeaders = str
HTTPMethod = str
HTTPProtocol = str
HTTPStatusCode = str
HTTPStatusMessage = str
Identity = str
IncludeExecutionData = bool
IncludeExecutionDataGetExecutionHistory = bool
KmsDataKeyReusePeriodSeconds = int
KmsKeyId = str
ListExecutionsPageToken = str
LongArn = str
MapRunLabel = str
MaxConcurrency = int
Name = str
PageSize = int
PageToken = str
Publish = bool
RedriveCount = int
RevealSecrets = bool
ReverseOrder = bool
RevisionId = str
SensitiveCause = str
SensitiveData = str
SensitiveDataJobInput = str
SensitiveError = str
StateName = str
TagKey = str
TagValue = str
TaskToken = str
ToleratedFailurePercentage = float
TraceHeader = str
URL = str
UnsignedInteger = int
ValidateStateMachineDefinitionCode = str
ValidateStateMachineDefinitionLocation = str
ValidateStateMachineDefinitionMaxResult = int
ValidateStateMachineDefinitionMessage = str
ValidateStateMachineDefinitionTruncated = bool
VariableName = str
VariableValue = str
VersionDescription = str
VersionWeight = int
includedDetails = bool
truncated = bool


class EncryptionType(str, Enum):
    AWS_OWNED_KEY = "AWS_OWNED_KEY"
    CUSTOMER_MANAGED_KMS_KEY = "CUSTOMER_MANAGED_KMS_KEY"


class ExecutionRedriveFilter(str, Enum):
    REDRIVEN = "REDRIVEN"
    NOT_REDRIVEN = "NOT_REDRIVEN"


class ExecutionRedriveStatus(str, Enum):
    REDRIVABLE = "REDRIVABLE"
    NOT_REDRIVABLE = "NOT_REDRIVABLE"
    REDRIVABLE_BY_MAP_RUN = "REDRIVABLE_BY_MAP_RUN"


class ExecutionStatus(str, Enum):
    RUNNING = "RUNNING"
    SUCCEEDED = "SUCCEEDED"
    FAILED = "FAILED"
    TIMED_OUT = "TIMED_OUT"
    ABORTED = "ABORTED"
    PENDING_REDRIVE = "PENDING_REDRIVE"


class HistoryEventType(str, Enum):
    ActivityFailed = "ActivityFailed"
    ActivityScheduled = "ActivityScheduled"
    ActivityScheduleFailed = "ActivityScheduleFailed"
    ActivityStarted = "ActivityStarted"
    ActivitySucceeded = "ActivitySucceeded"
    ActivityTimedOut = "ActivityTimedOut"
    ChoiceStateEntered = "ChoiceStateEntered"
    ChoiceStateExited = "ChoiceStateExited"
    ExecutionAborted = "ExecutionAborted"
    ExecutionFailed = "ExecutionFailed"
    ExecutionStarted = "ExecutionStarted"
    ExecutionSucceeded = "ExecutionSucceeded"
    ExecutionTimedOut = "ExecutionTimedOut"
    FailStateEntered = "FailStateEntered"
    LambdaFunctionFailed = "LambdaFunctionFailed"
    LambdaFunctionScheduled = "LambdaFunctionScheduled"
    LambdaFunctionScheduleFailed = "LambdaFunctionScheduleFailed"
    LambdaFunctionStarted = "LambdaFunctionStarted"
    LambdaFunctionStartFailed = "LambdaFunctionStartFailed"
    LambdaFunctionSucceeded = "LambdaFunctionSucceeded"
    LambdaFunctionTimedOut = "LambdaFunctionTimedOut"
    MapIterationAborted = "MapIterationAborted"
    MapIterationFailed = "MapIterationFailed"
    MapIterationStarted = "MapIterationStarted"
    MapIterationSucceeded = "MapIterationSucceeded"
    MapStateAborted = "MapStateAborted"
    MapStateEntered = "MapStateEntered"
    MapStateExited = "MapStateExited"
    MapStateFailed = "MapStateFailed"
    MapStateStarted = "MapStateStarted"
    MapStateSucceeded = "MapStateSucceeded"
    ParallelStateAborted = "ParallelStateAborted"
    ParallelStateEntered = "ParallelStateEntered"
    ParallelStateExited = "ParallelStateExited"
    ParallelStateFailed = "ParallelStateFailed"
    ParallelStateStarted = "ParallelStateStarted"
    ParallelStateSucceeded = "ParallelStateSucceeded"
    PassStateEntered = "PassStateEntered"
    PassStateExited = "PassStateExited"
    SucceedStateEntered = "SucceedStateEntered"
    SucceedStateExited = "SucceedStateExited"
    TaskFailed = "TaskFailed"
    TaskScheduled = "TaskScheduled"
    TaskStarted = "TaskStarted"
    TaskStartFailed = "TaskStartFailed"
    TaskStateAborted = "TaskStateAborted"
    TaskStateEntered = "TaskStateEntered"
    TaskStateExited = "TaskStateExited"
    TaskSubmitFailed = "TaskSubmitFailed"
    TaskSubmitted = "TaskSubmitted"
    TaskSucceeded = "TaskSucceeded"
    TaskTimedOut = "TaskTimedOut"
    WaitStateAborted = "WaitStateAborted"
    WaitStateEntered = "WaitStateEntered"
    WaitStateExited = "WaitStateExited"
    MapRunAborted = "MapRunAborted"
    MapRunFailed = "MapRunFailed"
    MapRunStarted = "MapRunStarted"
    MapRunSucceeded = "MapRunSucceeded"
    ExecutionRedriven = "ExecutionRedriven"
    MapRunRedriven = "MapRunRedriven"
    EvaluationFailed = "EvaluationFailed"


class IncludedData(str, Enum):
    ALL_DATA = "ALL_DATA"
    METADATA_ONLY = "METADATA_ONLY"


class InspectionLevel(str, Enum):
    INFO = "INFO"
    DEBUG = "DEBUG"
    TRACE = "TRACE"


class KmsKeyState(str, Enum):
    DISABLED = "DISABLED"
    PENDING_DELETION = "PENDING_DELETION"
    PENDING_IMPORT = "PENDING_IMPORT"
    UNAVAILABLE = "UNAVAILABLE"
    CREATING = "CREATING"


class LogLevel(str, Enum):
    ALL = "ALL"
    ERROR = "ERROR"
    FATAL = "FATAL"
    OFF = "OFF"


class MapRunStatus(str, Enum):
    RUNNING = "RUNNING"
    SUCCEEDED = "SUCCEEDED"
    FAILED = "FAILED"
    ABORTED = "ABORTED"


class StateMachineStatus(str, Enum):
    ACTIVE = "ACTIVE"
    DELETING = "DELETING"


class StateMachineType(str, Enum):
    STANDARD = "STANDARD"
    EXPRESS = "EXPRESS"


class SyncExecutionStatus(str, Enum):
    SUCCEEDED = "SUCCEEDED"
    FAILED = "FAILED"
    TIMED_OUT = "TIMED_OUT"


class TestExecutionStatus(str, Enum):
    SUCCEEDED = "SUCCEEDED"
    FAILED = "FAILED"
    RETRIABLE = "RETRIABLE"
    CAUGHT_ERROR = "CAUGHT_ERROR"


class ValidateStateMachineDefinitionResultCode(str, Enum):
    OK = "OK"
    FAIL = "FAIL"


class ValidateStateMachineDefinitionSeverity(str, Enum):
    ERROR = "ERROR"
    WARNING = "WARNING"


class ValidationExceptionReason(str, Enum):
    API_DOES_NOT_SUPPORT_LABELED_ARNS = "API_DOES_NOT_SUPPORT_LABELED_ARNS"
    MISSING_REQUIRED_PARAMETER = "MISSING_REQUIRED_PARAMETER"
    CANNOT_UPDATE_COMPLETED_MAP_RUN = "CANNOT_UPDATE_COMPLETED_MAP_RUN"
    INVALID_ROUTING_CONFIGURATION = "INVALID_ROUTING_CONFIGURATION"


class ActivityAlreadyExists(ServiceException):
    code: str = "ActivityAlreadyExists"
    sender_fault: bool = False
    status_code: int = 400


class ActivityDoesNotExist(ServiceException):
    code: str = "ActivityDoesNotExist"
    sender_fault: bool = False
    status_code: int = 400


class ActivityLimitExceeded(ServiceException):
    code: str = "ActivityLimitExceeded"
    sender_fault: bool = False
    status_code: int = 400


class ActivityWorkerLimitExceeded(ServiceException):
    code: str = "ActivityWorkerLimitExceeded"
    sender_fault: bool = False
    status_code: int = 400


class ConflictException(ServiceException):
    code: str = "ConflictException"
    sender_fault: bool = False
    status_code: int = 400


class ExecutionAlreadyExists(ServiceException):
    code: str = "ExecutionAlreadyExists"
    sender_fault: bool = False
    status_code: int = 400


class ExecutionDoesNotExist(ServiceException):
    code: str = "ExecutionDoesNotExist"
    sender_fault: bool = False
    status_code: int = 400


class ExecutionLimitExceeded(ServiceException):
    code: str = "ExecutionLimitExceeded"
    sender_fault: bool = False
    status_code: int = 400


class ExecutionNotRedrivable(ServiceException):
    code: str = "ExecutionNotRedrivable"
    sender_fault: bool = False
    status_code: int = 400


class InvalidArn(ServiceException):
    code: str = "InvalidArn"
    sender_fault: bool = False
    status_code: int = 400


class InvalidDefinition(ServiceException):
    code: str = "InvalidDefinition"
    sender_fault: bool = False
    status_code: int = 400


class InvalidEncryptionConfiguration(ServiceException):
    code: str = "InvalidEncryptionConfiguration"
    sender_fault: bool = False
    status_code: int = 400


class InvalidExecutionInput(ServiceException):
    code: str = "InvalidExecutionInput"
    sender_fault: bool = False
    status_code: int = 400


class InvalidLoggingConfiguration(ServiceException):
    code: str = "InvalidLoggingConfiguration"
    sender_fault: bool = False
    status_code: int = 400


class InvalidName(ServiceException):
    code: str = "InvalidName"
    sender_fault: bool = False
    status_code: int = 400


class InvalidOutput(ServiceException):
    code: str = "InvalidOutput"
    sender_fault: bool = False
    status_code: int = 400


class InvalidToken(ServiceException):
    code: str = "InvalidToken"
    exception_type: str = "InvalidToken"
    sender_fault: bool = False
    status_code: int = 400
    message: str = "Invalid Token: 'Invalid token'"

    def __init__(self):
        super().__init__(self.message, self.exception_type, self.status_code)


class InvalidTracingConfiguration(ServiceException):
    code: str = "InvalidTracingConfiguration"
    sender_fault: bool = False
    status_code: int = 400


class KmsAccessDeniedException(ServiceException):
    code: str = "KmsAccessDeniedException"
    sender_fault: bool = False
    status_code: int = 400


class KmsInvalidStateException(ServiceException):
    code: str = "KmsInvalidStateException"
    sender_fault: bool = False
    status_code: int = 400
    kmsKeyState: KmsKeyState | None


class KmsThrottlingException(ServiceException):
    code: str = "KmsThrottlingException"
    sender_fault: bool = False
    status_code: int = 400


class MissingRequiredParameter(ServiceException):
    code: str = "MissingRequiredParameter"
    sender_fault: bool = False
    status_code: int = 400


class ResourceNotFound(ServiceException):
    code: str = "ResourceNotFound"
    sender_fault: bool = False
    status_code: int = 400
    resourceName: Arn | None


class ServiceQuotaExceededException(ServiceException):
    code: str = "ServiceQuotaExceededException"
    sender_fault: bool = False
    status_code: int = 400


class StateMachineAlreadyExists(ServiceException):
    code: str = "StateMachineAlreadyExists"
    sender_fault: bool = False
    status_code: int = 400


class StateMachineDeleting(ServiceException):
    code: str = "StateMachineDeleting"
    sender_fault: bool = False
    status_code: int = 400


class StateMachineDoesNotExist(ServiceException):
    code: str = "StateMachineDoesNotExist"
    sender_fault: bool = False
    status_code: int = 400


class StateMachineLimitExceeded(ServiceException):
    code: str = "StateMachineLimitExceeded"
    sender_fault: bool = False
    status_code: int = 400


class StateMachineTypeNotSupported(ServiceException):
    code: str = "StateMachineTypeNotSupported"
    sender_fault: bool = False
    status_code: int = 400


class TaskDoesNotExist(ServiceException):
    code: str = "TaskDoesNotExist"
    sender_fault: bool = False
    status_code: int = 400


class TaskTimedOut(ServiceException):
    code: str = "TaskTimedOut"
    sender_fault: bool = False
    status_code: int = 400


class TooManyTags(ServiceException):
    code: str = "TooManyTags"
    sender_fault: bool = False
    status_code: int = 400
    resourceName: Arn | None


class ValidationException(ServiceException):
    code: str = "ValidationException"
    sender_fault: bool = False
    status_code: int = 400
    reason: ValidationExceptionReason | None


class ActivityFailedEventDetails(TypedDict, total=False):
    error: SensitiveError | None
    cause: SensitiveCause | None


Timestamp = datetime


class ActivityListItem(TypedDict, total=False):
    activityArn: Arn
    name: Name
    creationDate: Timestamp


ActivityList = list[ActivityListItem]


class ActivityScheduleFailedEventDetails(TypedDict, total=False):
    error: SensitiveError | None
    cause: SensitiveCause | None


TimeoutInSeconds = int


class HistoryEventExecutionDataDetails(TypedDict, total=False):
    truncated: truncated | None


class ActivityScheduledEventDetails(TypedDict, total=False):
    resource: Arn
    input: SensitiveData | None
    inputDetails: HistoryEventExecutionDataDetails | None
    timeoutInSeconds: TimeoutInSeconds | None
    heartbeatInSeconds: TimeoutInSeconds | None


class ActivityStartedEventDetails(TypedDict, total=False):
    workerName: Identity | None


class ActivitySucceededEventDetails(TypedDict, total=False):
    output: SensitiveData | None
    outputDetails: HistoryEventExecutionDataDetails | None


class ActivityTimedOutEventDetails(TypedDict, total=False):
    error: SensitiveError | None
    cause: SensitiveCause | None


AssignedVariables = dict[VariableName, VariableValue]


class AssignedVariablesDetails(TypedDict, total=False):
    truncated: truncated | None


BilledDuration = int
BilledMemoryUsed = int


class BillingDetails(TypedDict, total=False):
    billedMemoryUsedInMB: BilledMemoryUsed | None
    billedDurationInMilliseconds: BilledDuration | None


class CloudWatchEventsExecutionDataDetails(TypedDict, total=False):
    included: includedDetails | None


class CloudWatchLogsLogGroup(TypedDict, total=False):
    logGroupArn: Arn | None


class EncryptionConfiguration(TypedDict, total=False):
    kmsKeyId: KmsKeyId | None
    kmsDataKeyReusePeriodSeconds: KmsDataKeyReusePeriodSeconds | None
    type: EncryptionType


class Tag(TypedDict, total=False):
    key: TagKey | None
    value: TagValue | None


TagList = list[Tag]


class CreateActivityOutput(TypedDict, total=False):
    activityArn: Arn
    creationDate: Timestamp


class RoutingConfigurationListItem(TypedDict, total=False):
    stateMachineVersionArn: Arn
    weight: VersionWeight


RoutingConfigurationList = list[RoutingConfigurationListItem]


class CreateStateMachineAliasOutput(TypedDict, total=False):
    stateMachineAliasArn: Arn
    creationDate: Timestamp


class TracingConfiguration(TypedDict, total=False):
    enabled: Enabled | None


class LogDestination(TypedDict, total=False):
    cloudWatchLogsLogGroup: CloudWatchLogsLogGroup | None


LogDestinationList = list[LogDestination]


class LoggingConfiguration(TypedDict, total=False):
    level: LogLevel | None
    includeExecutionData: IncludeExecutionData | None
    destinations: LogDestinationList | None


class CreateStateMachineInput(TypedDict, total=False):
    name: Name
    definition: Definition
    roleArn: Arn
    type: StateMachineType | None
    loggingConfiguration: LoggingConfiguration | None
    tags: TagList | None
    tracingConfiguration: TracingConfiguration | None
    publish: Publish | None
    versionDescription: VersionDescription | None
    encryptionConfiguration: EncryptionConfiguration | None


class CreateStateMachineOutput(TypedDict, total=False):
    stateMachineArn: Arn
    creationDate: Timestamp
    stateMachineVersionArn: Arn | None


class DeleteActivityOutput(TypedDict, total=False):
    pass


class DeleteStateMachineAliasOutput(TypedDict, total=False):
    pass


class DeleteStateMachineOutput(TypedDict, total=False):
    pass


class DeleteStateMachineVersionOutput(TypedDict, total=False):
    pass


class DescribeActivityOutput(TypedDict, total=False):
    activityArn: Arn
    name: Name
    creationDate: Timestamp
    encryptionConfiguration: EncryptionConfiguration | None


class DescribeExecutionOutput(TypedDict, total=False):
    executionArn: Arn
    stateMachineArn: Arn
    name: Name | None
    status: ExecutionStatus
    startDate: Timestamp
    stopDate: Timestamp | None
    input: SensitiveData | None
    inputDetails: CloudWatchEventsExecutionDataDetails | None
    output: SensitiveData | None
    outputDetails: CloudWatchEventsExecutionDataDetails | None
    traceHeader: TraceHeader | None
    mapRunArn: LongArn | None
    error: SensitiveError | None
    cause: SensitiveCause | None
    stateMachineVersionArn: Arn | None
    stateMachineAliasArn: Arn | None
    redriveCount: RedriveCount | None
    redriveDate: Timestamp | None
    redriveStatus: ExecutionRedriveStatus | None
    redriveStatusReason: SensitiveData | None


LongObject = int
UnsignedLong = int


class MapRunExecutionCounts(TypedDict, total=False):
    pending: UnsignedLong
    running: UnsignedLong
    succeeded: UnsignedLong
    failed: UnsignedLong
    timedOut: UnsignedLong
    aborted: UnsignedLong
    total: UnsignedLong
    resultsWritten: UnsignedLong
    failuresNotRedrivable: LongObject | None
    pendingRedrive: LongObject | None


class MapRunItemCounts(TypedDict, total=False):
    pending: UnsignedLong
    running: UnsignedLong
    succeeded: UnsignedLong
    failed: UnsignedLong
    timedOut: UnsignedLong
    aborted: UnsignedLong
    total: UnsignedLong
    resultsWritten: UnsignedLong
    failuresNotRedrivable: LongObject | None
    pendingRedrive: LongObject | None


ToleratedFailureCount = int


class DescribeMapRunOutput(TypedDict, total=False):
    mapRunArn: LongArn
    executionArn: Arn
    status: MapRunStatus
    startDate: Timestamp
    stopDate: Timestamp | None
    maxConcurrency: MaxConcurrency
    toleratedFailurePercentage: ToleratedFailurePercentage
    toleratedFailureCount: ToleratedFailureCount
    itemCounts: MapRunItemCounts
    executionCounts: MapRunExecutionCounts
    redriveCount: RedriveCount | None
    redriveDate: Timestamp | None


class DescribeStateMachineAliasOutput(TypedDict, total=False):
    stateMachineAliasArn: Arn | None
    name: Name | None
    description: AliasDescription | None
    routingConfiguration: RoutingConfigurationList | None
    creationDate: Timestamp | None
    updateDate: Timestamp | None


VariableNameList = list[VariableName]
VariableReferences = dict[StateName, VariableNameList]


class DescribeStateMachineForExecutionOutput(TypedDict, total=False):
    stateMachineArn: Arn
    name: Name
    definition: Definition
    roleArn: Arn
    updateDate: Timestamp
    loggingConfiguration: LoggingConfiguration | None
    tracingConfiguration: TracingConfiguration | None
    mapRunArn: LongArn | None
    label: MapRunLabel | None
    revisionId: RevisionId | None
    encryptionConfiguration: EncryptionConfiguration | None
    variableReferences: VariableReferences | None


class DescribeStateMachineOutput(TypedDict, total=False):
    stateMachineArn: Arn
    name: Name
    status: StateMachineStatus | None
    definition: Definition
    roleArn: Arn
    type: StateMachineType
    creationDate: Timestamp
    loggingConfiguration: LoggingConfiguration | None
    tracingConfiguration: TracingConfiguration | None
    label: MapRunLabel | None
    revisionId: RevisionId | None
    description: VersionDescription | None
    encryptionConfiguration: EncryptionConfiguration | None
    variableReferences: VariableReferences | None


class EvaluationFailedEventDetails(TypedDict, total=False):
    error: SensitiveError | None
    cause: SensitiveCause | None
    location: EvaluationFailureLocation | None
    state: StateName


EventId = int


class ExecutionAbortedEventDetails(TypedDict, total=False):
    error: SensitiveError | None
    cause: SensitiveCause | None


class ExecutionFailedEventDetails(TypedDict, total=False):
    error: SensitiveError | None
    cause: SensitiveCause | None


class ExecutionListItem(TypedDict, total=False):
    executionArn: Arn
    stateMachineArn: Arn
    name: Name
    status: ExecutionStatus
    startDate: Timestamp
    stopDate: Timestamp | None
    mapRunArn: LongArn | None
    itemCount: UnsignedInteger | None
    stateMachineVersionArn: Arn | None
    stateMachineAliasArn: Arn | None
    redriveCount: RedriveCount | None
    redriveDate: Timestamp | None


ExecutionList = list[ExecutionListItem]


class ExecutionRedrivenEventDetails(TypedDict, total=False):
    redriveCount: RedriveCount | None


class ExecutionStartedEventDetails(TypedDict, total=False):
    input: SensitiveData | None
    inputDetails: HistoryEventExecutionDataDetails | None
    roleArn: Arn | None
    stateMachineAliasArn: Arn | None
    stateMachineVersionArn: Arn | None


class ExecutionSucceededEventDetails(TypedDict, total=False):
    output: SensitiveData | None
    outputDetails: HistoryEventExecutionDataDetails | None


class ExecutionTimedOutEventDetails(TypedDict, total=False):
    error: SensitiveError | None
    cause: SensitiveCause | None


class GetActivityTaskOutput(TypedDict, total=False):
    taskToken: TaskToken | None
    input: SensitiveDataJobInput | None


class MapRunRedrivenEventDetails(TypedDict, total=False):
    mapRunArn: LongArn | None
    redriveCount: RedriveCount | None


class MapRunFailedEventDetails(TypedDict, total=False):
    error: SensitiveError | None
    cause: SensitiveCause | None


class MapRunStartedEventDetails(TypedDict, total=False):
    mapRunArn: LongArn | None


class StateExitedEventDetails(TypedDict, total=False):
    name: Name
    output: SensitiveData | None
    outputDetails: HistoryEventExecutionDataDetails | None
    assignedVariables: AssignedVariables | None
    assignedVariablesDetails: AssignedVariablesDetails | None


class StateEnteredEventDetails(TypedDict, total=False):
    name: Name
    input: SensitiveData | None
    inputDetails: HistoryEventExecutionDataDetails | None


class LambdaFunctionTimedOutEventDetails(TypedDict, total=False):
    error: SensitiveError | None
    cause: SensitiveCause | None


class LambdaFunctionSucceededEventDetails(TypedDict, total=False):
    output: SensitiveData | None
    outputDetails: HistoryEventExecutionDataDetails | None


class LambdaFunctionStartFailedEventDetails(TypedDict, total=False):
    error: SensitiveError | None
    cause: SensitiveCause | None


class TaskCredentials(TypedDict, total=False):
    roleArn: LongArn | None


class LambdaFunctionScheduledEventDetails(TypedDict, total=False):
    resource: Arn
    input: SensitiveData | None
    inputDetails: HistoryEventExecutionDataDetails | None
    timeoutInSeconds: TimeoutInSeconds | None
    taskCredentials: TaskCredentials | None


class LambdaFunctionScheduleFailedEventDetails(TypedDict, total=False):
    error: SensitiveError | None
    cause: SensitiveCause | None


class LambdaFunctionFailedEventDetails(TypedDict, total=False):
    error: SensitiveError | None
    cause: SensitiveCause | None


class MapIterationEventDetails(TypedDict, total=False):
    name: Name | None
    index: UnsignedInteger | None


class MapStateStartedEventDetails(TypedDict, total=False):
    length: UnsignedInteger | None


class TaskTimedOutEventDetails(TypedDict, total=False):
    resourceType: Name
    resource: Name
    error: SensitiveError | None
    cause: SensitiveCause | None


class TaskSucceededEventDetails(TypedDict, total=False):
    resourceType: Name
    resource: Name
    output: SensitiveData | None
    outputDetails: HistoryEventExecutionDataDetails | None


class TaskSubmittedEventDetails(TypedDict, total=False):
    resourceType: Name
    resource: Name
    output: SensitiveData | None
    outputDetails: HistoryEventExecutionDataDetails | None


class TaskSubmitFailedEventDetails(TypedDict, total=False):
    resourceType: Name
    resource: Name
    error: SensitiveError | None
    cause: SensitiveCause | None


class TaskStartedEventDetails(TypedDict, total=False):
    resourceType: Name
    resource: Name


class TaskStartFailedEventDetails(TypedDict, total=False):
    resourceType: Name
    resource: Name
    error: SensitiveError | None
    cause: SensitiveCause | None


class TaskScheduledEventDetails(TypedDict, total=False):
    resourceType: Name
    resource: Name
    region: Name
    parameters: ConnectorParameters
    timeoutInSeconds: TimeoutInSeconds | None
    heartbeatInSeconds: TimeoutInSeconds | None
    taskCredentials: TaskCredentials | None


class TaskFailedEventDetails(TypedDict, total=False):
    resourceType: Name
    resource: Name
    error: SensitiveError | None
    cause: SensitiveCause | None


class HistoryEvent(TypedDict, total=False):
    timestamp: Timestamp
    type: HistoryEventType
    id: EventId
    previousEventId: EventId | None
    activityFailedEventDetails: ActivityFailedEventDetails | None
    activityScheduleFailedEventDetails: ActivityScheduleFailedEventDetails | None
    activityScheduledEventDetails: ActivityScheduledEventDetails | None
    activityStartedEventDetails: ActivityStartedEventDetails | None
    activitySucceededEventDetails: ActivitySucceededEventDetails | None
    activityTimedOutEventDetails: ActivityTimedOutEventDetails | None
    taskFailedEventDetails: TaskFailedEventDetails | None
    taskScheduledEventDetails: TaskScheduledEventDetails | None
    taskStartFailedEventDetails: TaskStartFailedEventDetails | None
    taskStartedEventDetails: TaskStartedEventDetails | None
    taskSubmitFailedEventDetails: TaskSubmitFailedEventDetails | None
    taskSubmittedEventDetails: TaskSubmittedEventDetails | None
    taskSucceededEventDetails: TaskSucceededEventDetails | None
    taskTimedOutEventDetails: TaskTimedOutEventDetails | None
    executionFailedEventDetails: ExecutionFailedEventDetails | None
    executionStartedEventDetails: ExecutionStartedEventDetails | None
    executionSucceededEventDetails: ExecutionSucceededEventDetails | None
    executionAbortedEventDetails: ExecutionAbortedEventDetails | None
    executionTimedOutEventDetails: ExecutionTimedOutEventDetails | None
    executionRedrivenEventDetails: ExecutionRedrivenEventDetails | None
    mapStateStartedEventDetails: MapStateStartedEventDetails | None
    mapIterationStartedEventDetails: MapIterationEventDetails | None
    mapIterationSucceededEventDetails: MapIterationEventDetails | None
    mapIterationFailedEventDetails: MapIterationEventDetails | None
    mapIterationAbortedEventDetails: MapIterationEventDetails | None
    lambdaFunctionFailedEventDetails: LambdaFunctionFailedEventDetails | None
    lambdaFunctionScheduleFailedEventDetails: Optional[
        LambdaFunctionScheduleFailedEventDetails
    ]
    lambdaFunctionScheduledEventDetails: LambdaFunctionScheduledEventDetails | None
    lambdaFunctionStartFailedEventDetails: Optional[
        LambdaFunctionStartFailedEventDetails
    ]
    lambdaFunctionSucceededEventDetails: LambdaFunctionSucceededEventDetails | None
    lambdaFunctionTimedOutEventDetails: LambdaFunctionTimedOutEventDetails | None
    stateEnteredEventDetails: StateEnteredEventDetails | None
    stateExitedEventDetails: StateExitedEventDetails | None
    mapRunStartedEventDetails: MapRunStartedEventDetails | None
    mapRunFailedEventDetails: MapRunFailedEventDetails | None
    mapRunRedrivenEventDetails: MapRunRedrivenEventDetails | None
    evaluationFailedEventDetails: EvaluationFailedEventDetails | None


HistoryEventList = list[HistoryEvent]


class GetExecutionHistoryOutput(TypedDict, total=False):
    events: HistoryEventList
    nextToken: PageToken | None


class InspectionDataResponse(TypedDict, total=False):
    protocol: HTTPProtocol | None
    statusCode: HTTPStatusCode | None
    statusMessage: HTTPStatusMessage | None
    headers: HTTPHeaders | None
    body: HTTPBody | None


class InspectionDataRequest(TypedDict, total=False):
    protocol: HTTPProtocol | None
    method: HTTPMethod | None
    url: URL | None
    headers: HTTPHeaders | None
    body: HTTPBody | None


class InspectionData(TypedDict, total=False):
    input: SensitiveData | None
    afterArguments: SensitiveData | None
    afterInputPath: SensitiveData | None
    afterParameters: SensitiveData | None
    result: SensitiveData | None
    afterResultSelector: SensitiveData | None
    afterResultPath: SensitiveData | None
    request: InspectionDataRequest | None
    response: InspectionDataResponse | None
    variables: SensitiveData | None


class MapRunListItem(TypedDict, total=False):
    executionArn: Arn
    mapRunArn: LongArn
    stateMachineArn: Arn
    startDate: Timestamp
    stopDate: Timestamp | None


MapRunList = list[MapRunListItem]


class ListMapRunsOutput(TypedDict, total=False):
    mapRuns: MapRunList
    nextToken: PageToken | None


class StateMachineAliasListItem(TypedDict, total=False):
    stateMachineAliasArn: LongArn
    creationDate: Timestamp


StateMachineAliasList = list[StateMachineAliasListItem]


class ListStateMachineAliasesOutput(TypedDict, total=False):
    stateMachineAliases: StateMachineAliasList
    nextToken: PageToken | None


class StateMachineVersionListItem(TypedDict, total=False):
    stateMachineVersionArn: LongArn
    creationDate: Timestamp


StateMachineVersionList = list[StateMachineVersionListItem]


class ListStateMachineVersionsOutput(TypedDict, total=False):
    stateMachineVersions: StateMachineVersionList
    nextToken: PageToken | None


class StateMachineListItem(TypedDict, total=False):
    stateMachineArn: Arn
    name: Name
    type: StateMachineType
    creationDate: Timestamp


StateMachineList = list[StateMachineListItem]


class ListStateMachinesOutput(TypedDict, total=False):
    stateMachines: StateMachineList
    nextToken: PageToken | None


class ListTagsForResourceOutput(TypedDict, total=False):
    tags: TagList | None


class PublishStateMachineVersionOutput(TypedDict, total=False):
    creationDate: Timestamp
    stateMachineVersionArn: Arn


class RedriveExecutionOutput(TypedDict, total=False):
    redriveDate: Timestamp


class SendTaskFailureOutput(TypedDict, total=False):
    pass


class SendTaskHeartbeatOutput(TypedDict, total=False):
    pass


class SendTaskSuccessOutput(TypedDict, total=False):
    pass


class StartExecutionOutput(TypedDict, total=False):
    executionArn: Arn
    startDate: Timestamp


class StartSyncExecutionOutput(TypedDict, total=False):
    executionArn: Arn
    stateMachineArn: Arn | None
    name: Name | None
    startDate: Timestamp
    stopDate: Timestamp
    status: SyncExecutionStatus
    error: SensitiveError | None
    cause: SensitiveCause | None
    input: SensitiveData | None
    inputDetails: CloudWatchEventsExecutionDataDetails | None
    output: SensitiveData | None
    outputDetails: CloudWatchEventsExecutionDataDetails | None
    traceHeader: TraceHeader | None
    billingDetails: BillingDetails | None


class StopExecutionOutput(TypedDict, total=False):
    stopDate: Timestamp


TagKeyList = list[TagKey]


class TagResourceOutput(TypedDict, total=False):
    pass


class TestStateOutput(TypedDict, total=False):
    output: SensitiveData | None
    error: SensitiveError | None
    cause: SensitiveCause | None
    inspectionData: InspectionData | None
    nextState: StateName | None
    status: TestExecutionStatus | None


class UntagResourceOutput(TypedDict, total=False):
    pass


class UpdateMapRunOutput(TypedDict, total=False):
    pass


class UpdateStateMachineAliasOutput(TypedDict, total=False):
    updateDate: Timestamp


class UpdateStateMachineOutput(TypedDict, total=False):
    updateDate: Timestamp
    revisionId: RevisionId | None
    stateMachineVersionArn: Arn | None


class ValidateStateMachineDefinitionDiagnostic(TypedDict, total=False):
    severity: ValidateStateMachineDefinitionSeverity
    code: ValidateStateMachineDefinitionCode
    message: ValidateStateMachineDefinitionMessage
    location: ValidateStateMachineDefinitionLocation | None


ValidateStateMachineDefinitionDiagnosticList = list[
    ValidateStateMachineDefinitionDiagnostic
]


class ValidateStateMachineDefinitionInput(TypedDict, total=False):
    definition: Definition
    type: StateMachineType | None
    severity: ValidateStateMachineDefinitionSeverity | None
    maxResults: ValidateStateMachineDefinitionMaxResult | None


class ValidateStateMachineDefinitionOutput(TypedDict, total=False):
    result: ValidateStateMachineDefinitionResultCode
    diagnostics: ValidateStateMachineDefinitionDiagnosticList
    truncated: ValidateStateMachineDefinitionTruncated | None


class InvocationResponse(TypedDict, total=False):
    Payload: bytes | IO[bytes] | Iterable[bytes] | None
    StatusCode: int | None
    FunctionError: str | None
    LogResult: str | None
    ExecutedVersion: str | None
