import { ItemKey } from '../item';
import { ComputeValueMethod, StateRuntimeJobConfigInterface } from '@agile-ts/core';
import { ValidationMethodInterface, Validator } from '../validator';
import { Multieditor } from './multieditor';
export declare type Primitive = null | undefined | string | number | boolean | symbol | bigint;
declare const $NestedValue: unique symbol;
export declare type NestedValue<TValue extends Object = Object> = {
    [$NestedValue]: never;
} & TValue;
export declare type DeepPartial<T> = {
    [K in keyof T]?: DeepPartialImpl<T[K]>;
};
declare type DeepPartialImpl<T> = T extends NestedValue ? T : T extends ReadonlyArray<any> | Record<any, unknown> ? DeepPartial<T> : T;
export declare type ShallowPartial<T> = {
    [K in keyof T]?: T;
};
export declare type DeepPaths<T> = {
    [K in keyof T]: DeepPathsImpl<K & string, T[K]>;
}[keyof T] & string;
declare type DeepPathsImpl<K extends string | number, V> = V extends Primitive ? `${K}` : `${K}` | `${K}.${DeepPaths<V>}`;
export declare type FlatPaths<T> = {
    [K in keyof T]: T[K] extends any ? K : never;
}[keyof T] & string;
export declare type DeepPathValues<T, P extends DeepPaths<T> | string | number> = T extends any ? P extends `${infer K}.${infer R}` ? K extends keyof T ? R extends DeepPaths<T[K]> ? DeepPathValues<T[K], R> : never : never : P extends keyof T ? T[P] : never : never;
export declare type DeepFieldPaths<TFieldData extends FieldData> = DeepPaths<TFieldData> | ItemKey;
export declare type FieldPaths<TFieldData extends FieldData> = FlatPaths<TFieldData> | ItemKey;
export declare type FieldData = Record<string, any>;
export declare type DeepFieldPathValues<TFieldData extends FieldData, TFieldPath extends DeepFieldPaths<TFieldData>> = DeepPathValues<TFieldData, TFieldPath>;
export declare type EditorKey = string | number;
export interface CreateEditorConfigImpl<TFieldData extends FieldData = FieldData> {
    /**
     * Key/Name identifier of the Multieditor.
     * @default undefined
     */
    key?: string;
    /**
     * Initial data of the Multieditor.
     * @default {}
     */
    initialData: TFieldData;
    /**
     * Key/name identifiers of the Items whose values
     * to be always passed to the specified 'onSubmit()' method.
     * @default []
     */
    fixedProperties?: string[];
    /**
     * Key/Name identifiers of the Items that can be edited.
     * @default Object.keys(config.initialData)
     */
    editableProperties?: string[];
    /**
     * Keymap to assign validation schemas to the individual Items of the Multieditor.
     * @default {}
     */
    validationSchema?: EditorValidationSchemaType;
    /**
     * Keymap to assign compute methods to the individual Items of the Multieditor.
     * @default {}
     */
    computeMethods?: {
        [key: string]: ComputeValueMethod;
    };
    /**
     * Callback to be called when the Multieditor is submitted.
     * @default () => {}
     */
    onSubmit: (preparedData: ShallowPartial<TFieldData>, config?: any) => Promise<any>;
    /**
     * In which circumstances the Multieditor should be revalidated.
     * @default 'onSubmit'
     */
    reValidateMode?: ValidationMode;
    /**
     * What type of data should be revalidated.
     * @default 'editable'
     */
    toValidate?: ValidateType;
}
export declare type CreateEditorConfig<TFieldData extends FieldData = FieldData> = CreateEditorConfigImpl<TFieldData> | ((editor: Multieditor<TFieldData>) => CreateEditorConfigImpl<TFieldData>);
export declare type EditorValidationSchemaType = {
    [key: string]: ValidationMethodInterface | Validator;
};
export interface EditorConfigInterface {
    /**
     * In which circumstances the Multieditor should be revalidated.
     * @default 'onSubmit'
     */
    reValidateMode: ValidationMode;
    /**
     * What type of data should be revalidated.
     * @default 'editable'
     */
    toValidate: ValidateType;
}
export interface SubmitConfigInterface<OnSubmitConfigType = any> {
    /**
     * Whether the submitted values should be assigned
     * as the initial values of the corresponding Items.
     * @default true
     */
    assignToInitial?: boolean;
    /**
     * Configuration object that is passed into the 'onSubmit()' method.
     * @default {}
     */
    onSubmitConfig?: OnSubmitConfigType;
}
export interface UpdateInitialValueConfigInterface extends StateRuntimeJobConfigInterface {
    /**
     * Whether the new initial Item value should be applied to the current Item value.
     * @default true
     */
    reset?: boolean;
}
export interface RecomputeValidatedStateMethodConfigInterface {
    /**
     * Whether all Items should be revalidated
     * before the validation state of the Multieditor is computed.
     * @default true
     */
    validate?: boolean;
}
export declare type ValidationMode = 'onChange' | 'onSubmit' | 'onBlur' | 'afterFirstSubmit';
export declare type ValidateType = 'all' | 'editable';
export {};
