import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InternshipsVO, InternshipsForm, InternshipsQuery } from '@/api/ygpassport/internships/types';

/**
 * 查询实习情况列表
 * @param query
 * @returns {*}
 */

export const listInternships = (query?: InternshipsQuery): AxiosPromise<InternshipsVO[]> => {
  return request({
    url: '/ygpassport/internships/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询实习情况详细
 * @param id
 */
export const getInternships = (id: string | number): AxiosPromise<InternshipsVO> => {
  return request({
    url: '/ygpassport/internships/' + id,
    method: 'get'
  });
};

/**
 * 新增实习情况
 * @param data
 */
export const addInternships = (data: InternshipsForm) => {
  return request({
    url: '/ygpassport/internships',
    method: 'post',
    data: data
  });
};

/**
 * 修改实习情况
 * @param data
 */
export const updateInternships = (data: InternshipsForm) => {
  return request({
    url: '/ygpassport/internships',
    method: 'put',
    data: data
  });
};

/**
 * 删除实习情况
 * @param id
 */
export const delInternships = (id: string | number | Array<string | number>) => {
  return request({
    url: '/ygpassport/internships/' + id,
    method: 'delete'
  });
};
