import Dictionary from '../types/Dictionary'; import { BaseClass } from '../utils/BaseClass'; import { Field } from '../fields/Field'; import { PrimaryKey } from '../types/models/ModelManager'; /** * BaseModel class */ export declare class BaseModel extends BaseClass { /** * Field definitions for current model * e.g: * {id: new UUIDField(), name: new CharField()} */ protected static fieldsDef: Dictionary; /** * Flag whether model has be registered or not */ private static __modelRegistered; /** * Getter to simulate static class property with fixed inheritance */ protected static get _modelRegistered(): boolean; /** * Setter to simulate static class property with fixed inheritance */ protected static set _modelRegistered(v: boolean); /** * Model data */ protected _data: Dictionary; /** * Bound field objects of model */ protected _fields: Dictionary; /** * Constructor * @param data Model data */ constructor(data?: Dictionary); /** * Data containing values */ get data(): Dictionary; set data(value: Dictionary); /** * Bound dictionary of fields by field name */ get fields(): Dictionary; /** * Getter with values to return data of model * Can be accessed as object (e.g. for field name 'description': val.description) */ get val(): Dictionary; /** * Return primary key of model instance or null if not set */ get pk(): PrimaryKey | null; /** * Return unbound static field by name. * Throws NotDeclaredFieldException if field name is not in fields */ static getField(fieldName: string): Field; /** * Return field by name. * Throws NotDeclaredFieldException if field name is not in fields */ getField(fieldName: string): Field; /** * Return primary key field or null of no primary key field exists */ getPrimaryKeyField(): Field | null; /** * Bind fields from fieldsDef to _fields */ protected _bindFields(): void; /** * Register model to perform unique actions */ static register(): boolean; }