import type { Permission } from "@/modules/core/types";

export type NavIconKey =
  | "alerts"
  | "audit"
  | "beds"
  | "care"
  | "dashboard"
  | "devices"
  | "emergency"
  | "global"
  | "health"
  | "notices"
  | "organizations"
  | "roles"
  | "status"
  | "users";

export type NavItem = {
  href: string;
  label: string;
  icon: NavIconKey;
  permission?: Permission;
};

export type NavGroup = {
  label: string;
  items: NavItem[];
};

export const navGroups: NavGroup[] = [
  {
    label: "运营",
    items: [
      {
        href: "/app/dashboard",
        label: "运营看板",
        icon: "dashboard",
      },
      {
        href: "/app/elders",
        label: "老人档案",
        icon: "users",
      },
      {
        href: "/app/beds",
        label: "床位房间",
        icon: "beds",
      },
      {
        href: "/app/health",
        label: "健康照护",
        icon: "health",
      },
      {
        href: "/app/care",
        label: "护理服务",
        icon: "care",
      },
      {
        href: "/app/emergency",
        label: "安全应急",
        icon: "emergency",
      },
    ],
  },
  {
    label: "协同",
    items: [
      {
        href: "/app/devices",
        label: "设备运维",
        icon: "devices",
      },
      {
        href: "/app/notices",
        label: "公告通知",
        icon: "notices",
      },
      {
        href: "/app/alerts",
        label: "规则预警",
        icon: "alerts",
      },
      {
        href: "/app/family",
        label: "家属服务",
        icon: "devices",
      },
    ],
  },
  {
    label: "系统设置",
    items: [
      {
        href: "/app/settings/global",
        label: "全局配置",
        icon: "global",
        permission: "platform:manage",
      },
      {
        href: "/app/settings/organizations",
        label: "机构管理",
        icon: "organizations",
        permission: "organization:read",
      },
      {
        href: "/app/settings/users",
        label: "用户管理",
        icon: "users",
        permission: "account:read",
      },
      {
        href: "/app/settings/roles",
        label: "角色权限",
        icon: "roles",
        permission: "role:read",
      },
      {
        href: "/app/settings/audit",
        label: "审计日志",
        icon: "audit",
        permission: "audit:read",
      },
      {
        href: "/app/settings/status",
        label: "运行状态",
        icon: "status",
        permission: "incident:read",
      },
    ],
  },
];

export const navItems: NavItem[] = navGroups.flatMap((group) => group.items);
