import type { AppSnapshot, ArtifactVerdict } from "../types/domain";

export function summarizeSnapshot(snapshot: AppSnapshot) {
  const useful = snapshot.recommendations.filter((entry: { verdict: ArtifactVerdict }) =>
    ["keep", "character_specific", "maybe_level"].includes(entry.verdict),
  ).length;
  const trash = snapshot.recommendations.filter((entry: { verdict: ArtifactVerdict }) => entry.verdict === "trash_candidate").length;
  const review = snapshot.recommendations.filter((entry: { verdict: ArtifactVerdict }) => entry.verdict === "needs_review").length;

  return {
    artifacts: snapshot.artifacts.length,
    useful,
    trash,
    review,
    builds: snapshot.builds.length,
  };
}
