import type { AsyncValidatorRules, FormatRules, ValidationRuleResult, ValidatorMode, ValidatorRules } from '../../utils/validation/types';
export type FieldData<FieldSchema> = {
    [fieldData in keyof FieldSchema]: FieldSchema[fieldData];
};
export type FieldLabels<FieldSchema> = {
    [fieldLabel in keyof FieldSchema]?: string;
};
export type FieldValue<InnerFormSchema> = InnerFormSchema[keyof InnerFormSchema];
export interface FormState<InnerFormSchema> {
    schema?: Array<keyof InnerFormSchema>;
    data: InnerFormSchema;
    errors: Record<keyof InnerFormSchema, ValidationRuleResult | null>;
    asyncErrors: Record<keyof InnerFormSchema, ValidationRuleResult | null>;
    valid: Record<keyof InnerFormSchema, boolean>;
    fieldProblems: Record<keyof InnerFormSchema, boolean>;
    obscuredFields?: Array<keyof InnerFormSchema>;
    optionalFields?: Array<keyof InnerFormSchema>;
    trustedFields?: Array<string>;
    isValid?: boolean;
    dataStoreId?: string;
    local?: FormState<InnerFormSchema> | Partial<FormState<InnerFormSchema>>;
}
export type FormName<T> = keyof {
    [InnerFormName in keyof T]: T[InnerFormName];
};
export type NestedSchema<T> = T[keyof T];
export interface Form<T> extends MultiFormState<T> {
    setData<InnerFormName extends keyof T>(key: keyof Required<T>[InnerFormName], value: FieldValue<NestedSchema<T>>, formName: InnerFormName): void;
    setFormData: <FN extends FormName<T>>(formName: FN, formData: T[FN]) => void;
    setValid<InnerFormName extends keyof T>(key: keyof Required<T>[InnerFormName], value: boolean, formName: InnerFormName): void;
    setErrors<InnerFormName extends keyof T>(key: keyof Required<T>[InnerFormName], value: ValidationRuleResult | null, formName: InnerFormName): void;
    handleChangeFor<InnerFormName extends keyof T>(key: keyof Required<T>[InnerFormName], formName: InnerFormName, mode?: ValidatorMode): (e: any) => void;
    triggerValidation<InnerFormName extends keyof T>(formName: InnerFormName, selectedSchema?: Array<keyof Required<T>[InnerFormName]>): Promise<boolean>;
    resetToDefaultData: () => void;
    defaultData?: T;
}
export type NestedErrorState<InnerFormSchema> = {
    [FieldName in keyof InnerFormSchema]: ValidationRuleResult | null;
};
export type NestedValidState<InnerFormSchema> = {
    [FieldName in keyof InnerFormSchema]: boolean;
};
export type MultiFormErrorState<TopLevelSchema> = {
    [InnerFormName in keyof TopLevelSchema]: NestedErrorState<TopLevelSchema[InnerFormName]>;
};
export type MultiFormValidState<TopLevelSchema> = {
    [InnerFormName in keyof TopLevelSchema]: NestedValidState<TopLevelSchema[InnerFormName]>;
};
export type MultiFormState<T> = {
    data: T;
    errors: MultiFormErrorState<T>;
    asyncErrors: MultiFormErrorState<T>;
    valid: MultiFormValidState<T>;
    fieldProblems: MultiFormValidState<T>;
    allFields?: {
        [InnerFormName in keyof T]: Array<keyof T[InnerFormName]>;
    };
    requiredFields?: {
        [InnerFormName in keyof T]: Array<keyof T[InnerFormName]>;
    };
    optionalFields?: {
        [InnerFormName in keyof T]: Array<keyof T[InnerFormName]>;
    };
    obscuredFields?: {
        [InnerFormName in keyof T]: Array<keyof T[InnerFormName]>;
    };
    trustedFields?: {
        [InnerFormName in keyof T]: Array<keyof T[InnerFormName]>;
    };
    isValid?: {
        [InnerFormName in keyof T]: boolean;
    };
    local?: {
        [InnerFormName in keyof T]: Partial<FormState<T[InnerFormName]>>;
    };
    defaultData?: T;
};
export interface MultiFormOptions<T> {
    defaultData?: T;
    rules?: {
        [InnerFormName in keyof T]: ValidatorRules<T[InnerFormName]>;
    } | ((data?: T) => {
        [InnerFormName in keyof T]: ValidatorRules<T[InnerFormName]>;
    });
    asyncRules?: {
        [InnerFormName in keyof T]: AsyncValidatorRules<T[InnerFormName]>;
    } | ((data?: T) => {
        [InnerFormName in keyof T]: AsyncValidatorRules<T[InnerFormName]>;
    });
    formatters?: {
        [InnerFormName in keyof T]: FormatRules<T[InnerFormName]>;
    };
    fieldProblems?: {
        [InnerFormName in keyof T]: {
            [FieldName in keyof T[InnerFormName]]: boolean;
        };
    };
    allFields?: {
        [InnerFormName in keyof T]: Array<keyof T[InnerFormName]>;
    };
    requiredFields?: {
        [InnerFormName in keyof T]: (keyof Required<T[InnerFormName]>)[];
    } | ((data: T | undefined) => {
        [InnerFormName in keyof T]: (keyof Required<T[InnerFormName]>)[];
    });
    optionalFields?: {
        [InnerFormName in keyof T]: Array<keyof Required<T>[InnerFormName]>;
    };
    obscuredFields?: {
        [InnerFormName in keyof T]: Array<keyof Required<T>[InnerFormName]>;
    };
    trustedFields?: {
        [InnerFormName in keyof T]: Array<keyof Required<T>[InnerFormName]>;
    };
}
