import type { RouteRecordRaw } from 'vue-router'
import MainLayout from '@/layout/main/index.vue'
/** 考试管理 & 数据管理 & 用户管理 */

const routes: RouteRecordRaw[] = [
  {
    name: 'Exam',
    path: '/exam',
    component: MainLayout,
    // redirect: '/exam/manage',
    meta: {
      label: '考试管理',
      menu: true,
      menuId: 'exam',
      icon: 'nav-exam',
      sort: 7,
    },
    children: [
      {
        name: 'ExamNav',
        path: '',
        component: () => import('@/modules/admin-exam/nav/index.vue'),
        meta: {
          label: '考试管理导航页',
          menu: false,
          menuId: 'exam-nav',
        },
      },
      {
        name: 'ExamMange',
        path: 'manage',
        component: () => import('@/modules/admin-exam/manage/index.vue'),
        meta: {
          label: '考试批次管理',
          menu: true,
          menuId: 'exam-manage',
          sort: 1,
        },
      },
      {
        name: 'EditExam',
        path: 'edit-exam/:id?',
        props: true,
        component: () => import('@/modules/admin-exam/edit-exam/index.vue'),
        meta: {
          label: '创建考试',
          menu: false,
          menuId: 'exam-manage-edit',
        },
      },
    ],
  },
  {
    name: 'Subject',
    path: '/subject',
    component: MainLayout,
    redirect: '/subject/manage',
    meta: {
      label: '科目管理',
      menu: true,
      menuId: 'exam-subject',
      sort: 2,
    },
    children: [
      {
        name: 'SubjectManage',
        path: 'manage',
        component: () => import('@/modules/admin-subject/manage/index.vue'),
        meta: {
          label: '科目管理',
          menu: true,
          menuId: 'exam-subject',
        },
      },
      {
        name: 'StructManage',
        path: 'struct/:id?',
        props: true,
        component: () => import('@/modules/admin-subject/struct/index.vue'),
        meta: {
          label: '试卷结构管理',
          menu: false,
          menuId: 'exam-subject-struct',
        },
      },
      {
        name: 'EditStruct',
        path: 'edit-main-question/:subjectCode/:mainNumber?',
        props: true,
        component: () => import('@/modules/admin-subject/edit-main-question/index.vue'),
        meta: {
          label: '大题编辑',
          menu: false,
          menuId: 'exam-subject-edit',
        },
      },
    ],
  },
  {
    name: 'Data',
    path: '/data',
    component: MainLayout,
    meta: {
      label: '数据管理',
      menu: true,
      menuId: 'data',
      icon: 'nav-data',
      sort: 8,
    },
    children: [
      {
        name: 'DataManage',
        path: '',
        component: () => import('@/modules/admin-data/nav/index.vue'),
      },
      {
        name: 'DataMarking',
        path: 'marking',
        component: () => import('@/modules/admin-data/marking/index.vue'),
        meta: {
          label: '导入评卷数据',
          menu: true,
          menuId: 'data-marking',
          sort: 1,
        },
      },
      {
        name: 'DataPaper',
        path: 'paper',
        component: () => import('@/modules/admin-data/paper/index.vue'),
        meta: {
          label: '导入培训卷/RF卷',
          menu: true,
          menuId: 'data-rf',
          sort: 2,
        },
      },
      {
        name: 'DataExport',
        path: 'export',
        component: () => import('@/modules/admin-data/export/index.vue'),
        meta: {
          label: 'CET成绩导出',
          menu: true,
          menuId: 'data-export',
          sort: 3,
        },
      },
      {
        name: 'DataTaskSetting',
        path: 'task-setting',
        component: () => import('@/modules/admin-data/task-setting/index.vue'),
        meta: {
          label: '任务设置',
          menu: true,
          menuId: 'data-task_setting',
          sort: 4,
        },
      },
    ],
  },
  {
    name: 'User',
    path: '/user',
    component: MainLayout,
    redirect: '/user/manage',
    meta: {
      label: '用户管理',
      menu: true,
      menuId: 'user',
      icon: 'nav-user',
      sort: 9,
    },
    children: [
      {
        name: 'UserManage',
        path: 'manage',
        component: () => import('@/modules/admin-user/manage/index.vue'),
        meta: {
          label: '用户管理',
          menu: true,
          menuId: 'user-manage',
          sort: 1,
        },
      },
      {
        name: 'EditUser',
        path: 'edit-user/:id?',
        component: () => import('@/modules/admin-user/edit-user/index.vue'),
        props: true,
        meta: {
          label: '新增用户',
          menu: false,
          menuId: 'user-manage-edit',
        },
      },
      {
        name: 'BulkAddUser',
        path: 'bulk-add-user',
        component: () => import('@/modules/admin-user/bulk-add-user/index.vue'),
        meta: {
          label: '批量新增用户',
          menu: false,
          menuId: 'user-manage-bulk_edit',
        },
      },
    ],
  },
  {
    name: 'Role',
    path: '/role',
    component: MainLayout,
    redirect: '/role/manage',
    meta: {
      label: '角色权限',
      menu: true,
      sort: 2,
      menuId: 'user-rule',
    },
    children: [
      {
        name: 'RoleManage',
        path: 'manage',
        component: () => import('@/modules/admin-role/manage/index.vue'),
        meta: {
          label: '角色权限',
          menu: true,
          menuId: 'user-rule',
        },
      },
      {
        name: 'RoleSetting',
        path: 'setting/:role?',
        props: true,
        component: () => import('@/modules/admin-role/setting/index.vue'),
        meta: {
          label: '权限设置',
          menu: false,
          menuId: 'user-rule-edit',
        },
      },
    ],
  },
]

export default routes
