import { IModelType, IModelTypeComposite, IStatusMessage, IPropertyStatusMessage, Primitive, Predicate, IClientProps } from "./model.api"; export interface IModelViewField { keypath: string[]; pointer: string; key: string; type: IModelType; validate(val: any): IPropertyStatusMessage[]; } export interface IModelViewPage extends IClientProps { alias: string; index: number; type: IModelTypeComposite | IModelType; fields: string[]; pages: IModelViewPage[]; skipPredicate?: Predicate; flagIsTrue(flagName: string, object: any): boolean; flagExists(flagName: string): boolean; flagNames(): string[]; } export declare enum ValidationScope { VISITED = 0, PAGE = 1, FULL = 2 } /** * Provides an immutable facade for a model, adding IModelType * based validation and support for copy-on-write mutation. * */ export interface IModelView { getModelType(): IModelType; getModel(): Readonly; withChangedField(keyPath: string | string[], newValue: Primitive | any[]): IModelView; withClearedField(keyPath: string | string[]): IModelView; withAddedData(obj: any): IModelView; withFieldEditableFlag(keyPath: string | string[], flag: boolean): IModelView; withFieldEditableFlags(flags: { [keyPath: string]: boolean; }): IModelView; withClearedVisitedFlags(): IModelView; withAddedVisitedFlags(fields: string[]): IModelView; isFieldEditable(keyPath: string | string[]): boolean; getFieldValue(keyPath: string | string[]): any; getFieldType(keyPath: string | string[]): IModelType; getFieldContainerType(keyPath: string | string[]): IModelTypeComposite; getField(keyPath: string | string[]): IModelViewField; getFields(fields?: string[]): IModelViewField[]; getPossibleFieldValues(keyPath: string | string[]): any[]; getFieldMessages(keyPath: string | string[]): IPropertyStatusMessage[]; getValidationMessages(): IPropertyStatusMessage[]; isFieldVisited(field: string | string[]): boolean; isFieldValid(keyPath: string | string[]): boolean; areFieldsValid(fields: string[]): boolean; withFocusedPage(pageOrAliasOrIndex: IModelViewPage | string | number | undefined | null): IModelView; withAllPages(): IModelView; getFocusedPage(): undefined | IModelViewPage; getFocusedPageNo(): undefined | number; getFocusedPageUnskippedPageNo(): undefined | number; getPages(): IModelViewPage[]; getUnskippedPages(): IModelViewPage[]; getAllPages(): IModelViewPage[]; getPage(aliasOrIndex?: string | number): IModelViewPage; getPageIndex(alias: string): number; getPageByUnskippedPageNo(no: number): IModelViewPage; getNextUnskippedPage(dir: 1 | -1): IModelViewPage; getPageMessages(aliasOrIndex?: string | number): IStatusMessage[]; isPageVisited(aliasOrIndex: string | number): boolean; isPageValid(aliasOrIndex?: string | number): boolean; isPageFlagTrue(flag: string): boolean; isVisitedValid(): boolean; areVisitedPagesValid(): boolean; arePagesUpToCurrentValid(): boolean; isValid(): boolean; isFinished(): boolean; getStatusMessages(): IStatusMessage[]; currentPageAlias: string; currentPageIndex: number; currentPageNo: number; totalPageCount: number; currentUnskippedPageNo: number; totalUnskippedPageCount: number; changePage(step: number): IModelView; gotoPage(indexOrAlias: number | string, validationScope?: ValidationScope): IModelView; withValidationMessages(messages: IPropertyStatusMessage[]): IModelView; withStatusMessages(messages: IStatusMessage[]): IModelView; validationScope(): ValidationScope; validateDefault(): Promise>; validateVisited(): Promise>; validatePage(): Promise>; validateFull(): Promise>; } export interface IValidationResult { messages: IPropertyStatusMessage[]; } export interface IValidator { (oldModel: any, newModel: any): Promise; }