import type { CodingProblem, PublicCodingProblem } from "./types"; // --------------------------------------------------------------------------- // Strip answer keys before a problem crosses the wire to the browser. // // The reference solution, the full hidden-test set, the known review issues, // and the architecture rubric all stay server-side. The client only ever sees // what a real candidate would see: the prompt, starter/buggy code, and the // public (non-hidden) example tests. // --------------------------------------------------------------------------- export function toPublicProblem(problem: CodingProblem): PublicCodingProblem { switch (problem.type) { case "code-creation": { const { referenceSolution: _ref, tests, ...rest } = problem; void _ref; return { ...rest, tests: tests.filter((t) => !t.hidden) }; } case "debugging": { const { referenceSolution: _ref, tests, ...rest } = problem; void _ref; return { ...rest, tests: tests.filter((t) => !t.hidden) }; } case "code-review": { const { issues: _issues, ...rest } = problem; void _issues; return rest; } case "architecture": { const { rubric: _rubric, ...rest } = problem; void _rubric; return rest; } } }