import type { LegacyRunController } from "./legacy-run/legacyRunController";
import { LegacyAllocationStage } from "./legacy-run/LegacyAllocationStage";
import { LegacySummaryStage } from "./legacy-run/LegacySummaryStage";
import { LegacyTalentDraftStage } from "./legacy-run/LegacyTalentDraftStage";
import { LegacyTrajectoryStage } from "./legacy-run/LegacyTrajectoryStage";

interface LegacyRunPanelProps {
  session: LegacyRunController;
}

function renderLegacyRunStage(session: LegacyRunController) {
  switch (session.stage) {
    case "loading":
      return (
        <div className="empty-block">Booting the original data pack...</div>
      );
    case "talent":
      return <LegacyTalentDraftStage session={session} />;
    case "property":
      return <LegacyAllocationStage session={session} />;
    case "trajectory":
      return <LegacyTrajectoryStage session={session} />;
    case "summary":
      return <LegacySummaryStage session={session} />;
  }
}

export function LegacyRunPanel({ session }: LegacyRunPanelProps) {
  return (
    <>
      <div className="panel-head">
        <h2>Run</h2>
        <p>
          The flow mirrors the original game: draft talents, allocate points,
          step through the timeline, then keep one inheritance talent for the
          next run.
        </p>
      </div>
      {renderLegacyRunStage(session)}
    </>
  );
}
