import request from '@/utils/request'
//获取题目类型
export function getQuestioncatList(query) {
  return request({
    url: '/exam/questioncat/',
    method: 'get',
    params: query
  })
}

//新增题目类型
export function createQuestioncat(data) {
  return request({
    url: `/exam/questioncat/`,
    method: 'post',
    data
  })
}
//编辑题目类型
export function updateQuestioncat(id, data) {
    return request({
      url: `/exam/questioncat/${id}/`,
      method: 'put',
      data
    })
  }
  //删除题目类型
export function deleteQuestioncat(id) {
  return request({
    url: `/exam/questioncat/${id}/`,
    method: 'delete'
  })
}
//题目列表
export function getQuestionList(query) {
  return request({
    url: '/exam/question/',
    method: 'get',
    params: query
  })
}
//题目详情
export function getQuestionDetail(id) {
  return request({
    url: `/exam/question/${id}/`,
    method: 'get'
  })
}
//新增题目
export function createQuestion(data) {
  return request({
    url: `/exam/question/`,
    method: 'post',
    data
  })
}
//编辑题目
export function updateQuestion(id, data) {
    return request({
      url: `/exam/question/${id}/`,
      method: 'put',
      data
    })
  }
  //删除题目
export function deleteQuestion(id) {
  return request({
    url: `/exam/question/${id}/`,
    method: 'delete'
  })
}
//导入题目
export function importQuestion(data) {
  return request({
    url: `/exam/question/import/`,
    method: 'post',
    data
  })
}
//导出题目
export function exportQuestion(data) {
  return request({
    url: `/exam/question/export/`,
    method: 'get',
    params: query
  })
}
//启用题目
export function enableQuestions(data) {
  return request({
    url: `/exam/question/enable/`,
    method: 'post',
    data
  })
}
//试卷增删改查
//获取试卷
export function getPaperList(query) {
  return request({
    url: '/exam/paper/',
    method: 'get',
    params: query
  })
}
//试卷详情
export function getPaperDetail(id) {
  return request({
    url: `/exam/paper/${id}/`,
    method: 'get'
  })
}
//新增试卷
export function createPaper(data) {
  return request({
    url: `/exam/paper/`,
    method: 'post',
    data
  })
}
//编辑试卷
export function updatePaper(id, data) {
    return request({
      url: `/exam/paper/${id}/`,
      method: 'put',
      data
    })
  }
  //删除试卷
export function deletePaper(id) {
  return request({
    url: `/exam/paper/${id}/`,
    method: 'delete'
  })
}
//考试增删改查
//获取考试列表
export function getExamList(query) {
  return request({
    url: '/exam/exam/',
    method: 'get',
    params: query
  })
}
//考试详情
export function getExamDetail(id) {
  return request({
    url: `/exam/exam/${id}/`,
    method: 'get'
  })
}
//新增考试
export function createExam(data) {
  return request({
    url: `/exam/exam/`,
    method: 'post',
    data
  })
}
//编辑考试
export function updateExam(id, data) {
    return request({
      url: `/exam/exam/${id}/`,
      method: 'put',
      data
    })
  }
  //删除考试
export function deleteExam(id) {
  return request({
    url: `/exam/exam/${id}/`,
    method: 'delete'
  })
}

//考试记录增删改查
//考试记录列表和详情
export function getExamRecordList(query) {
  return request({
    url: '/exam/examrecord/',
    method: 'get',
    params: query
  })
}
//考试记录
export function getExamRecordDetail(id) {
  return request({
    url: `/exam/examrecord/${id}/`,
    method: 'get'
  })
}
//新增考试记录
export function createExamRecord(data) {
  return request({
    url: `/exam/examrecord/`,
    method: 'post',
    data
  })
}
//编辑考试记录
export function updateExamRecord(id, data) {
    return request({
      url: `/exam/examrecord/${id}/`,
      method: 'put',
      data
    })
  }
  //删除考试记录
export function deleteExamRecord(id) {
  return request({
    url: `/exam/examrecord/${id}/`,
    method: 'delete'
  })
}