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

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

export const adminNavItems: AdminNavItem[] = [
  { key: "overview", label: "平台概览", href: "/", desc: "先看整体状态与关键入口" },
  { key: "tasks", label: "巡检任务", href: "/tasks", desc: "管理网站巡检任务、步骤与调度" },
  { key: "reports", label: "巡检报告", href: "/reports", desc: "按日期查看报告、截图与结论" },
  { key: "runs", label: "执行记录", href: "/runs", desc: "定位单次执行、证据与失败原因" },
  { key: "alerts", label: "告警事件", href: "/alerts", desc: "汇总监测异常、日志分析结果与通知状态" },
  { key: "monitors", label: "环境监测", href: "/monitors", desc: "接入 Redis、MQ、ES、Java 与 HTTP 目标" },
  { key: "agents", label: "Agent 节点", href: "/agents", desc: "部署节点、验证在线并控制监测能力" },
];

export const adminSectionMeta: Record<
  AdminSection,
  { title: string; desc: string }
> = {
  overview: {
    title: "平台概览",
    desc: "先看整体态势，再进入具体资源页完成操作。",
  },
  tasks: {
    title: "巡检任务",
    desc: "集中管理巡检对象、调度策略、执行器与步骤脚本。",
  },
  reports: {
    title: "巡检报告",
    desc: "从报告视角查看结果、截图证据与结论。",
  },
  runs: {
    title: "执行记录",
    desc: "按单次执行排障，重点查看证据、日志和失败原因。",
  },
  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 === "/alerts") return "alerts";
  if (pathname === "/monitors") return "monitors";
  if (pathname === "/agents") return "agents";
  return "overview";
}
