import Login from "@/views/login/index.vue";
import RouterViewWrapper from "@/components/layout/RouterViewWrapper.vue";

// 静态路由
export const constantRoutes = [
  { path: "/", redirect: "/login" },
  {
    path: "/login",
    name: "Login",
    component: Login,
    meta: { title: "登录", layout: false, role: "public" },
  },

  // ========== 医院端（顶部菜单布局） ==========
  {
    path: "/hospital",
    component: RouterViewWrapper,
    redirect: "/hospital/workbench",
    meta: { title: "医院端", layoutType: "hospital", role: "Hospital" },
    children: [
      {
        path: "workbench",
        name: "HospitalWorkbench",
        component: () => import("@/views/hospital/workbench.vue"),
        meta: { title: "我的工作台", icon: "DataLine" },
      },
      {
        path: "orders",
        name: "HospitalOrders",
        component: () => import("@/views/hospital/orders/list.vue"),
        meta: { title: "我的工单", icon: "Document" },
      },
      {
        path: "orders/detail/:id",
        name: "HospitalOrderDetail",
        component: () => import("@/views/hospital/orders/detail.vue"),
        meta: { title: "工单详情", hidden: true },
      },
      {
        path: "orders/quick",
        name: "HospitalOrderQuick",
        component: () => import("@/views/hospital/orders/quick.vue"),
        meta: { title: "快速提交", icon: "EditPen" },
      },
      {
        path: "points",
        name: "HospitalPoints",
        component: () => import("@/views/hospital/points.vue"),
        meta: { title: "我的积分", icon: "Coin" },
      },
      {
        path: "password",
        name: "HospitalPassword",
        component: () => import("@/views/hospital/password.vue"),
        meta: { title: "修改密码", hidden: true },
      },
    ],
  },

  // ========== 管理端（侧边栏布局） ==========
  {
    path: "/admin",
    component: RouterViewWrapper,
    redirect: "/admin/orders",
    meta: { title: "管理端", layoutType: "admin", role: "Admin" },
    children: [
      // 工单管理 → 服务工单
      {
        path: "orders",
        name: "AdminOrders",
        component: () => import("@/views/admin/orders/list.vue"),
        meta: { title: "服务工单", icon: "Tickets", group: "工单管理" },
      },
      // 工单管理 → 服务报告
      // {
      //   path: "orders/report",
      //   name: "AdminOrderReport",
      //   component: () => import("@/views/admin/orders/report.vue"),
      //   meta: { title: "服务报告", icon: "DataAnalysis", group: "工单管理" },
      // },
      {
        path: "orders/detail/:id",
        name: "AdminOrderDetail",
        component: () => import("@/views/admin/orders/detail.vue"),
        meta: { title: "工单详情", hidden: true },
      },
      {
        path: "orders/process/:id",
        name: "AdminOrderProcess",
        component: () => import("@/views/admin/orders/process.vue"),
        meta: { title: "处理工单", hidden: true },
      },
      // 客户管理 → 医院信息
      {
        path: "hospitals",
        name: "AdminHospitals",
        component: () => import("@/views/admin/hospitals/list.vue"),
        meta: { title: "医院信息", icon: "OfficeBuilding", group: "客户管理" },
      },
      // 客户管理 → 客户服务
      // {
      //   path: "hospitals/service",
      //   name: "AdminHospitalService",
      //   component: () => import("@/views/admin/hospitals/service.vue"),
      //   meta: { title: "客户服务", icon: "Service", group: "客户管理" },
      // },
      {
        path: "hospitals/detail/:id",
        name: "AdminHospitalDetail",
        component: () => import("@/views/admin/hospitals/detail.vue"),
        meta: { title: "医院详情", hidden: true },
      },
      {
        path: "hospitals/edit/:id?",
        name: "AdminHospitalEdit",
        component: () => import("@/views/admin/hospitals/edit.vue"),
        meta: { title: "编辑医院", hidden: true },
      },
      // 绩效管理 → 客户经理积分
      {
        path: "performance/score",
        name: "AdminPerformanceScore",
        component: () => import("@/views/admin/performance/score.vue"),
        meta: { title: "客户经理积分", icon: "Trophy", group: "绩效管理" },
      },
      // 绩效管理 → 客户分级和积分
      // {
      //   path: "grades",
      //   name: "AdminGrades",
      //   component: () => import("@/views/admin/grades.vue"),
      //   meta: { title: "客户分级和积分", icon: "Medal", group: "绩效管理" },
      // },
      // 系统管理 → 账号管理
      {
        path: "accounts",
        name: "AdminAccounts",
        component: () => import("@/views/admin/accounts/list.vue"),
        meta: { title: "账号管理", icon: "UserFilled", group: "系统管理" },
      },
      {
        path: "accounts/edit/:id?",
        name: "AdminAccountEdit",
        component: () => import("@/views/admin/accounts/edit.vue"),
        meta: { title: "编辑账号", hidden: true },
      },
      {
        path: "password",
        name: "AdminPassword",
        component: () => import("@/views/admin/password.vue"),
        meta: { title: "修改密码", hidden: true },
      },
    ],
  },

  { path: "/:pathMatch(.*)*", redirect: "/login" },
];
