import fetch from '@/utils/fetch'

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

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

/**
 * 【删】删除试题分类
 */
export const deleteQuestionsClassifyApi = (id) =>
  fetch({ url: '/assessmentEvaluation/questionClassify/' + id, method: 'delete' })
/**
 * 【改】修改试题分类
 */
export const editQuestionsClassifyApi = ({ id, ...data }) =>
  fetch({ url: '/assessmentEvaluation/questionClassify/' + id, method: 'patch', data })

/**
 * 【查】获取所有试题列表
 */
export const pagingFindQuestionsApi = (params) =>
  fetch({ url: '/assessmentEvaluation/questions/paging', method: 'get', params })
/**
     * 【查】获取所有筛选条件选项（包含试题类型和难易程度）
     */
export const getAllQueryParamsOptionsApi = () =>
  fetch({ url: '/assessmentEvaluation/questions/queryParams', method: 'get' })
/**
     * 【查】只获取试题类型
     */
export const getQuestionTypeOptionsApi = () =>
  fetch({ url: '/assessmentEvaluation/questionType', method: 'get' })
/**
     * 【查】获取所有试题难度选项
     * @returns [{}]
     */
export const getQuestionDifficultyLevelOptionsApi = () =>
  fetch({ url: '/assessmentEvaluation/questionDifficultyLevel', method: 'get' })
/**
     * 【刪】多选删除试题
     * @param  string[] data
     */
export const deleteSomeQuestionsApi = (data) =>
  fetch({ url: '/assessmentEvaluation/questions', method: 'delete', data })
/**
     * 【查】获取所有知识点
     */
export const getAllknowledgePointApi = () =>
  fetch({ url: '/assessmentEvaluation/knowledgePoint', method: 'get' })
/**
     * 【增】新增知识点
     * @param  string name
     */
export const createKnowledgePointApi = (name) =>
  fetch({ url: '/assessmentEvaluation/knowledgePoint', method: 'post', data: { name } })
/**
     * 【删】删除知识点
     */
export const deleteKnowledgePointApi = (id) =>
  fetch({ url: '/assessmentEvaluation/knowledgePoint/' + id, method: 'delete' })
/**
     * 【增】删除知识点
     */
export const createQuestionApi = (data) =>
  fetch({ url: '/assessmentEvaluation/questions', method: 'post', data })
/**
     * 【查】根据ID查试题内容
     */
export const getQuestionByIdApi = (id) =>
  fetch({ url: '/assessmentEvaluation/questions/item/' + id, method: 'get' })
/**
     * 【改】修改试题
     */
export const patchQuestionByIdApi = ({ id, ...data }) =>
  fetch({ url: '/assessmentEvaluation/questions/item/' + id, method: 'patch', data })
/**
     * 【改】修改试题
     */
export const studentCanUseApi = ({ id, ...data }) =>
  fetch({ url: '/assessmentEvaluation/questions/item/studentCanUse/' + id, method: 'patch', data })

/**
 * 【查】根据类型查试题总数
 * @param {number} type 类型ID
 * @returns 总数
 */
export const getQuestionCountByTypeIdApi = (params) =>
  fetch({ url: '/assessmentEvaluation/questions/count', method: 'get', params })
/**
 * 【查】随机抽提
 */
export const getRandQuestionApi = (params) =>
  fetch({ url: '/assessmentEvaluation/questions/random', method: 'get', params })

export const importQuestionsApi = (classifyId, data) =>
  fetch({ url: '/assessmentEvaluation/questions/import/' + classifyId, method: 'post', data })

/**
 * 【查】导出试题
 */
export const exportQuestionsApi = (classifyId) =>
  fetch({ url: '/assessmentEvaluation/questions/export/' + classifyId, method: 'get' })
