import { IKosDataModel, IKosModel } from '../core/kosModel';
import { DependencyLifecycle } from '../types/kos-dependency';
/**
 * Enhanced error class that preserves context through the model lifecycle.
 */
export declare class KosModelError extends Error {
    readonly context: ModelErrorContext;
    readonly originalCause?: Error;
    constructor(message: string, context: ModelErrorContext, cause?: Error);
    /**
     * Format error with full context for logging.
     */
    toDetailedString(): string;
}
/**
 * Context information for model errors.
 */
export interface ModelErrorContext {
    /** Type of model involved */
    modelType: string;
    /** ID of model instance */
    modelId?: string;
    /** Parent model context if applicable */
    parentModel?: {
        type: string;
        id: string;
    };
    /** Lifecycle phase where error occurred */
    lifecycle?: DependencyLifecycle | string;
    /** Operation being performed */
    operation?: string;
    /** Options provided to the model */
    options?: Record<string, any>;
    /** Additional context-specific data */
    metadata?: Record<string, any>;
}
/**
 * Wraps an error with model context, preserving the original error as cause.
 */
export declare function enrichError(error: Error | unknown, context: ModelErrorContext): KosModelError;
/**
 * Safely executes an async operation with automatic error enrichment.
 */
export declare function executeWithContext<T>(operation: () => Promise<T>, context: ModelErrorContext): Promise<T>;
/**
 * Safely executes a sync operation with automatic error enrichment.
 */
export declare function executeSyncWithContext<T>(operation: () => T, context: ModelErrorContext): T;
/**
 * Creates context for a model from its data.
 */
export declare function createModelContext(model: IKosModel | IKosDataModel, operation?: string): ModelErrorContext;
/**
 * Logs a collection of errors with summary and details.
 */
export declare function logErrorCollection(errors: Array<{
    error: Error;
    context: ModelErrorContext;
}>, summary: string): void;
//# sourceMappingURL=model-error-utils.d.ts.map