import { FormKitNode, FormKitPlugin } from '@formkit/core';
import { z } from 'zod';

/**
 * Extend FormKitNode with setZodErrors.
 */
declare module '@formkit/core' {
    interface FormKitNodeExtensions {
        setZodErrors(zodError: z.ZodError | undefined): FormKitNode;
    }
}
/**
 * Creates a new Zod schema plugin for form validation.
 *
 * @param zodSchema - A Zod schema to validate the form against.
 * @param submitCallback - A callback to run when the form is submitted and it passes validation.
 *
 * @returns A tuple of a {@link @formkit/core#FormKitPlugin | FormKitPlugin} and a submit handler.
 *
 * @public
 */
declare function createZodPlugin<Z extends z.ZodTypeAny>(zodSchema: Z, submitCallback: (payload: z.infer<typeof zodSchema>, node: FormKitNode | undefined) => void | Promise<void>): [FormKitPlugin, (payload: any, node: FormKitNode | undefined) => void];

export { createZodPlugin };
