import { State, StateMachine } from 'xstate';
/**
 * Task Status State Machine Configuration
 * Defines all possible states and transitions for task statuses
 */
export interface TaskContext {
    taskId: string;
    currentStatus: string;
    previousStatus?: string;
    metadata?: Record<string, any>;
    timestamp?: string;
    userId?: string;
    reason?: string;
}
export type TaskEvent = {
    type: 'START';
    taskId: string;
    userId?: string;
} | {
    type: 'ASSIGN';
    assigneeId: string;
} | {
    type: 'COMPLETE';
    metadata?: Record<string, any>;
} | {
    type: 'REVIEW';
    reviewerId: string;
} | {
    type: 'APPROVE';
    approverId: string;
} | {
    type: 'REJECT';
    reason: string;
} | {
    type: 'BLOCK';
    reason: string;
} | {
    type: 'UNBLOCK';
} | {
    type: 'CANCEL';
    reason: string;
} | {
    type: 'REOPEN';
    reason?: string;
} | {
    type: 'DEFER';
    until?: string;
    reason?: string;
} | {
    type: 'ARCHIVE';
};
/**
 * Task Status State Machine
 * Manages all valid state transitions for tasks
 */
export declare const taskStatusMachine: StateMachine<TaskContext, any, TaskEvent, {
    value: any;
    context: TaskContext;
}, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, TaskEvent, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
/**
 * State Machine Service
 * Manages state machine instances and persistence
 */
export declare class StateMachineService {
    private machines;
    private client;
    constructor();
    private initializeClient;
    /**
     * Get or create a state machine instance for a task
     */
    getStateMachine(taskId: string): Promise<any>;
    /**
     * Map database status to state machine state
     */
    private mapStatusToState;
    /**
     * Validate if a transition is allowed
     */
    canTransition(taskId: string, event: TaskEvent): Promise<boolean>;
    /**
     * Execute a state transition
     */
    transition(taskId: string, event: TaskEvent): Promise<State<TaskContext>>;
    /**
     * Get current state for a task
     */
    getCurrentState(taskId: string): Promise<State<TaskContext>>;
    /**
     * Get available transitions from current state
     */
    getAvailableTransitions(taskId: string): Promise<string[]>;
    /**
     * Log state transition to audit log
     */
    private logTransition;
    /**
     * Update task status in database
     */
    private updateTaskStatus;
    /**
     * Map event type to database status
     */
    private mapEventToStatus;
    /**
     * Persist state machine state
     */
    persistState(taskId: string): Promise<void>;
    /**
     * Restore state machine from persisted state
     */
    restoreState(taskId: string, persistedState: any): Promise<void>;
    /**
     * Clean up machine instance
     */
    cleanup(taskId: string): Promise<void>;
}
export declare const stateMachineService: StateMachineService;
//# sourceMappingURL=stateMachine.d.ts.map