import { Request, Response, NextFunction } from "express";
/**
 * Interface for application errors with additional information
 */
export interface AppError extends Error {
    statusCode?: number;
    code?: string;
    isOperational?: boolean;
    details?: any;
}
/**
 * Base class for operational errors (expected errors)
 */
export declare class OperationalError extends Error implements AppError {
    statusCode: number;
    code: string;
    isOperational: boolean;
    details?: any;
    constructor(message: string, details?: any, statusCode?: number, code?: string);
}
/**
 * Validation error (400)
 */
export declare class ValidationError extends OperationalError {
    constructor(message: string, details?: any);
}
/**
 * Authentication error (401)
 */
export declare class UnauthorizedError extends OperationalError {
    constructor(message: string, details?: any);
}
/**
 * Authorization error (403)
 */
export declare class ForbiddenError extends OperationalError {
    constructor(message: string, details?: any);
}
/**
 * Resource not found error (404)
 */
export declare class NotFoundError extends OperationalError {
    constructor(message: string, details?: any);
}
/**
 * Conflict error (409)
 */
export declare class ConflictError extends OperationalError {
    constructor(message: string, details?: any);
}
/**
 * Internal server error (500)
 */
export declare class InternalServerError extends OperationalError {
    constructor(message: string, details?: any);
}
/**
 * Wrapper for async handlers that automatically catches errors
 *
 * Usage:
 * app.get('/route', asyncHandler(async (req, res) => {
 *   // your async code here
 * }))
 * @param fn - Async handler function to wrap
 * @returns Express middleware that automatically catches errors
 */
export declare const asyncHandler: (fn: (req: Request, res: Response, next: NextFunction) => Promise<any>) => (req: Request, res: Response, next: NextFunction) => void;
/**
 * Middleware to handle not found routes (404)
 * Must be placed after all routes but before the error handler
 * @param req - Express Request object
 * @param res - Express Response object
 * @param next - Express next function
 * @returns void
 */
export declare const notFoundHandler: (req: Request, res: Response, next: NextFunction) => void;
/**
 * Global error handling middleware
 * Must be the last middleware in the chain
 *
 * Catches all unhandled synchronous and asynchronous errors
 * @param error - The caught error
 * @param req - Express Request object
 * @param res - Express Response object
 * @param next - Express next function
 * @returns void
 */
export declare const errorHandler: (error: AppError | Error, req: Request, res: Response, next: NextFunction) => void;
/**
 * Helper to quickly create operational errors
 * @param message - Error message
 * @param details - Additional error details
 * @param statusCode - HTTP status code
 * @param code - Custom error code
 * @returns New OperationalError instance
 */
export declare const createError: (message: string, details?: any, statusCode?: number, code?: string) => OperationalError;
