import { getNavs } from "@/plugins/utils";
import Main from "../modules/main/Main.vue";
import WorkManage from "../modules/main/WorkManage";
import WorkOverview from "../modules/main/WorkOverview";
import PaperManage from "../modules/main/PaperManage";
import ClientMonitor from "../modules/main/ClientMonitor";
import StudentManage from "../modules/main/StudentManage";
import QualityAnalysis from "../modules/main/QualityAnalysis";
import StudentScore from "../modules/main/StudentScore";
// client-set
import ClientSet from "../modules/client-set/ClientSet";
import ClientAccountSet from "../modules/client-set/ClientAccountSet";
import ClientParamSet from "../modules/client-set/ClientParamSet";
import InspectionAccountSet from "../modules/client-set/InspectionAccountSet";

// grading-set
import GradingSet from "../modules/grading-set/GradingSet";
import GradingRuleSet from "../modules/grading-set/GradingRuleSet";
import GradingLevelSet from "../modules/grading-set/GradingLevelSet";
import UploadPaper from "../modules/grading-set/UploadPaper";
// mark-set
import MarkSet from "../modules/mark-set/MarkSet";
import MarkRuleSet from "../modules/mark-set/MarkRuleSet";
import ExportPaper from "../modules/mark-set/ExportPaper";

const clientSetRoutes = [
  {
    path: "client-account-set",
    name: "ClientAccountSet",
    component: ClientAccountSet,
    meta: {
      title: "账号设置"
    }
  },
  {
    path: "client-param-set",
    name: "ClientParamSet",
    component: ClientParamSet,
    meta: {
      title: "参数设置"
    }
  },
  {
    path: "inspection-account-set",
    name: "InspectionAccountSet",
    component: InspectionAccountSet,
    meta: {
      title: "纪检账号"
    }
  }
];

const gradingSetRoutes = [
  {
    path: "grading-level-set",
    name: "GradingLevelSet",
    component: GradingLevelSet,
    meta: {
      title: "档位设置"
    }
  },
  {
    path: "grading-rule-set",
    name: "GradingRuleSet",
    component: GradingRuleSet,
    meta: {
      title: "定档规则"
    }
  },
  {
    path: "upload-paper",
    name: "UploadPaper",
    component: UploadPaper,
    meta: {
      title: "上传试题"
    }
  }
];

const markSetRoutes = [
  {
    path: "mark-rule-set",
    name: "MarkRuleSet",
    component: MarkRuleSet,
    meta: {
      title: "打分设置"
    }
  },
  {
    path: "export-paper",
    name: "ExportPaper",
    component: ExportPaper,
    meta: {
      title: "图片导出"
    }
  }
];

const mainRoutes = [
  {
    path: "work-overview",
    name: "WorkOverview",
    component: WorkOverview,
    meta: {
      title: "总览"
    }
  },
  {
    path: "paper-manage",
    name: "PaperManage",
    component: PaperManage,
    meta: {
      title: "试卷管理"
    }
  },
  {
    path: "client-monitor",
    name: "ClientMonitor",
    component: ClientMonitor,
    meta: {
      title: "设备监控"
    }
  },
  {
    path: "student-manage",
    name: "StudentManage",
    component: StudentManage,
    meta: {
      title: "考生管理"
    }
  },
  {
    path: "client-set",
    name: "ClientSet",
    component: ClientSet,
    redirect: { name: "ClientAccountSet" },
    children: clientSetRoutes,
    meta: {
      title: "采集设置"
    }
  },
  {
    path: "grading-set",
    name: "GradingSet",
    component: GradingSet,
    redirect: { name: "GradingLevelSet" },
    children: gradingSetRoutes,
    meta: {
      title: "分档设置"
    }
  },

  {
    path: "mark-set",
    name: "MarkSet",
    component: MarkSet,
    redirect: { name: "MarkRuleSet" },
    children: markSetRoutes,
    meta: {
      title: "打分设置"
    }
  },
  {
    path: "quality-analysis",
    name: "QualityAnalysis",
    component: QualityAnalysis,
    meta: {
      title: "质量分析"
    }
  },
  {
    path: "student-score",
    name: "StudentScore",
    component: StudentScore,
    meta: {
      title: "成绩查询"
    }
  }
];

export const navs = getNavs(mainRoutes);
export const clientSetNavs = getNavs(clientSetRoutes);
export const gradingSetNavs = getNavs(gradingSetRoutes);
export const markSetNavs = getNavs(markSetRoutes);

export default [
  {
    path: "/work-manage",
    name: "WorkManage",
    component: WorkManage,
    meta: {
      title: "工作"
    }
  },
  {
    path: "/main/:workId(\\d+)",
    name: "Main",
    component: Main,
    redirect: { name: "WorkOverview" },
    children: mainRoutes
  }
];
