import type { components } from "../api/schema"; export type WinReason = components["schemas"]["MatchFinish"]["win_reason"]; // Фиксированный порядок (сверху вниз). export const WIN_REASONS: { code: WinReason; label: string }[] = [ { code: "objectives", label: "По целям" }, { code: "worlds", label: "По мирам" }, { code: "plastic", label: "По пластику" }, { code: "resources", label: "По ресурсам" }, ]; const LABELS: Record = Object.fromEntries( WIN_REASONS.map((w) => [w.code, w.label]), ); export function winReasonLabel(code: string | null | undefined): string { return code ? LABELS[code] ?? code : "—"; }