export type RunTaskView = {
  id: string;
  nodeId: string;
  nodeName: string;
  status: string;
  assetIds?: string[];
  artifactIds?: string[];
  durationMs?: number;
  summaryLabel?: string;
  errorMessage?: string;
  stdoutLines?: string[];
  stderrLines?: string[];
  canRetry?: boolean;
  logLines: string[];
};

export function renderRunGraphView(tasks: RunTaskView[]): string {
  const nodes = tasks
    .map(
      (task) => `
        <article data-task-id="${task.id}">
          <strong>${task.nodeName}</strong>
          <span data-status="${task.status}">${task.status}</span>
        </article>
      `,
    )
    .join("");

  return `<section data-view="run-graph-view">${nodes}</section>`;
}
