/**
 * Concrete State Classes for Lifecycle State Pattern
 *
 * This module provides concrete implementations of lifecycle states:
 * PendingState, CreatingState, CreatedState, ModifyingState,
 * DeletingState, DeletedState, and FailedState.
 *
 * @module declarative-api/lifecycle-state
 */
import type { IResourceEntity } from '../../../lib/runtime-web/types/declarative-api';
import { LifecycleStateType } from '../../../lib/runtime-web/types/declarative-api';
import type { ILifecycleStateExtended, IRetryableState, IRollbackableState, StateTransitionLog } from './lifecycle-state';
/**
 * Callback type for state transition events.
 */
export type StateTransitionCallback = (log: StateTransitionLog) => void;
/**
 * Abstract base class for all lifecycle states.
 *
 * Provides common implementation for state transition validation
 * and logging. Subclasses define the specific state type.
 *
 * Validates: Requirements 7.1, 7.2
 */
export declare abstract class BaseLifecycleState implements ILifecycleStateExtended {
    /** Callback for logging state transitions */
    protected static transitionCallback: StateTransitionCallback | null;
    /**
     * Set a global callback for state transition logging.
     *
     * @param callback - The callback to invoke on transitions
     */
    static setTransitionCallback(callback: StateTransitionCallback | null): void;
    /**
     * Get the current state type.
     */
    abstract readonly stateType: LifecycleStateType;
    /**
     * Check if transition to target state is valid.
     *
     * Uses the STATE_TRANSITIONS matrix to determine validity.
     *
     * @param targetState - The state to transition to
     * @returns True if the transition is valid
     */
    canTransitionTo(targetState: LifecycleStateType): boolean;
    /**
     * Get all valid transitions from current state.
     *
     * @returns Array of valid target states
     */
    getValidTransitions(): readonly LifecycleStateType[];
    /**
     * Execute transition to a new state.
     *
     * Validates the transition and creates the appropriate state instance.
     * Logs the transition for debugging purposes.
     *
     * @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;
    /**
     * Log a state transition.
     *
     * @param resourceId - The resource ID
     * @param targetState - The target state
     * @param success - Whether the transition was successful
     * @param error - Error message if transition failed
     */
    protected logTransition(resourceId: string, targetState: LifecycleStateType, success: boolean, error?: string): void;
}
/**
 * Pending state - initial state for resources.
 *
 * Resources start in this state before creation begins.
 * Valid transitions: pending → creating
 *
 * Validates: Requirements 7.1, 7.2
 */
export declare class PendingState extends BaseLifecycleState {
    readonly stateType: LifecycleStateType;
}
/**
 * Creating state - resource is being created.
 *
 * Resources enter this state when creation begins.
 * Valid transitions: creating → created | failed
 *
 * Validates: Requirements 7.1, 7.2
 */
export declare class CreatingState extends BaseLifecycleState {
    readonly stateType: LifecycleStateType;
}
/**
 * Created state - resource has been successfully created.
 *
 * Resources enter this state after successful creation.
 * Valid transitions: created → modifying | deleting
 *
 * Validates: Requirements 7.1, 7.2
 */
export declare class CreatedState extends BaseLifecycleState {
    readonly stateType: LifecycleStateType;
}
/**
 * Modifying state - resource is being modified.
 *
 * Resources enter this state when modification begins.
 * Valid transitions: modifying → created | failed
 *
 * Validates: Requirements 7.1, 7.2
 */
export declare class ModifyingState extends BaseLifecycleState {
    readonly stateType: LifecycleStateType;
}
/**
 * Deleting state - resource is being deleted.
 *
 * Resources enter this state when deletion begins.
 * Valid transitions: deleting → deleted | failed
 *
 * Validates: Requirements 7.1, 7.2
 */
export declare class DeletingState extends BaseLifecycleState {
    readonly stateType: LifecycleStateType;
}
/**
 * Deleted state - resource has been deleted (terminal state).
 *
 * Resources enter this state after successful deletion.
 * This is a terminal state with no valid transitions.
 *
 * Validates: Requirements 7.1, 7.2
 */
export declare class DeletedState extends BaseLifecycleState {
    readonly stateType: LifecycleStateType;
}
/**
 * Failed state - resource operation failed.
 *
 * Resources enter this state when an operation fails.
 * Supports retry() and rollback() methods for recovery.
 * Valid transitions: failed → pending | deleted
 *
 * Validates: Requirements 7.1, 7.2, 7.4
 */
export declare class FailedState extends BaseLifecycleState implements IRetryableState, IRollbackableState {
    readonly stateType: LifecycleStateType;
    /** The error that caused the failure */
    readonly error?: Error;
    /**
     * Create a FailedState with optional error information.
     *
     * @param error - The error that caused the failure
     */
    constructor(error?: Error);
    /**
     * Retry the failed operation by transitioning back to pending.
     *
     * This allows the resource to attempt the operation again.
     *
     * @param entity - The resource entity to retry
     * @returns The new PendingState
     */
    retry(entity: IResourceEntity): ILifecycleStateExtended;
    /**
     * Rollback by transitioning to deleted state.
     *
     * This cleans up the failed resource.
     *
     * @param entity - The resource entity to rollback
     * @returns The new DeletedState
     */
    rollback(entity: IResourceEntity): ILifecycleStateExtended;
}
/**
 * Factory function to create state instances by type.
 *
 * @param stateType - The type of state to create
 * @param error - Optional error for FailedState
 * @returns The appropriate state instance
 */
export declare function createStateInstance(stateType: LifecycleStateType, error?: Error): ILifecycleStateExtended;
/**
 * Type guard to check if a state supports retry operations.
 *
 * @param state - The state to check
 * @returns True if the state supports retry
 */
export declare function isRetryableState(state: ILifecycleStateExtended): state is IRetryableState;
/**
 * Type guard to check if a state supports rollback operations.
 *
 * @param state - The state to check
 * @returns True if the state supports rollback
 */
export declare function isRollbackableState(state: ILifecycleStateExtended): state is IRollbackableState;
