// ContentTypeRegistry — the central manifest for AutoViral content types.
//
// ADR-006 (the keystone of PRD-0002 v0.1.1). Before this, the distinction
// between the two content types radiated as 34 hard-coded type-literal string
// branches across server + web: `workType !== "..."` comparisons, a
// hand-maintained `DELIVERABLES` list, route ternaries, and per-type create
// buttons. Adding a third type was shotgun surgery across 5+ files.
//
// This registry collapses that to a single central Record of manifests. Each
// manifest fully describes a content type: its i18n label keys, its single
// deliverable yaml (= its single checkpoint target), its viewer route, its
// shared zod schema, and a pure blank-doc seed factory. Consumers query the
// registry (`getContentType` / `listContentTypes`) instead of branching on
// the literal.
//
// PURE DATA + PURE FUNCTIONS ONLY (ADR-006 Decision #4): no `fs`, no
// `node:path`, no server-only imports. This is what makes the registry safe
// to import from the web bundle (via the @shared alias) AND unit-testable in
// isolation. NO runtime auto-discovery (Decision #5) — a hard-coded central
// Record of two entries; full plugin discovery is deferred to 0.2.0.
import { CompositionSchema, makeEmptyComposition } from "../composition.js";
import { CarouselSchema, makeEmptyCarousel } from "../carousel.js";
/**
 * The closed set of content type ids AutoViral ships. The registry OWNS this
 * — `WorkType` derives from it, and `src/domain/work-store.ts` re-exports the
 * union for back-compat. `src/shared` must NOT import from `src/domain`; the
 * dependency points the other way.
 *
 * This is a standalone tuple (not `keyof typeof CONTENT_TYPES`) to break the
 * type cycle: `ContentTypeManifest.id` needs `WorkType`, and `CONTENT_TYPES`
 * is checked against `ContentTypeManifest` — deriving the union from the
 * record keys would reference the record in its own type annotation. The
 * `satisfies` on CONTENT_TYPES still guarantees its keys exactly match.
 */
export const WORK_TYPE_IDS = ["short-video", "image-text"];
/**
 * The central Record. Two entries (the video + carousel types). The insertion
 * order here is the canonical order `listContentTypes()` returns, and the
 * order `DELIVERABLES` derives in. Add a third type by adding one entry here.
 */
export const CONTENT_TYPES = {
    "short-video": {
        id: "short-video",
        labelKey: "works.type.video",
        coverAltKey: "works.coverAltVideo",
        deliverableFile: "composition.yaml",
        routePath: (workId) => `/studio/${workId}`,
        schema: CompositionSchema,
        seedFactory: (workId) => makeEmptyComposition({ workId }),
    },
    "image-text": {
        id: "image-text",
        labelKey: "works.type.image",
        coverAltKey: "works.coverAltImage",
        deliverableFile: "carousel.yaml",
        routePath: (workId) => `/editor/${workId}`,
        schema: CarouselSchema,
        seedFactory: (workId) => makeEmptyCarousel(workId),
    },
};
/** Look up a content type's manifest by id. */
export function getContentType(id) {
    return CONTENT_TYPES[id];
}
/** All registered manifests, in canonical insertion order. */
export function listContentTypes() {
    return Object.values(CONTENT_TYPES);
}
/** True iff `id` is a known content type. Narrows `string` → `WorkType` at
 *  trust boundaries (HTTP body, yaml read) where the value isn't yet typed. */
export function isWorkType(id) {
    return id in CONTENT_TYPES;
}
//# sourceMappingURL=registry.js.map