import type { AppSnapshot, Recommendation } from "../../../types/domain";
import type { Artifact, Character } from "../../../types/domain";

export interface TriageViewModel {
  artifactCount: number;
  panelEyebrow: string;
  panelTitle: string;
  artifactCountLabel: string;
  recommendationByArtifact: Map<string, Recommendation>;
}

interface UseTriageViewModelInput {
  snapshot: AppSnapshot;
}

export function useTriageViewModel({ snapshot }: UseTriageViewModelInput): TriageViewModel {
  const recommendationByArtifact = new Map(snapshot.recommendations.map((entry) => [entry.artifactId, entry]));
  const artifactCount = snapshot.artifacts.length;

  return {
    artifactCount,
    panelEyebrow: "Artifact triage",
    panelTitle: "No-brainer decisions",
    artifactCountLabel: `${artifactCount} scanned pieces`,
    recommendationByArtifact,
  };
}
