import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ResearchVO, ResearchForm, ResearchQuery } from '@/api/ygpassport/research/types';

/**
 * 查询科研列表
 * @param query
 * @returns {*}
 */

export const listResearch = (query?: ResearchQuery): AxiosPromise<ResearchVO[]> => {
  return request({
    url: '/system/research/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询科研详细
 * @param id
 */
export const getResearch = (id: string | number): AxiosPromise<ResearchVO> => {
  return request({
    url: '/system/research/' + id,
    method: 'get'
  });
};

/**
 * 新增科研
 * @param data
 */
export const addResearch = (data: ResearchForm) => {
  return request({
    url: '/system/research',
    method: 'post',
    data: data
  });
};

/**
 * 修改科研
 * @param data
 */
export const updateResearch = (data: ResearchForm) => {
  return request({
    url: '/system/research',
    method: 'put',
    data: data
  });
};

/**
 * 删除科研
 * @param id
 */
export const delResearch = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/research/' + id,
    method: 'delete'
  });
};
