export enum FormFieldType { text, password, url, email, phone, search, number, error, select, checkboxes, textarea, date, color, } export interface FormFieldConfig { type: FormFieldType, name: string, title: string, required?: boolean, } export interface FormConfig { endpoint: string, method?: 'get'|'post'|'put'|'delete'|'patch', fields: (FormFieldConfig)[], } export type FormData = {[key: string]: any} export interface FormField { getFieldName(): string getValue(): any validate(): boolean } export interface FormControl { hasField(field: FormField): boolean registerField(field: FormField): void processChanges(): void gather(): FormData | Promise submit(): void | Promise isValid(): boolean }