import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ScoreDetailVO, ScoreDetailForm, ScoreDetailQuery } from '@/api/system/scoreDetail/types';

/**
 * 查询成绩明细列表
 * @param query
 * @returns {*}
 */

export const listScoreDetail = (query?: ScoreDetailQuery): AxiosPromise<ScoreDetailVO[]> => {
  return request({
    url: '/system/scoreDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询成绩明细详细
 * @param detailId
 */
export const getScoreDetail = (detailId: string | number): AxiosPromise<ScoreDetailVO> => {
  return request({
    url: '/system/scoreDetail/' + detailId,
    method: 'get'
  });
};

/**
 * 新增成绩明细
 * @param data
 */
export const addScoreDetail = (data: ScoreDetailForm) => {
  return request({
    url: '/system/scoreDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改成绩明细
 * @param data
 */
export const updateScoreDetail = (data: ScoreDetailForm) => {
  return request({
    url: '/system/scoreDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除成绩明细
 * @param detailId
 */
export const delScoreDetail = (detailId: string | number | Array<string | number>) => {
  return request({
    url: '/system/scoreDetail/' + detailId,
    method: 'delete'
  });
};
