import type { JSONSchema } from '../schema-context';
import { ControllerValidation } from '@/components/form';
/**
 * Cross-field validation rule configuration
 */
export interface CrossFieldValidationRule {
    /** Unique identifier for the rule */
    id: string;
    /** Fields involved in the validation */
    fields: string[];
    /** Validation function that receives field values */
    validate: (fieldValues: Record<string, unknown>, formData: unknown) => CrossFieldValidationResult;
    /** Error message template with field placeholders */
    message?: string;
    /** Which field(s) to attach the error to */
    targets?: string[];
    /** Priority for rule execution (higher numbers run first) */
    priority?: number;
    /** Whether this rule should run only on form submission */
    onSubmitOnly?: boolean;
}
/**
 * Result of cross-field validation
 */
export interface CrossFieldValidationResult {
    /** Whether validation passed */
    valid: boolean;
    /** Error message if validation failed */
    message?: string;
    /** Specific field errors */
    fieldErrors?: Record<string, string>;
    /** Additional context for error reporting */
    context?: Record<string, unknown>;
}
/**
 * Built-in cross-field validation rules
 */
export declare const BUILTIN_CROSS_FIELD_RULES: {
    /**
     * Ensure two fields have the same value (e.g., password confirmation)
     */
    fieldMatch: (field1: string, field2: string, message?: string) => CrossFieldValidationRule;
    /**
     * Ensure date range is valid (start <= end)
     */
    dateRange: (startField: string, endField: string, message?: string) => CrossFieldValidationRule;
    /**
     * Ensure numeric range is valid (min <= max)
     */
    numericRange: (minField: string, maxField: string, message?: string) => CrossFieldValidationRule;
    /**
     * Conditional required field (field is required if condition field has specific value)
     */
    conditionalRequired: (targetField: string, conditionField: string, conditionValue: unknown, message?: string) => CrossFieldValidationRule;
    /**
     * Mutual exclusion (only one of the fields can have a value)
     */
    mutuallyExclusive: (fields: string[], message?: string) => CrossFieldValidationRule;
    /**
     * At least one required (at least one of the fields must have a value)
     */
    atLeastOneRequired: (fields: string[], message?: string) => CrossFieldValidationRule;
};
/**
 * Extract cross-field validation rules from schema x:ui
 */
export declare function getCrossFieldValidationRules(schema: JSONSchema): CrossFieldValidationRule[];
/**
 * Apply cross-field validation rules to form data
 */
export declare function applyCrossFieldValidation(formData: unknown, rules: CrossFieldValidationRule[], onSubmitOnly?: boolean): ControllerValidation;
