import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ScholarshipVO, ScholarshipForm, ScholarshipQuery } from '@/api/ygpassport/scholarship/types';

/**
 * 查询奖学金获评记录列表
 * @param query
 * @returns {*}
 */

export const listScholarship = (query?: ScholarshipQuery): AxiosPromise<ScholarshipVO[]> => {
  return request({
    url: '/ygpassport/scholarship/listNew',
    method: 'get',
    params: query
  });
};

/**
 * 查询奖学金获评记录详细
 * @param id
 */
export const getScholarship = (id: string | number): AxiosPromise<ScholarshipVO> => {
  return request({
    url: '/ygpassport/scholarship/' + id,
    method: 'get'
  });
};

/**
 * 新增奖学金获评记录
 * @param data
 */
export const addScholarship = (data: ScholarshipForm) => {
  return request({
    url: '/ygpassport/scholarship',
    method: 'post',
    data: data
  });
};

/**
 * 修改奖学金获评记录
 * @param data
 */
export const updateScholarship = (data: ScholarshipForm) => {
  return request({
    url: '/ygpassport/scholarship',
    method: 'put',
    data: data
  });
};

/**
 * 删除奖学金获评记录
 * @param id
 */
export const delScholarship = (id: string | number | Array<string | number>) => {
  return request({
    url: '/ygpassport/scholarship/' + id,
    method: 'delete'
  });
};
