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-gray-400",
                label: "Status: New",
                shouldPulse: false,
            };
        case "running":
            return {
                color: "bg-theme-secondary",
                label: "Status: Running",
                shouldPulse: true,
            };
        case "waitingForApproval":
            return {
                color: "bg-amber-500",
                label: "Status: Waiting for Approval",
                shouldPulse: false,
            };
        case "completed":
            return {
                color: "bg-green-500",
                label: "Status: Completed",
                shouldPulse: false,
            };
        case "error":
            return {
                color: "bg-red-500",
                label: "Status: Error",
                shouldPulse: false,
            };
        case "closed":
            return {
                color: "bg-gray-400",
                label: "Status: Closed",
                shouldPulse: false,
            };
        case "idle":
            return {
                color: "bg-gray-300",
                label: agent.nextRunAt ? `Status: Scheduled` : "Status: Idle",
                shouldPulse: false,
            };
        case "costLimitReached":
            return {
                color: "bg-amber-500",
                label: "Status: Cost Limit Reached",
                shouldPulse: false,
            };
        case "waitingForInput":
            return {
                color: "bg-amber-500",
                label: "Status: Waiting for Input",
                shouldPulse: false,
            };
    }
    // Default fallback - log for debugging
    console.warn("Unknown agent status:", agent.status);
    return {
        color: "bg-gray-400",
        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-amber-500",
                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-amber-500",
                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-amber-500",
                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-theme-secondary 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-green-500",
            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