import { DocumentReference, GeoPoint } from "firebase/firestore"; import { FieldTypes } from "./enum.types"; import { _ICollection, IEntity, _IDocumentSnapshot } from "./collection.types"; export interface IFieldConfig { name?: string; } export interface IFieldMeta { name: string; type: FieldTypes; isArray: boolean; serialize: (...values: any) => any; deserialize: (value: any) => any; toData: (value: any) => any; } export interface IFieldWithEntityConfig extends IFieldConfig { entity: new () => IEntity; } export interface IFieldWithEntityMeta extends IFieldMeta { entity: new () => IEntity; } export interface IDocumentRef { id: string; cached: T | null; native: DocumentReference; path: string; parent: _ICollection; isFetched(): boolean; get(): Promise; collection(coll: new () => C): _ICollection; onSnapshot(onNext: (snapshot: _IDocumentSnapshot) => void, onError?: (error: Error) => void): () => void; } export interface IDocumentRefConfig extends IFieldWithEntityConfig { } export interface IDocumentRefMeta extends IFieldWithEntityMeta { } export interface IGeoPoint { latitude: number; longitude: number; native: GeoPoint; isEqual: (other: IGeoPoint) => boolean; } export interface IGeoPointConfig extends IFieldConfig { } export interface IGeoPointMeta extends IFieldMeta { } export interface IFieldMapConfig extends IFieldConfig { entity?: new () => any; } export interface IFieldMapMeta extends IFieldWithEntityMeta { }