import { jsx as _jsx } from "react/jsx-runtime";
import { cn } from "../../lib/utils";
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",
                bgColor: "bg-feedback-orange",
                title: `${status.waitingForInput} agent${status.waitingForInput > 1 ? "s" : ""} waiting for input (${status.total} total active)`,
                content: _jsx("span", { className: "text-[8px] font-bold", children: status.total }),
            };
        }
        // Waiting for approval - also requires user action
        if (status.waitingForApproval > 0) {
            return {
                baseClasses: "-right-2 -top-2",
                bgColor: "bg-feedback-orange",
                title: `${status.waitingForApproval} agent${status.waitingForApproval > 1 ? "s" : ""} waiting for approval (${status.total} total active)`,
                content: _jsx("span", { className: "text-[8px] font-bold", children: status.total }),
            };
        }
        // Cost limit reached - also requires user action
        if (status.costLimitReached > 0) {
            return {
                baseClasses: "-right-2 -top-2",
                bgColor: "bg-feedback-orange",
                title: `${status.costLimitReached} agent${status.costLimitReached > 1 ? "s" : ""} cost limit reached (${status.total} total active)`,
                content: _jsx("span", { className: "text-[8px] font-bold", children: status.total }),
            };
        }
        // Running agents - show count with pulsing indicator
        if (status.running > 0) {
            return {
                baseClasses: "-right-2 -top-2",
                bgColor: "bg-highlight-100 animate-pulse",
                title: `${status.running} agent${status.running > 1 ? "s" : ""} running (${status.total} total active)`,
                content: _jsx("span", { className: "text-[8px] font-bold", children: status.total }),
            };
        }
        // Other active agents - show count
        return {
            baseClasses: "-right-2 -top-2",
            bgColor: "bg-feedback-green",
            title: `${status.total} active agent${status.total > 1 ? "s" : ""}`,
            content: _jsx("span", { className: "text-[8px] font-bold", children: status.total }),
        };
    };
    const config = getBadgeConfig();
    return (_jsx("div", { className: cn("absolute flex h-3 w-3 items-center justify-center rounded-full text-white shadow-md ring-1 ring-white", config.baseClasses, config.bgColor, className), title: config.title, children: config.content }));
}
//# sourceMappingURL=AgentStatusBadge.js.map