const prefix = "/eval";

import {axios} from "@/requests/axios.config";

function getTeacherEvalExams({pageSize, pageNum, state}){
  return axios.get(`${prefix}/exam/teacher`, {
    // pageSize、pageNum非必需，state必需，"0 所有， 1 未开始，2 进行中，3 已结束"
    params:{pageSize, pageNum, state}});
}

function getStudentEvalExams() {
  return axios.get(`${prefix}/exam/student`);
}

function getStudentEvalExamsGroupByCourse(){
  return axios.get(`${prefix}/exam/student/groupByCourse`);
}

function getRecommendEvalExams() {
  return axios.get(`${prefix}/exam/recommend`);
}

function getRecommendEvalExamsGroupByCourse(){
  return axios.get(`${prefix}/exam/recommend/groupByCourse`);
}

function getTeacherEvalExamsByCourseId(courseId) {
  return axios.get(`${prefix}/exam/teacher/course`, {
    params: {
      courseId,
    }
  });
}

function getStudentEvalExamsByCourseId(courseId){
  return axios.get(`${prefix}/exam/student/course`, {
    params: {
      courseId,
    }
  });
}

function getTeacherEvalExamsGroupByCourse() {
  return axios.get(`${prefix}/exam/teacher/groupByCourse`);
}

const evalAPIs = {
  getTeacherEvalExams,
  getTeacherEvalExamsGroupByCourse,
  getStudentEvalExams,
  getStudentEvalExamsGroupByCourse,
  getRecommendEvalExams,
  getRecommendEvalExamsGroupByCourse,
  getTeacherEvalExamsByCourseId,
  getStudentEvalExamsByCourseId,
};

export default evalAPIs;