import { DocumentSnapshot } from "firebase/firestore"; import { _ICollection, WriteTypes } from "../types"; import Entity from "../Entity"; interface ISerializedResult { id?: string; [key: string]: any; } /** * Class to help with serialization between [[Entity]] objects and firestore documents. */ export default class FirestoreSerializer { /** * Serializes an [[Entity]] to an object which can be inserted into firestore. * @param entity Our representation of the entity. */ static serialize(entity: T, writeType: WriteTypes): ISerializedResult; /** * Deserializes a firestore document into an [[Entity]]. * @param doc The firestore document. * @param Model The [[Entity]] class to create an instance of. */ static deserialize(doc: DocumentSnapshot, Model: new () => T, parentCollection: _ICollection): T; } export {};