import { type FirestoreDocument, type FirestoreSingleDocumentAccessor, type SingleItemFirestoreCollectionDocumentIdentifierRef } from '../accessor/document'; import { type FirestoreCollectionWithParent, type FirestoreCollectionWithParentConfig } from './subcollection'; /** * Configuration for a subcollection that focuses on a single document within a parent document. * * This configuration extends FirestoreCollectionWithParentConfig with an optional * specification for a single document identifier. It combines the hierarchical relationship * of subcollections with the focused access of single document collections. * * @template T - The data type of the subcollection document * @template PT - The data type of the parent document * @template D - The document type for the subcollection document, defaults to FirestoreDocument * @template PD - The document type for the parent document, defaults to FirestoreDocument */ export interface SingleItemFirestoreCollectionConfig = FirestoreDocument, PD extends FirestoreDocument = FirestoreDocument> extends FirestoreCollectionWithParentConfig, Partial { } /** * A subcollection that provides specialized accessors for working with a single document * within a parent document context. * * Backs the `'singleton-sub'` collection kind: one document per parent. * Created at runtime via `firestoreContext.singleItemFirestoreCollection({...})` * and typed at the model layer as `FirestoreCollection = SingleItemFirestoreCollection`. * * For multi-item subcollections under the same parent, use * {@link FirestoreCollectionWithParent} (kind `'sub-collection'`) instead. * * This interface combines the capabilities of FirestoreCollectionWithParent (which maintains * the parent-child relationship) with FirestoreSingleDocumentAccessor (which provides * convenient methods for working with a specific document). This allows for direct access * to a known document within the subcollection without needing to specify its ID in each call. * * @template T - The data type of the subcollection document * @template PT - The data type of the parent document * @template D - The document type for the subcollection document, defaults to FirestoreDocument * @template PD - The document type for the parent document, defaults to FirestoreDocument */ export interface SingleItemFirestoreCollection = FirestoreDocument, PD extends FirestoreDocument = FirestoreDocument> extends FirestoreCollectionWithParent, FirestoreSingleDocumentAccessor { } /** * Creates a subcollection that focuses on a single document within a parent document context. * * This factory function creates a subcollection with specialized accessors for working with * a specific document. It combines the hierarchical relationship of parent-child documents * with the convenience of direct access to a single, known document in the subcollection. * * @template T - The data type of the subcollection document * @template PT - The data type of the parent document * @template D - The document type for the subcollection document, defaults to FirestoreDocument * @template PD - The document type for the parent document, defaults to FirestoreDocument * @param config - Configuration for the single document subcollection * @returns A subcollection instance with specialized accessors for the single document */ export declare function makeSingleItemFirestoreCollection = FirestoreDocument, PD extends FirestoreDocument = FirestoreDocument>(config: SingleItemFirestoreCollectionConfig): SingleItemFirestoreCollection;