import { z } from 'zod';
export type FieldErrors<T> = {
    [K in keyof T]?: string;
} & {
    [key: string]: string | undefined;
};
export interface UseValidationOptions<T> {
    /**
     * Called with the first Zod error formatted as a human-readable summary.
     * Useful for showing a banner/toast above the form.
     */
    setErrorMessage?: (message?: string) => void;
    /**
     * Called every time field errors change (including when they are cleared).
     * Use this to sync errors into external state such as a jotai atom.
     */
    onFieldErrors?: (errors: FieldErrors<T>) => void;
}
export interface UseValidationReturn<T> {
    validateForm: (data: any) => boolean;
    fieldErrors: FieldErrors<T>;
    clearErrors: () => void;
    clearFieldError: (field: keyof T) => void;
    setFieldError: (field: keyof T, message: string) => void;
}
/**
 * Generic Zod-based form validation hook.
 *
 * - Stores field errors in local `useState`.
 * - Translates field errors and summary messages using built-in react-ui translations (requires MesalvoProvider).
 * - Optionally syncs errors to external state via `options.onFieldErrors` (e.g. a jotai atom).
 * - Exposes `clearErrors`, `clearFieldError`, and `setFieldError` helpers.
 *
 * @example
 * // Standalone (mf-observations style)
 * const { validateForm, fieldErrors } = useValidation(myZodSchema);
 *
 * @example
 * // With external atom sync (admin style)
 * const [atomErrors, setAtomErrors] = useAtom(formValidationAtom);
 * const { validateForm } = useValidation(myZodSchema, {
 *   setErrorMessage,
 *   onFieldErrors: setAtomErrors,
 * });
 */
export declare const useValidation: <T extends z.ZodTypeAny>(schema?: T, options?: UseValidationOptions<z.infer<T>>) => UseValidationReturn<z.infer<T>>;
//# sourceMappingURL=use-validation.d.ts.map