import type { Project } from '../domain/types' /** Lightweight metadata for listing diagrams without fetching each one's * full (potentially large) data payload. */ export interface DiagramSummary { id: string name: string updatedAt: string } /** * Storage abstraction the rest of the app codes against. `LocalStorageDiagramRepository` * and `SupabaseDiagramRepository` both implement it — the store/UI layers don't need to * know or care which one is active. * * Named for the "Diagram" terminology decided in organized-ideas.md §8 (renamed from * "Project"). This is a deliberately scoped rename: only the storage layer's naming * changed here. The domain type (`Project`), the Zustand store (`useProjectStore`), and * user-facing copy still say "Project" — that's a separate, larger mechanical rename * across the whole app, tracked as its own task rather than bundled into this one. */ /** Your relationship to a diagram — who owns it, and what you personally * can do with it (organized-ideas.md §8's per-collaborator view/edit * permissions). Drives the frontend's own view-only lockdown, since RLS * silently no-ops a blocked write rather than erroring — the UI needs to * know *before* the user tries, not just fail quietly after. */ export interface DiagramAccess { ownerId: string myPermission: 'owner' | 'edit' | 'view' } export interface DiagramRepository { /** Every diagram visible to the current user, most recently updated first. */ list(): Promise /** One diagram's full data by id, or null if it doesn't exist / isn't visible. */ loadById(id: string): Promise /** Upsert a diagram, matched by the project's own id. */ save(project: Project): Promise /** Permanently delete one diagram by id. */ deleteById(id: string): Promise /** Who owns this diagram and what the current user can do with it. */ getAccess(id: string): Promise }