import fetch from '@/utils/fetch'

/**
 * 【查】获取所有考试分类
 * @returns [{}]
 */
export const findAllExamClassifyApi = () =>
  fetch({ url: '/assessmentEvaluation/ExamClassify', method: 'get' })

/**
 * 【增】新增考试分类
 */
export const createExamClassifyApi = (data) =>
  fetch({ url: '/assessmentEvaluation/ExamClassify', method: 'post', data })

/**
 * 【删】删除考试分类
 */
export const deleteExamClassifyApi = (id) =>
  fetch({ url: '/assessmentEvaluation/ExamClassify/' + id, method: 'delete' })
/**
 * 【改】删除考试分类
 */
export const editExamClassifyApi = ({ id, ...data }) =>
  fetch({ url: '/assessmentEvaluation/ExamClassify/' + id, method: 'patch', data })

/**
   * 【查】分页查询考试列表
   * @param {Object} params 分页条件
   * @returns
   */
export const pagingExamListApi = (params) => fetch({ url: '/assessmentEvaluation/exam/paging', method: 'get', params })

/**
 * 【删】批量删除考试
 * @param {array} data 考试id列表
 * @returns
 */
export const batchDeleteExamApi = (data) => fetch({ url: '/assessmentEvaluation/exam', method: 'delete', data })
/**
 * 【增】新增考试
 * @param {array} data 考试信息
 * @returns
 */
export const createExamApi = (data) => fetch({ url: '/assessmentEvaluation/exam', method: 'post', data })
/**
 * 【查】根据ID查询考试详情
 * @param {array} id
 * @returns
 */
export const getExamDetailsByIdApi = (id) => fetch({ url: '/assessmentEvaluation/exam/item/' + id, method: 'get' })
/**
 * 【改】根据ID修改考试详情
 * @param {array} data
 * @returns
 */
export const patchExamDetailsByIdApi = ({ id, ...data }) => fetch({ url: '/assessmentEvaluation/exam/item/' + id, method: 'patch', data })

/**
 * 【查】查询所有老师
 * @returns
 */
export const getAllTeacher = () => fetch({ url: '/system/user/findAllTeacher', method: 'get' })
/**
 * 【查】根据用户查用户组织架构
 * @returns
 */
export const getMyOrg = () => fetch({ url: '/system/org/findOrgByUserId', method: 'get' })
/**
 * 【查】所有组织架构
 * @returns
 */
export const getAllOrg = () => fetch({ url: '/system/org', method: 'get' })
/**
 * 【查】根据组织架构查学生列表
 * @returns
 */
export const getStudentByOrgId = (orgId) => fetch({ url: '/system/user/findStudentByOrgId', method: 'get', params: { orgId } })
/**
 * 【查】根据试卷ID查所有试题 用于预览
 * @returns
 */
export const getQuestionsByPaperApi = (paperId) => fetch({ url: '/assessmentEvaluation/exampaper/questionsByPaper/' + paperId, method: 'get' })
