/**
 * Error Handling Middleware
 *
 * Centralized error handling for the API server.
 */
import type { Request, Response, NextFunction, ErrorRequestHandler } from 'express';
import type { ApiError } from '../types.js';
/**
 * Custom API Error class
 */
export declare class ApiServerError extends Error {
    code: string;
    status: number;
    details?: Record<string, unknown>;
    constructor(message: string, code?: string, status?: number, details?: Record<string, unknown>);
    static badRequest(message: string, details?: Record<string, unknown>): ApiServerError;
    static unauthorized(message?: string): ApiServerError;
    static forbidden(message?: string): ApiServerError;
    static notFound(resource?: string): ApiServerError;
    static rateLimited(retryAfter: number): ApiServerError;
    static internal(message?: string): ApiServerError;
    static serviceUnavailable(message?: string): ApiServerError;
    toJSON(): ApiError;
}
/**
 * Generate request ID
 */
export declare function generateRequestId(): string;
/**
 * Request ID middleware
 */
export declare function requestIdMiddleware(req: Request, res: Response, next: NextFunction): void;
/**
 * Not found handler (404)
 */
export declare function notFoundHandler(req: Request, res: Response): void;
/**
 * Global error handler
 */
export declare const errorHandler: ErrorRequestHandler;
/**
 * Async handler wrapper (catches async errors)
 */
export declare function asyncHandler<T>(fn: (req: Request, res: Response, next: NextFunction) => Promise<T>): (req: Request, res: Response, next: NextFunction) => void;
/**
 * Validate required fields in request body
 */
export declare function validateRequired<T extends object>(body: T, fields: (keyof T | string)[]): void;
/**
 * Validate field types
 */
export declare function validateTypes(body: Record<string, unknown>, schema: Record<string, 'string' | 'number' | 'boolean' | 'object' | 'array'>): void;
