import { StoredObject } from './file.interface'; /** A persisted attachment record linked to a domain record. Host owns the schema. */ export interface Attachment { id?: string; recordId: string; module?: string; key: string; url?: string | null; size: number; mime: string; originalName: string; createdBy?: string; createdAt?: Date; } export interface AttachmentLinkContext { recordId: string; module?: string; createdBy?: string; files: StoredObject[]; /** For replace (PUT/PATCH): existing attachment ids to supersede. */ replaceAttachmentIds?: string[]; } export interface AttachmentUnlinkContext { recordId?: string; ids?: string[]; module?: string; } /** * Persistence port for the Flow-B "linked upload" pattern. The package never owns your DB — * you implement this (or use a built-in store like @uploadflow/mongoose). */ export interface AttachmentStore { link(ctx: AttachmentLinkContext): Promise; replace(ctx: AttachmentLinkContext): Promise; unlink(ctx: AttachmentUnlinkContext): Promise; findByRecord(recordId: string, module?: string): Promise; findByRecords(recordIds: string[]): Promise>; }