import { ComputedRef, Ref } from 'vue'; import { UseExperimentSaveOptions } from './useExperimentSave'; import { BioTemplateEnvelope, TemplateCollection, TemplateCollectionEnvelope } from '../templates'; export type TemplateCollectionInput = TemplateCollectionEnvelope | BioTemplateEnvelope | Array>; export interface UseTemplateCollectionOptions extends UseExperimentSaveOptions { /** Initial template collection or factory; defaults to an empty collection. */ initial?: TemplateCollectionInput | (() => TemplateCollectionInput); } export interface UseTemplateCollectionReturn { /** Current experiment id from platform injection, URL query, or URL path. */ currentExperimentId: ComputedRef; /** Whether a current experiment id is available. */ hasCurrentExperiment: ComputedRef; /** Full template collection envelope ready to save into design_data. */ templateCollection: Ref; /** Template map keyed by template_id. */ templates: ComputedRef; /** Collection-level metadata, or an empty object. */ metadata: ComputedRef>; /** Template ids currently present in the collection. */ templateIds: ComputedRef; /** Whether the collection contains at least one template. */ hasTemplates: ComputedRef; /** Whether a load or delete operation is in progress. */ isLoading: Ref; /** Whether a save operation is in progress. */ isSaving: Ref; /** Error message from the last failed operation, or null. */ error: Ref; /** Timestamp of the last successful load, or null. */ lastLoadedAt: Ref; /** Timestamp of the last successful save, or null. */ lastSavedAt: Ref; /** Replace local state from a template envelope, collection envelope, or raw design_data. */ apply: (value: unknown, metadata?: Record) => TemplateCollectionEnvelope; /** Reset local state to the configured initial collection. */ reset: () => TemplateCollectionEnvelope; /** Add or replace one template in the local collection. */ setTemplate: (template: BioTemplateEnvelope) => TemplateCollectionEnvelope; /** Remove one template from the local collection. */ removeTemplate: (templateId: string) => boolean; /** Read one template from the local collection, returning null when missing. */ getTemplate: = BioTemplateEnvelope>(templateId: string) => TTemplate | null; /** Read one template from the local collection, throwing when missing or mismatched. */ requireTemplate: = BioTemplateEnvelope>(templateId: string) => TTemplate; /** Load template design_data for an experiment and apply it locally. */ load: (experimentId: number) => Promise; /** Load template design_data for the current experiment and apply it locally. */ loadCurrent: () => Promise; /** Save the local template collection as experiment design_data. */ save: (experimentId: number) => Promise; /** Save the local template collection as current experiment design_data. */ saveCurrent: () => Promise; /** Require and return the current experiment id, or throw when missing. */ requireCurrentExperimentId: () => number; } /** * Manages a biology template collection in the current experiment's design_data. * * @deprecated Scheduled for removal in MINT 1.4; no SDK replacement. */ export declare function useTemplateCollection(options?: UseTemplateCollectionOptions): UseTemplateCollectionReturn;