import { type ValidatorFunction, type ValidatorFunctionAsync, ValidationErrors, ValidationError, type ValidationVoid } from '@zajno/common/validation'; import type { ValidationThrower } from '@zajno/common/validation/throwers'; import type { Nullable } from '@zajno/common/types/misc'; import type { IValueModel } from '@zajno/common/models/types'; export type ValueValidator = ValidatorFunction | ValidatorFunctionAsync; export type ValidationErrorsStrings = Partial, 0>>; export type ValidationConfig = { validator: ValueValidator, TErrors>; errors: ValidationErrorsStrings; }; export declare abstract class ValidatableModel implements ValidationVoid { private _validator; private _strings; private _error; protected _validateOnChange: boolean; constructor(); protected abstract get valueToValidate(): T | Readonly | null; get isValid(): boolean; get error(): Nullable; setValidationConfig(config?: ValidationConfig | ValidationThrower>): this; validateOnChange(enable?: boolean): this; protected validateOnChangeIfNeeded(): void; /** should return true-thy error code if NOT OK; otherwise if OK it will return null or zero code */ validateValue(value: T | null): Promise; validate(): Promise; getIsInvalid(): Promise; resetError(error?: Nullable): void; reset(): void; static extendWithFocus>(model: T): T & import("@zajno/common/models/types").IFocusableModel; } export declare class GenericValidatable extends ValidatableModel implements IValueModel { private readonly model; constructor(model: IValueModel); get value(): T; set value(v: T); protected get valueToValidate(): T; setValue(value: T): void; extendWithFocus(): this & import("@zajno/common/models/types").IFocusableModel; }