import fetch from '@/utils/fetch'

/**
 * 【增】 - 评价
 *
 * @param {Object} data
 * @param {string} data.name 评价名
 * @param {string} data.appModule 应用模块
 * @returns
 */
export const createEvaluationApi = (data) =>
  fetch({ url: 'evaluation', method: 'post', data })

/**
 * 【删】 - 评价
 * @param {number} id
 * @returns
 */
export const deleteEvaluationApi = (id) =>
  fetch({ url: 'evaluation/' + id, method: 'delete' })

/**
 * 【改】 - 评价
 * @param {Object} data
 * @returns
 */
export const updateEvaluationApi = ({ id, name }) =>
  fetch({ url: 'evaluation/' + id, method: 'patch', data: { name } })

/**
 * 【查】 - 评价
 *
 * @returns
 */
export const findAllEvaluationApi = () =>
  fetch({ url: 'evaluation', method: 'get' })

/**
 * 【增】 - 评价指标
 *
 * @param {Object} data
 * @returns
 */
export const createEvaluationIndicatorApi = ({ name, evaluationId }) =>
  fetch({ url: 'evaluation/indicator', method: 'post', data: { name, evaluationId } })

/**
 * 【改】 - 评价指标
 *
 * @param {Object} data
 * @returns
 */
export const updateEvaluationIndicatorApi = ({ id, name, evaluationId }) =>
  fetch({ url: 'evaluation/indicator/' + id, method: 'patch', data: { name, evaluationId } })

/**
 * 【删】 - 评价指标
 * @param {number} id
 * @returns
 */
export const deleteEvaluationIndicatorApi = (id) =>
  fetch({ url: 'evaluation/indicator/' + id, method: 'delete' })

/**
 * 【查】 - 学生评分
 *
 * @returns
 */
export const findAllStudentEvaluationApi = (orgId) =>
  fetch({ url: 'evaluation/indicator/findAllStudentEvaluation', method: 'get', params: { orgId } })

/**
 * 【增】 - 学生评分
 *
 * @param {Object} data
 * @returns
 */
export const createStudentEvaluationScoreApi = (data) =>
  fetch({ url: 'evaluation/indicator/createStudentEvaluationScore', method: 'post', data })

/**
 * 【改】 - 学生评分
 *
 * @param {Object} data
 * @returns
 */
export const updateStudentEvaluationScoreApi = ({ id, ...data }) =>
  fetch({ url: 'evaluation/indicator/updateStudentEvaluationScore/' + id, method: 'patch', data })
