import type { CatalogSubmission } from './SubmissionRepository' /** One entry in a usage-impact sample — never raw diagram content, just * enough to identify it (see organized-ideas.md §3's impact-check). */ export interface UsageImpactSample { id: string name: string ownerUsername: string } export interface UsageImpact { /** Total diagrams referencing this entity — not capped, unlike `sample`. */ diagramCount: number /** Up to 5 of the most recently updated referencing diagrams. */ sample: UsageImpactSample[] } /** Storage abstraction for the Admin's-eye view of the catalog submission * queue — mirrors SubmissionRepository's role for the submitter's-eye * view. Every method here relies on the caller actually being an Admin; * RLS (and, for the impact function, an explicit is_admin() check) is the * real enforcement, not this interface. */ export interface AdminSubmissionRepository { /** Every submission across all users, most recent first. */ listAll(): Promise /** Approves a submission: writes its proposed_data onto the live row at * entity_id — promoting it to public in place if it wasn't already — * and marks the submission approved. Same id throughout; never creates * a duplicate public row (organized-ideas.md §3). */ approve(submission: CatalogSubmission): Promise /** Rejects a submission with a reason the submitter will see. */ reject(id: string, reason: string): Promise /** How many diagrams reference this entity, and a small sample — see * organized-ideas.md §3's impact-check-before-editing. */ getUsageImpact(entityType: CatalogSubmission['entityType'], entityId: string): Promise /** Submitter username per submission id, for the ones a username could * be resolved for (batched — one round trip for a whole queue listing). */ getSubmitterUsernames(submissionIds: string[]): Promise> }