export type AdminSection =
  | "overview"
  | "tasks"
  | "reports"
  | "runs"
  | "incidents"
  | "alerts"
  | "monitors"
  | "agents";

export type AdminNavItem = {
  key: AdminSection;
  label: string;
  href: string;
  icon: string;
};

export const adminNavItems: AdminNavItem[] = [
  { key: "overview", label: "平台概览", href: "/", icon: "overview" },
  { key: "tasks", label: "巡检任务", href: "/tasks", icon: "tasks" },
  { key: "reports", label: "巡检报告", href: "/reports", icon: "reports" },
  { key: "runs", label: "执行记录", href: "/runs", icon: "runs" },
  { key: "incidents", label: "综合研判", href: "/incidents", icon: "incidents" },
  { key: "alerts", label: "告警事件", href: "/alerts", icon: "alerts" },
  { key: "monitors", label: "环境监测", href: "/monitors", icon: "monitors" },
  { key: "agents", label: "Agent 节点", href: "/agents", icon: "agents" },
];

export const adminSectionMeta: Record<
  AdminSection,
  { title: string; desc: string }
> = {
  overview: {
    title: "平台概览",
    desc: "先看整体态势，再进入具体资源页完成操作。",
  },
  tasks: {
    title: "巡检任务",
    desc: "集中管理巡检对象、调度策略、执行器与步骤脚本。",
  },
  reports: {
    title: "巡检报告",
    desc: "从报告视角查看结果、截图证据与结论。",
  },
  runs: {
    title: "执行记录",
    desc: "按单次执行排障，重点查看证据、日志和失败原因。",
  },
  incidents: {
    title: "综合研判",
    desc: "将 run、alert、log 和证据聚合成可跟踪的问题对象。",
  },
  alerts: {
    title: "告警事件",
    desc: "管理环境监测告警、通知状态与人工确认流转。",
  },
  monitors: {
    title: "环境监测",
    desc: "管理基础环境目标、执行记录与监测证据。",
  },
  agents: {
    title: "Agent 节点",
    desc: "维护宿主机 Agent、生成部署包并控制节点能力开关。",
  },
};

export function getAdminSection(pathname: string): AdminSection {
  if (pathname === "/tasks") return "tasks";
  if (pathname === "/reports") return "reports";
  if (pathname === "/runs") return "runs";
  if (pathname === "/incidents") return "incidents";
  if (pathname === "/alerts") return "alerts";
  if (pathname === "/monitors") return "monitors";
  if (pathname === "/agents") return "agents";
  return "overview";
}
