import { jsx as _jsx } from "react/jsx-runtime";
import { cn } from "../../lib/utils";
import { CountBadge } from "../../components/ui/badge";
export function getAgentStatusConfig(agent) {
    switch (agent.status) {
        case "new":
            return {
                color: "bg-neutral-grey-50",
                label: "Status: New",
                shouldPulse: false,
            };
        case "running":
            return {
                color: "bg-highlight-100",
                label: "Status: Running",
                shouldPulse: true,
            };
        case "waitingForApproval":
            return {
                color: "bg-feedback-orange",
                label: "Status: Waiting for Approval",
                shouldPulse: false,
            };
        case "completed":
            return {
                color: "bg-feedback-green",
                label: "Status: Completed",
                shouldPulse: false,
            };
        case "error":
            return {
                color: "bg-feedback-red",
                label: "Status: Error",
                shouldPulse: false,
            };
        case "closed":
            return {
                color: "bg-neutral-grey-50",
                label: "Status: Closed",
                shouldPulse: false,
            };
        case "idle":
            return {
                color: "bg-neutral-grey-10",
                label: agent.nextRunAt ? `Status: Scheduled` : "Status: Idle",
                shouldPulse: false,
            };
        case "costLimitReached":
            return {
                color: "bg-feedback-orange",
                label: "Status: Cost Limit Reached",
                shouldPulse: false,
            };
        case "waitingForInput":
            return {
                color: "bg-feedback-orange",
                label: "Status: Waiting for Input",
                shouldPulse: false,
            };
    }
    // Default fallback - log for debugging
    console.warn("Unknown agent status:", agent.status);
    return {
        color: "bg-neutral-grey-50",
        label: `Status: Unknown (${agent.status})`,
        shouldPulse: false,
    };
}
/**
 * Badge that overlays on the agent icon to show status
 * Always displays the total number of active agents with color-coded status:
 * - Amber: Agents waiting for approval or cost limit reached (highest priority)
 * - Blue (pulsing): Agents actively running
 * - Green: Other active agents
 */
export function AgentStatusBadge({ status, className }) {
    // No activity - don't show anything
    if (!status.hasActivity) {
        return null;
    }
    const getBadgeConfig = () => {
        // Waiting for input takes highest priority (most urgent - user action required)
        if (status.waitingForInput > 0) {
            return {
                baseClasses: "-right-2 -top-2",
                title: `${status.waitingForInput} agent${status.waitingForInput > 1 ? "s" : ""} waiting for input (${status.total} total active)`,
            };
        }
        // Waiting for approval - also requires user action
        if (status.waitingForApproval > 0) {
            return {
                baseClasses: "-right-2 -top-2",
                title: `${status.waitingForApproval} agent${status.waitingForApproval > 1 ? "s" : ""} waiting for approval (${status.total} total active)`,
            };
        }
        // Cost limit reached - also requires user action
        if (status.costLimitReached > 0) {
            return {
                baseClasses: "-right-2 -top-2",
                title: `${status.costLimitReached} agent${status.costLimitReached > 1 ? "s" : ""} cost limit reached (${status.total} total active)`,
            };
        }
        // Running agents - show count with pulsing indicator
        if (status.running > 0) {
            return {
                baseClasses: "-right-2 -top-2",
                title: `${status.running} agent${status.running > 1 ? "s" : ""} running (${status.total} total active)`,
                shouldPulse: true,
            };
        }
        // Other active agents - show count
        return {
            baseClasses: "-right-2 -top-2",
            title: `${status.total} active agent${status.total > 1 ? "s" : ""}`,
        };
    };
    const config = getBadgeConfig();
    return (_jsx(CountBadge, { className: cn("absolute min-w-3", config.baseClasses, config.shouldPulse && "animate-pulse", className), title: config.title, children: status.total }));
}
//# sourceMappingURL=AgentStatusBadge.js.map