/**
 * Migration Helpers for Enhanced Types
 * Following Phase 2g: Backward-compatible tools to help packages adopt new types incrementally
 * Focused on Education domain patterns
 */
import type { AuthUser, ExpressMiddleware, TypedRequest, TypedResponse } from './common';
import type { Callback, ConfigObject, EducationUser, EventHandler, Metadata, MiddlewareFunction, Result, TypedEventEmitter } from './enhanced-types';
import type { ValidationContext } from './compliance';
/**
 * Wrap legacy event handler to use new typed pattern
 * Helps migrate from: (...args: any[]) => void
 * To: EventHandler<TEvent>
 */
export declare function wrapLegacyEventHandler<TEvent = unknown>(legacyHandler: (...args: unknown[]) => void | Promise<void>): EventHandler<TEvent>;
/**
 * Wrap legacy callback to use new typed pattern
 * Helps migrate from: (err: any, result?: any) => void
 * To: Callback<TResult, TError>
 */
export declare function wrapLegacyCallback<TResult = unknown, TError = Error>(legacyCallback: (err: unknown, result?: unknown) => void): Callback<TResult, TError>;
/**
 * Convert legacy middleware to typed middleware
 * Helps migrate Express middleware to typed patterns
 */
export declare function convertExpressMiddleware<TReq = TypedRequest, TRes = TypedResponse>(middleware: ExpressMiddleware): MiddlewareFunction<{
    req: TReq;
    res: TRes;
    next: () => Promise<void>;
}>;
/**
 * Migrate generic AuthUser to EducationUser
 * Adds education-specific fields with safe defaults
 */
export declare function migrateToEducationUser(user: AuthUser, educationData?: Partial<Pick<EducationUser, 'userType' | 'schoolId' | 'districtId' | 'gradeLevel' | 'subjects'>>): EducationUser;
/**
 * Create education context from request
 * Helps build proper ValidationContext for education operations
 */
export declare function createEducationContext(req: TypedRequest, action: string, resource: string): ValidationContext;
/**
 * Convert Promise to Result pattern
 * Helps migrate from: Promise<T>
 * To: Promise<Result<T, E>>
 */
export declare function promiseToResult<T, E = Error>(promise: Promise<T>): Promise<Result<T, E>>;
/**
 * Convert callback-based function to Result pattern
 */
export declare function callbackToResult<TArgs extends unknown[], TResult, TError = Error>(fn: (...args: [...TArgs, (err: unknown, result?: unknown) => void]) => void): (...args: TArgs) => Promise<Result<TResult, TError>>;
/**
 * Convert legacy event emitter to typed event emitter
 */
export declare function createTypedEventWrapper<TEvents extends Record<string, unknown[]>>(legacyEmitter: {
    on: (event: string, handler: (...args: unknown[]) => void) => void;
    off: (event: string, handler: (...args: unknown[]) => void) => void;
    emit: (event: string, ...args: unknown[]) => boolean;
    once: (event: string, handler: (...args: unknown[]) => void) => void;
}): TypedEventEmitter<TEvents>;
/**
 * Migrate loose config object to typed ConfigObject
 */
export declare function migrateConfig<T extends Record<string, unknown>>(config: Record<string, unknown>, defaults: T, validator?: (config: T) => string[]): ConfigObject<T>;
/**
 * Convert loose metadata to typed Metadata
 */
export declare function migrateMetadata<TKnown extends Record<string, unknown> = Record<string, never>>(metadata: unknown, knownKeys: TKnown): Metadata<TKnown>;
export declare const migrationHelpers: {
    wrapLegacyEventHandler: typeof wrapLegacyEventHandler;
    wrapLegacyCallback: typeof wrapLegacyCallback;
    convertExpressMiddleware: typeof convertExpressMiddleware;
    migrateToEducationUser: typeof migrateToEducationUser;
    createEducationContext: typeof createEducationContext;
    promiseToResult: typeof promiseToResult;
    callbackToResult: typeof callbackToResult;
    createTypedEventWrapper: typeof createTypedEventWrapper;
    migrateConfig: typeof migrateConfig;
    migrateMetadata: typeof migrateMetadata;
};
export type { ValidationContext } from './index';
//# sourceMappingURL=migration-helpers.d.ts.map