/**
 * Request Validation Middleware
 * Provides schema-based request validation for server adapters
 */
import type { MiddlewareDefinition, ServerContext } from "../types.js";
import { ValidationError as ServerValidationError } from "../errors.js";
/**
 * Validation configuration
 */
export type ValidationConfig = {
    /** Schema for validating request body */
    bodySchema?: ValidationSchema;
    /** Schema for validating query parameters */
    querySchema?: ValidationSchema;
    /** Schema for validating path parameters */
    paramsSchema?: ValidationSchema;
    /** Schema for validating headers */
    headersSchema?: ValidationSchema;
    /**
     * Custom validation function
     * Throw ValidationError for invalid requests
     */
    customValidator?: (ctx: ServerContext) => Promise<void>;
    /** Skip validation for certain paths */
    skipPaths?: string[];
    /** Custom error formatter */
    errorFormatter?: (errors: ServerValidationError[]) => unknown;
};
/**
 * Simple validation schema
 * Can be extended with JSON Schema or Zod integration
 */
export type ValidationSchema = {
    /** Required fields */
    required?: string[];
    /** Field type definitions */
    properties?: Record<string, PropertySchema>;
    /** Allow additional properties */
    additionalProperties?: boolean;
};
/**
 * Property schema definition
 */
export type PropertySchema = {
    /** Property type */
    type: "string" | "number" | "boolean" | "object" | "array";
    /** Minimum value (for numbers) or length (for strings/arrays) */
    minimum?: number;
    /** Maximum value (for numbers) or length (for strings/arrays) */
    maximum?: number;
    /** Minimum length for strings (alias for minimum) */
    minLength?: number;
    /** Maximum length for strings (alias for maximum) */
    maxLength?: number;
    /** Minimum items for arrays */
    minItems?: number;
    /** Maximum items for arrays */
    maxItems?: number;
    /** Pattern for string validation (regex) */
    pattern?: string;
    /** Enum of allowed values */
    enum?: unknown[];
    /** Default value */
    default?: unknown;
    /** Custom validation function */
    validate?: (value: unknown) => boolean | string;
};
/**
 * Re-export ValidationError from errors for convenience
 */
export { ValidationError } from "../errors.js";
/**
 * Create request validation middleware
 *
 * @example
 * ```typescript
 * const validationMiddleware = createRequestValidationMiddleware({
 *   bodySchema: {
 *     required: ["input"],
 *     properties: {
 *       input: { type: "string", minimum: 1 },
 *       temperature: { type: "number", minimum: 0, maximum: 1 },
 *     },
 *   },
 * });
 *
 * server.registerMiddleware(validationMiddleware);
 * ```
 */
export declare function createRequestValidationMiddleware(config: ValidationConfig): MiddlewareDefinition;
/**
 * Create a field validator helper
 */
export declare function createFieldValidator(fieldName: string, rules: PropertySchema): (value: unknown) => void;
/**
 * Create body-only validation middleware
 *
 * @example
 * ```typescript
 * const middleware = createBodyValidationMiddleware({
 *   required: ["input"],
 *   properties: {
 *     input: { type: "string" },
 *   },
 * });
 * ```
 */
export declare function createBodyValidationMiddleware(schema: ValidationSchema): MiddlewareDefinition;
/**
 * Create query-only validation middleware
 *
 * @example
 * ```typescript
 * const middleware = createQueryValidationMiddleware({
 *   properties: {
 *     page: { type: "number", minimum: 1 },
 *     limit: { type: "number", minimum: 1, maximum: 100 },
 *   },
 * });
 * ```
 */
export declare function createQueryValidationMiddleware(schema: ValidationSchema): MiddlewareDefinition;
/**
 * Create a combined validation middleware with full config support
 * Alias for createRequestValidationMiddleware for compatibility
 */
export declare const createValidationMiddleware: typeof createRequestValidationMiddleware;
/**
 * Extended property schema for common schemas
 */
export type ExtendedPropertySchema = PropertySchema & {
    format?: string;
};
/**
 * Extended validation schema for common schemas
 */
export type ExtendedValidationSchema = {
    type?: string;
    format?: string;
    required?: string[];
    properties?: Record<string, ExtendedPropertySchema>;
    additionalProperties?: boolean;
};
/**
 * Common validation schemas for reuse
 */
export declare const CommonSchemas: Record<string, ExtendedValidationSchema>;
