/**
 * Lifecycle State Pattern Implementation
 *
 * This module implements the State pattern for resource lifecycle management.
 * Each state defines valid transitions and state-specific behavior.
 *
 * @module declarative-api/lifecycle-state
 */
import type { ILifecycleState, IResourceEntity } from '../../../lib/runtime-web/types/declarative-api';
import { LifecycleStateType } from '../../../lib/runtime-web/types/declarative-api';
/**
 * Extended lifecycle state interface with transition and recovery methods.
 *
 * This interface extends the base ILifecycleState with methods for
 * executing transitions and handling failure recovery.
 *
 * Validates: Requirements 7.1, 7.2, 7.3, 7.4
 */
export interface ILifecycleStateExtended extends ILifecycleState {
    /**
     * Execute transition to a new state.
     *
     * @param entity - The resource entity transitioning
     * @param targetState - The target state type
     * @returns The new lifecycle state instance
     * @throws InvalidStateTransitionError if transition is not valid
     */
    transitionTo(entity: IResourceEntity, targetState: LifecycleStateType): ILifecycleStateExtended;
}
/**
 * Interface for states that support retry operations.
 *
 * Only the FailedState implements this interface.
 */
export interface IRetryableState extends ILifecycleStateExtended {
    /**
     * Retry the failed operation by transitioning back to pending.
     *
     * @param entity - The resource entity to retry
     * @returns The new PendingState
     */
    retry(entity: IResourceEntity): ILifecycleStateExtended;
}
/**
 * Interface for states that support rollback operations.
 *
 * Only the FailedState implements this interface.
 */
export interface IRollbackableState extends ILifecycleStateExtended {
    /**
     * Rollback by transitioning to deleted state.
     *
     * @param entity - The resource entity to rollback
     * @returns The new DeletedState
     */
    rollback(entity: IResourceEntity): ILifecycleStateExtended;
}
/**
 * State transition event data.
 *
 * Published when a resource transitions between states.
 */
export interface StateTransitionEvent {
    /** The resource entity that transitioned */
    readonly entity: IResourceEntity;
    /** The previous state */
    readonly previousState: LifecycleStateType;
    /** The new state */
    readonly newState: LifecycleStateType;
    /** Timestamp of the transition */
    readonly timestamp: Date;
}
/**
 * State transition log entry.
 *
 * Used for debugging and audit purposes.
 */
export interface StateTransitionLog {
    /** The resource ID */
    readonly resourceId: string;
    /** The previous state */
    readonly fromState: LifecycleStateType;
    /** The new state */
    readonly toState: LifecycleStateType;
    /** Timestamp of the transition */
    readonly timestamp: Date;
    /** Whether the transition was successful */
    readonly success: boolean;
    /** Error message if transition failed */
    readonly error?: string;
}
/**
 * Error thrown when an invalid state transition is attempted.
 *
 * Validates: Requirements 7.3
 */
export declare class InvalidStateTransitionError extends Error {
    readonly currentState: LifecycleStateType;
    readonly targetState: LifecycleStateType;
    readonly validTransitions: readonly LifecycleStateType[];
    readonly code = "INVALID_STATE_TRANSITION";
    constructor(currentState: LifecycleStateType, targetState: LifecycleStateType, validTransitions: readonly LifecycleStateType[]);
}
