import { firestore } from 'firebase-admin'; 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: firestore.DocumentReference; path: string; parent: ICollection; isFetched(): boolean; get(): Promise; set(nativeSnapshot: firestore.DocumentSnapshot): T; collection(coll: new () => C): ICollection; onSnapshot(onNext: (snapshot: IDocumentSnapshot) => void, onError?: (error: Error) => void): (() => void); increment(key: string, increment?: number): Promise; decrement(key: string): Promise; } export interface IDocumentRefConfig extends IFieldWithEntityConfig { } export interface IDocumentRefMeta extends IFieldWithEntityMeta { } export interface IGeoPoint { latitude: number; longitude: number; native: firestore.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 { }