import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ArchivesGoVO, ArchivesGoForm, ArchivesGoQuery } from '@/api/ygpassport/archivesGo/types';

/**
 * 查询档案去向列表
 * @param query
 * @returns {*}
 */

export const listArchivesGo = (query?: ArchivesGoQuery): AxiosPromise<ArchivesGoVO[]> => {
  return request({
    url: '/ygpassport/archivesGo/listNew',
    method: 'get',
    params: query
  });
};

/**
 * 查询档案去向详细
 * @param id
 */
export const getArchivesGo = (id: string | number): AxiosPromise<ArchivesGoVO> => {
  return request({
    url: '/ygpassport/archivesGo/' + id,
    method: 'get'
  });
};

/**
 * 新增档案去向
 * @param data
 */
export const addArchivesGo = (data: ArchivesGoForm) => {
  return request({
    url: '/ygpassport/archivesGo',
    method: 'post',
    data: data
  });
};

/**
 * 修改档案去向
 * @param data
 */
export const updateArchivesGo = (data: ArchivesGoForm) => {
  return request({
    url: '/ygpassport/archivesGo',
    method: 'put',
    data: data
  });
};

/**
 * 删除档案去向
 * @param id
 */
export const delArchivesGo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/ygpassport/archivesGo/' + id,
    method: 'delete'
  });
};
