import { IValidationProps } from './validation';
import { Ref, ComputedRef, PropType, InjectionKey } from 'vue';
export interface IFormProvide {
    register: (item: {
        id: number | string;
        validate: () => Promise<string[]>;
        reset: () => void;
        resetValidation: () => void;
    }) => void;
    unregister: (id: number | string) => void;
    update: (id: number | string, isValid: boolean | null, errorMessages: string[]) => void;
    items: Ref<IFormField[]>;
    isDisabled: ComputedRef<boolean>;
    isReadonly: ComputedRef<boolean>;
    isValidating: Ref<boolean>;
    validateOn: Ref<IFormProps['validateOn']>;
}
export interface IFormProps {
    label: string;
    description: string;
    disabled: boolean;
    readonly: boolean;
    firstFail: boolean;
    modelValue: boolean | null;
    validateOn: IValidationProps['validateOn'];
}
interface IFormField {
    id: number | string;
    validate: () => Promise<string[]>;
    reset: () => void;
    resetValidation: () => void;
    isValid: boolean | null;
    errorMessages: string[];
}
interface IFieldValidationResult {
    id: number | string;
    errorMessages: string[];
}
interface IFormValidationResult {
    valid: boolean;
    errors: IFieldValidationResult[];
}
export interface SubmitEventPromise extends SubmitEvent, Promise<IFormValidationResult> {
}
export declare const makeFormProps: <Defaults extends {
    label?: unknown;
    description?: unknown;
    disabled?: unknown;
    readonly?: unknown;
    firstFail?: unknown;
    modelValue?: unknown;
    validateOn?: unknown;
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
    /**
     * Заголовок формы
     */
    label: {
        type: PropType<string>;
        default: string;
    };
    /**
     * Описание формы
     */
    description: {
        type: PropType<string>;
        default: string;
    };
    /**
     * Заблокировать форму
     */
    disabled: {
        type: PropType<boolean>;
        default: boolean;
    };
    /**
     * Сделать форму только для чтения
     */
    readonly: {
        type: PropType<boolean>;
        default: boolean;
    };
    /**
     * Остановить валидацию при первой ошибке
     */
    firstFail: {
        type: PropType<boolean>;
        default: boolean;
    };
    /**
     * Значение модели
     */
    modelValue: {
        type: PropType<boolean | null>;
        default: null;
    };
    /**
     * Событие для валидации
     */
    validateOn: {
        type: PropType<IFormProps["validateOn"]>;
        default: string;
    };
}, Defaults>;
export declare const FormKey: InjectionKey<IFormProvide>;
export declare function createForm(props: IFormProps): {
    errors: Ref<{
        id: number | string;
        errorMessages: string[];
    }[], IFieldValidationResult[] | {
        id: number | string;
        errorMessages: string[];
    }[]>;
    isDisabled: ComputedRef<boolean>;
    isReadonly: ComputedRef<boolean>;
    isValidating: Ref<boolean, boolean>;
    model: Ref<boolean | null, boolean | null> & {
        readonly externalValue: boolean | null;
    };
    validate: () => Promise<{
        valid: boolean;
        errors: {
            id: number | string;
            errorMessages: string[];
        }[];
    }>;
    reset: () => void;
    resetValidation: () => void;
};
export declare function useForm(): IFormProvide | null;
export {};
