import { PipelinePhaseGroup, type DetailAgentInfo } from "./PipelinePhaseGroup";
import type { SerializedTask } from "@/components/TaskRow";

interface PipelineStageColumnProps {
  phases: Array<{
    id: string;
    name: string;
    status: string;
  }>;
  tasksByPhase: Record<string, SerializedTask[]>;
  taskDepsByPhase: Record<string, Array<{ taskId: string; dependsOn: string[] }>>;
  blockedPhaseIds: Set<string>;
  detailAgentByPhase?: Map<string, DetailAgentInfo>;
}

export function PipelineStageColumn({ phases, tasksByPhase, taskDepsByPhase, blockedPhaseIds, detailAgentByPhase }: PipelineStageColumnProps) {
  return (
    <div className="flex w-72 shrink-0 flex-col gap-3">
      {phases.map((phase) => (
        <PipelinePhaseGroup
          key={phase.id}
          phase={phase}
          tasks={tasksByPhase[phase.id] ?? []}
          taskDepsRaw={taskDepsByPhase[phase.id] ?? []}
          isBlocked={blockedPhaseIds.has(phase.id)}
          detailAgent={detailAgentByPhase?.get(phase.id) ?? null}
        />
      ))}
    </div>
  );
}
