import SchemaEntity, { Schema, SchemaAllValues, SchemaPartialValues, SchemaFieldNames } from '@sprucelabs/schema';
import { FieldDefinitions } from './../.spruce/schemas/fields/fields.types';
import { GraphicsInterface } from '../types/cli.types';
declare enum FormBuilderActionType {
    Done = "done",
    Cancel = "cancel",
    EditField = "edit_field"
}
interface FormActionDone {
    type: FormBuilderActionType.Done;
}
interface FormActionCancel {
    type: FormBuilderActionType.Cancel;
}
interface FormActionEditField<T extends Schema> {
    type: FormBuilderActionType.EditField;
    fieldName: SchemaFieldNames<T>;
}
type FormAction<T extends Schema> = FormActionDone | FormActionCancel | FormActionEditField<T>;
export interface FormPresentationOptions<T extends Schema, F extends SchemaFieldNames<T> = SchemaFieldNames<T>> {
    headline?: string;
    showOverview?: boolean;
    fields?: F[];
}
export interface FormOptions<T extends Schema> {
    ui: GraphicsInterface;
    schema: T;
    initialValues?: SchemaPartialValues<T>;
    onWillAskQuestion?: <K extends SchemaFieldNames<T>>(name: K, fieldDefinition: FieldDefinitions, values: SchemaPartialValues<T>) => FieldDefinitions;
}
interface Handlers<T extends Schema> {
    onWillAskQuestion?: FormOptions<T>['onWillAskQuestion'];
}
export default class FormComponent<S extends Schema> extends SchemaEntity<S> {
    ui: GraphicsInterface;
    handlers: Handlers<S>;
    constructor(options: FormOptions<S>);
    /** Pass me a schema and i'll give you back an object that conforms to it based on user input */
    present<F extends SchemaFieldNames<S> = SchemaFieldNames<S>>(options?: FormPresentationOptions<S, F>): Promise<Pick<SchemaAllValues<S>, F>>;
    /** Ask a question based on a field */
    askQuestion<F extends SchemaFieldNames<S>>(fieldName: F): Promise<any>;
    renderError(error: Error): void;
    renderOverview<F extends SchemaFieldNames<S>>(options?: {
        fields?: F[];
    }): Promise<FormAction<S>>;
}
export {};
