import { normalizeTaskStatus } from "./taskStatus";
function buildExecutionDisplay(options) {
    const { taskStatus, executionState, isBlocked = false } = options;
    const normalizedTaskStatus = normalizeTaskStatus(taskStatus, executionState);
    if (normalizedTaskStatus === "Done" || executionState === "Done") {
        return null;
    }
    if (isBlocked &&
        normalizedTaskStatus !== "Waiting" &&
        executionState !== "Waiting") {
        return null;
    }
    if (executionState === "Waiting" || normalizedTaskStatus === "Waiting") {
        return {
            label: "Waiting",
            variant: "outline",
            className: "border-amber-200 bg-amber-50 text-amber-800",
            showSpinner: false,
            needsAttention: false,
        };
    }
    if (executionState === "Working") {
        return {
            label: "Working",
            variant: "default",
            showSpinner: true,
            needsAttention: false,
        };
    }
    if (executionState === "WaitingForApproval" || normalizedTaskStatus === "Review") {
        return {
            label: "Awaiting approval",
            variant: "outline",
            className: "border-amber-300 bg-amber-50 text-amber-700",
            showSpinner: false,
            needsAttention: true,
        };
    }
    switch (executionState) {
        case "Unassigned":
            return {
                label: "Unassigned",
                variant: "outline",
                className: "border-slate-300 bg-slate-50 text-slate-700",
                showSpinner: false,
                needsAttention: false,
            };
        case "AgentNotStarted":
            return {
                label: "Not started",
                variant: "outline",
                className: "border-slate-300 bg-slate-50 text-slate-700",
                showSpinner: false,
                needsAttention: false,
            };
        case "WaitingForDependency":
            return {
                label: "Blocked",
                variant: "outline",
                className: "border-amber-300 bg-amber-50 text-amber-700",
                showSpinner: false,
                needsAttention: true,
            };
        case "WaitingForToolApproval":
            return {
                label: "Awaiting tool approval",
                variant: "outline",
                className: "border-amber-300 bg-amber-50 text-amber-700",
                showSpinner: false,
                needsAttention: true,
            };
        case "Questions":
            return {
                label: "Questions",
                variant: "outline",
                className: "border-amber-300 bg-amber-50 text-amber-700",
                showSpinner: false,
                needsAttention: true,
            };
        case "WaitingForInput":
            return {
                label: "Waiting for input",
                variant: "outline",
                className: "border-amber-300 bg-amber-50 text-amber-700",
                showSpinner: false,
                needsAttention: true,
            };
        case "WaitingForUser":
            return {
                label: "Waiting for user",
                variant: "outline",
                className: "border-amber-300 bg-amber-50 text-amber-700",
                showSpinner: false,
                needsAttention: true,
            };
        case "WaitingForCapacity":
            return {
                label: "Waiting for capacity",
                variant: "outline",
                className: "border-slate-300 bg-slate-50 text-slate-700",
                showSpinner: false,
                needsAttention: false,
            };
        case "WaitingForBudget":
            return {
                label: "Budget exceeded",
                variant: "outline",
                className: "border-amber-300 bg-amber-50 text-amber-700",
                showSpinner: false,
                needsAttention: true,
            };
        case "AgentError":
            return {
                label: "Agent error",
                variant: "outline",
                className: "border-red-300 bg-red-50 text-red-700",
                showSpinner: false,
                needsAttention: true,
            };
        default:
            return {
                label: "Idle",
                variant: "outline",
                showSpinner: false,
                needsAttention: false,
            };
    }
}
export function getTaskExecutionDisplay(record) {
    if (!record) {
        return {
            label: "Idle",
            variant: "outline",
            showSpinner: false,
            needsAttention: false,
        };
    }
    return buildExecutionDisplay({
        taskStatus: record.taskStatus,
        executionState: record.executionState,
    });
}
export function getTaskExecutionDisplayFromTask(options) {
    return buildExecutionDisplay(options);
}
//# sourceMappingURL=taskExecutionStatus.js.map