"""restate_saga — Saga pattern implementation for Restate durable workflows."""

__version__ = "0.1.0"

from restate_saga.error_registry import (
    clear_terminal_errors,
    get_global_error_mapper,
    register_terminal_errors,
    resolve_terminal_error,
    set_global_error_mapper,
    unregister_terminal_errors,
)
from restate_saga.nested import create_saga_module, run_nested_saga
from restate_saga.step_response import StepResponse
from restate_saga.steps import (
    create_saga_step,
    create_saga_step_strict,
    saga_step,
    saga_step_strict,
)
from restate_saga.types import (
    ErrorClass,
    ErrorMapper,
    SagaContext,
    SagaStepOptions,
    SagaWorkflowOptions,
    StepRetryPolicy,
    WorkflowRetryPolicy,
)
from restate_saga.restate_workflows import SagaRestateWorkflow, create_saga_restate_workflow
from restate_saga.virtual_objects import SagaVirtualObject, create_saga_virtual_object
from restate_saga.workflows import SagaWorkflowService, create_saga_workflow, saga_workflow

__all__ = [
    # Types
    "SagaContext",
    "StepRetryPolicy",
    "SagaStepOptions",
    "WorkflowRetryPolicy",
    "SagaWorkflowOptions",
    "ErrorMapper",
    "ErrorClass",
    # StepResponse
    "StepResponse",
    # Steps (function API)
    "create_saga_step",
    "create_saga_step_strict",
    # Steps (decorator API)
    "saga_step",
    "saga_step_strict",
    # Workflows
    "SagaWorkflowService",
    "create_saga_workflow",
    "saga_workflow",
    # Error registry
    "register_terminal_errors",
    "unregister_terminal_errors",
    "clear_terminal_errors",
    "set_global_error_mapper",
    "get_global_error_mapper",
    "resolve_terminal_error",
    # Restate workflows
    "SagaRestateWorkflow",
    "create_saga_restate_workflow",
    # Virtual objects
    "SagaVirtualObject",
    "create_saga_virtual_object",
    # Nested
    "run_nested_saga",
    "create_saga_module",
]
