import { Paths, Get, IterableElement, OmitIndexSignature } from 'type-fest';
import { ToString } from 'type-fest/source/internal';
import { LiteralStringUnion } from 'type-fest/source/literal-union';
import { PathsOptions, DefaultPathsOptions } from 'type-fest/source/paths';
import { VNode } from 'vue';
type ArrayAttrs = any;
interface Option {
    label: string;
    value: any;
}
export type AttributeValue = string | number | boolean | undefined | {
    [key: string]: any;
};
export type AttributeFn<T, P extends Path<T>> = (field: SmartFieldVal<T, P>, row?: T) => AttributeValue;
export interface Attributes<T, P extends Path<T>> {
    [key: string]: AttributeValue | AttributeFn<T, P>;
}
export type BagelFieldOptions<T, P extends Path<T>> = string | ({
    label?: string;
    value: string | number;
} | string | number | boolean | {
    [key: string]: any;
})[] | ((val?: SmartFieldVal<T, P>, rowData?: T) => Option[] | ((query: string) => Promise<Option[]>)) | ((query: string, val?: SmartFieldVal<T, P>, rowData?: T) => Promise<Option[]>);
export type VIfType<T, P extends Path<T>> = string | boolean | ((val?: SmartFieldVal<T, P>, rowData?: T) => boolean);
export type ValidationFn<T, P extends Path<T>> = (val?: SmartFieldVal<T, P>, rowData?: T) => string | undefined;
export interface ShallowPathsOptions extends PathsOptions {
    maxRecursionDepth: 0;
}
export type _Path<T, PO extends PathsOptions = DefaultPathsOptions> = ToString<Paths<OmitIndexSignature<T>, PO>>;
export type OpenEndedPath<T> = keyof T extends infer K ? K extends keyof T ? T[K] extends {
    [key: string]: any;
} ? `${K & string}.${string}` : never : never : never;
type IndexSignaturePaths<T> = {
    [K in keyof T]: T[K] extends {
        [key: string]: any;
    } ? T[K] extends {
        [key: string]: infer V;
    } ? `${K & string}.${string}` : never : never;
}[keyof T];
export type Path<T, PO extends PathsOptions = DefaultPathsOptions> = FieldVal<T, _Path<T, PO>> extends Array<any> ? LiteralStringUnion<_Path<T, PO>> : _Path<T, PO> | IndexSignaturePaths<T> | `${keyof T & string}.more_info.${string}`;
export type SmartFieldVal<T, P extends Path<T>> = P extends string ? P extends keyof T ? T[P] : any : FieldVal<T, P>;
export type SmartBagelFieldOptions<T, P extends Path<T>> = string | ({
    label?: string;
    value: string | number;
} | string | number | boolean | {
    [key: string]: any;
})[] | ((val?: SmartFieldVal<T, P>, rowData?: T) => Option[] | ((query: string) => Promise<Option[]>)) | ((query: string, val?: SmartFieldVal<T, P>, rowData?: T) => Promise<Option[]>);
export type SmartVIfType<T, P extends Path<T>> = string | boolean | ((val?: SmartFieldVal<T, P>, rowData?: T) => boolean);
export type SmartValidationFn<T, P extends Path<T>> = (val?: SmartFieldVal<T, P>, rowData?: T) => string | undefined;
export type SmartAttributeFn<T, P extends Path<T>> = (field: SmartFieldVal<T, P>, row?: T) => AttributeValue;
export type SmartTransformFn<T, P extends Path<T>> = (val?: SmartFieldVal<T, P>, rowData?: T) => any;
export type SmartUpdateFn<T, P extends Path<T>> = (val?: SmartFieldVal<T, P>, rowData?: T) => unknown;
/** The value type at path P in object T. */
export type FieldVal<T, P extends Path<T>> = unknown extends Get<T, P> ? unknown : Get<T, P>;
/** If path P in T is an array, this gives the array's element type. */
export type ArrayFieldVal<T, P extends Path<T>> = IterableElement<Get<T, P>>;
export type VNodeFn<T, P extends Path<T>> = (props: {
    row?: T;
    field: BaseBagelField<T, P>;
}) => VNode;
export interface ElementField<T, PO extends PathsOptions = DefaultPathsOptions> {
    $el: any;
    id?: Path<T, PO> | string;
    class?: any;
    vIf?: any;
    style?: Record<string, any>;
    attrs?: Record<string, any>;
    onClick?: (val?: any, rowData?: T) => void;
    transform?: (val?: any, rowData?: T) => any;
    children?: ElementField<T, PO>[];
}
type ValidBaseBagelField<T, PO extends PathsOptions = DefaultPathsOptions> = {
    [P in Path<T, PO>]: BaseBagelField<T, P, PO>;
}[Path<T, PO>];
export type SchemaChild<T, P extends Path<T, PO>, PO extends PathsOptions = DefaultPathsOptions> = Field<T, PO> | ElementField<T, PO> | VNode | VNodeFn<T, P> | string | ValidBaseBagelField<T, PO>;
export interface BaseBagelField<T, P extends Path<T, PO>, PO extends PathsOptions = DefaultPathsOptions> {
    '$el'?: string | any;
    'id'?: P;
    'label'?: string;
    'placeholder'?: string;
    'class'?: AttributeValue | SmartAttributeFn<T, P>;
    'attrs'?: Attributes<T, P>;
    'required'?: boolean;
    'disabled'?: boolean;
    'helptext'?: string;
    'options'?: SmartBagelFieldOptions<T, P>;
    'children'?: SchemaChild<T, Path<T, PO>, PO>[];
    'slots'?: {
        [key: string]: SchemaChild<T, Path<T, PO>, PO>[];
    };
    'defaultValue'?: any;
    'vIf'?: SmartVIfType<T, P>;
    'v-if'?: SmartVIfType<T, P>;
    'transform'?: SmartTransformFn<T, P>;
    'onUpdate'?: SmartUpdateFn<T, P>;
    'validate'?: SmartValidationFn<T, P>;
}
export type _MappedBaseBagelField<T, PO extends PathsOptions = DefaultPathsOptions> = {
    [P in Path<T, PO>]: BaseBagelField<T, P, PO>;
};
export type MappedBaseBagelFieldP<T, P extends Path<T, PO>, PO extends PathsOptions = DefaultPathsOptions> = _MappedBaseBagelField<T, PO>[P];
export type FieldByP<T, P extends Path<T, PO>, PO extends PathsOptions = DefaultPathsOptions> = MappedBaseBagelFieldP<T, P, PO>;
export type Field<T, PO extends PathsOptions = DefaultPathsOptions> = MappedBaseBagelFieldP<T, Path<T, PO>, PO>;
export type BglFieldT<T, PO extends PathsOptions = DefaultPathsOptions> = Field<T, PO>;
export type SchemaField<T, PO extends PathsOptions = DefaultPathsOptions> = Field<T, PO> | ElementField<T, PO>;
export type BglFormSchemaT<T, PO extends PathsOptions = DefaultPathsOptions> = (SchemaField<T, PO> | BaseBagelField<T, Path<T, PO>, PO>)[];
export type ShallowBglFormSchemaT<T, PO extends PathsOptions = ShallowPathsOptions> = (SchemaField<T, PO> | BaseBagelField<T, Path<T, PO>, PO>)[];
export interface InputBagelField<T, P extends Path<T, PO>, PO extends PathsOptions = DefaultPathsOptions> extends BaseBagelField<T, P, PO> {
    $el: 'text' | any;
    type?: string;
}
export interface SelectBagelField<T, P extends Path<T, PO>, PO extends PathsOptions = DefaultPathsOptions> extends BaseBagelField<T, P, PO> {
    $el: 'select' | any;
    type?: string;
}
export interface ArrayBagelField<T, P extends Path<T, PO>, PO extends PathsOptions = DefaultPathsOptions> extends BaseBagelField<T, P, PO> {
    $el: 'array' | any;
    attrs?: ArrayAttrs;
}
export interface ValidateInputBaseT {
    validate?: ValidationFn<{
        [key: string]: unknown;
    }, string>;
    getFormData?: () => any;
}
export interface UploadInputProps {
    id?: string;
    label?: string;
    multiple?: boolean;
    modelValue?: string | string[];
    width?: string;
    height?: string | 'auto';
    dirPath?: string;
    fill?: boolean;
    oval?: boolean;
    theme?: 'dropzone' | 'basic';
    accept?: string;
    capture?: boolean | 'user' | 'environment';
    required?: boolean;
    disabled?: boolean;
    baseURL?: string;
    placeholder?: string;
    noFilePlaceholder?: string;
    btnPlaceholder?: string;
}
export {};
//# sourceMappingURL=BagelForm.d.ts.map