import { createRouter, createWebHistory } from 'vue-router'
import Chat from "@/views/manager/Chat.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/', redirect: '/login' },
    {
      path: '/manager',
      name: 'Manager',
      component: () => import('@/views/Manager.vue'),
      redirect: '/manager/login',
      children: [
        { path: 'password', meta: { name: '修改密码' }, component: () => import('@/views/manager/Password.vue') },
        { path: 'home', meta: { name: '系统首页' }, component: () => import('@/views/manager/Home.vue') },
        { path: 'admin', meta: { name: '管理员' }, component: () => import("@/views/manager/Admin.vue") },
        { path: 'patient', meta: { name: '患者' }, component: () => import("@/views/manager/Patient.vue") },
        { path: 'doctor', meta: { name: '医生' }, component: () => import("@/views/manager/Doctor.vue") },
        { path: 'pAdmin', meta: { name: '个人信息', roles: ['admin'] }, component: () => import("@/views/manager/pAdmin.vue") },
        { path: 'pPatient', meta: { name: '个人信息', roles: ['patient'] }, component: () => import("@/views/manager/pPatient.vue") },
        { path: 'pDoctor', meta: { name: '个人信息', roles: ['doctor'] }, component: () => import("@/views/manager/pDoctor.vue") },
        { path: 'symptomRecord', meta: { name: '症状记录' }, component: () => import("@/views/manager/SymptomRecord.vue") },
        { path: 'resourceCategory', meta: { name: '资源分类管理' }, component: () => import("@/views/manager/ResourceCategory.vue") },
        { path: 'treatmentResource', meta: { name: '心理资源管理' }, component: () => import("@/views/manager/TreatmentResource.vue") },
        { path: 'resourceRecommendation', meta: { name: '心理资源推荐', roles: ['patient'] }, component: () => import("@/views/manager/ResourceRecommendation.vue") },
        { path: 'myResources', meta: { name: '我的资源' }, component: () => import("@/views/manager/MyResources.vue") },
        { path: 'aiChat', meta: { name: '智能问答' }, component: () => import("@/views/manager/AIChat.vue") },
        { path: 'symptomStatistics', meta: { name: '症状统计', roles: ['admin', 'doctor', 'patient'] }, component: () => import('@/views/manager/SymptomStatistics.vue') },
        { path: 'assessmentReports', meta: { name: '评估报告管理', roles: ['admin'] }, component: () => import('@/views/manager/AssessmentReports.vue') },
        { path: 'patientReports', meta: { name: '患者评估报告', roles: ['doctor'] }, component: () => import('@/views/manager/PatientReports.vue') },
        { path: 'myReports', meta: { name: '我的评估报告', roles: ['patient'] }, component: () => import('@/views/manager/MyReports.vue') },
        { path: 'generateReport', meta: { name: '生成评估报告', roles: ['admin', 'doctor'] }, component: () => import('@/views/manager/GenerateReport.vue') },
        { path: 'reportDetail/:id', meta: { name: '报告详情', roles: ['admin', 'doctor', 'patient'] }, component: () => import('@/views/manager/ReportDetail.vue') },
        { path: 'announcement', meta: { name: '公告管理' }, component: () => import('@/views/manager/Announcement.vue') },
        { path: 'announcementList', meta: { name: '公告列表' }, component: () => import('@/views/manager/AnnouncementList.vue') },
      ]
    },
    { path: '/login', component: () => import('@/views/Login.vue') },
    { path: '/register', component: () => import("@/views/Register.vue") },
    { path: '/404', component: () => import('@/views/404.vue') },
    { path: '/manager/chat', name: 'Chat', component: Chat },
    { path: '/:pathMatch(.*)', redirect: '/404', hidden: true }
  ]
})

export default router
