/** Project inception (milestone 297): what a project was decided to inherit. */ import { apiGet, apiPost } from "@/api/client"; import type { ProjectPlatform } from "@/api/platforms"; export interface InceptionChoices { design_system_id: number | null; seed_systems: boolean; /** Platform slugs (milestone 463). null = not answered; a list is the * whole answer — members left out of it are recorded as "not this". * Absent on records decided before the question existed. */ platforms?: string[] | null; } export interface InceptionRecord { decided_at: string; decided_by: number | null; via: "mcp" | "ui" | "legacy"; choices: InceptionChoices; } export interface InceptionDefaults { design_system_id: number | null; design_systems: { id: number; title: string }[]; systems: number; platforms: { slug: string; name: string }[]; /** What detection (or an earlier answer) already says about the project. */ project_platforms: ProjectPlatform[]; } export interface InceptionDecision { project_id: number; inception: InceptionRecord; effects: { design_system_id: number | null; systems_seeded: string[]; /** The project's answers after the decision; null when left unstated. */ platforms: ProjectPlatform[] | null; }; } export const emptyChoices = (): InceptionChoices => ({ design_system_id: null, seed_systems: false, platforms: null, }); export const fetchInceptionDefaults = (projectId: number) => apiGet(`/api/projects/${projectId}/inception/defaults`); export const decideInception = (projectId: number, choices: InceptionChoices) => apiPost(`/api/projects/${projectId}/inception`, { choices });