import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ErpSupplierInfoVO, ErpSupplierInfoForm, ErpSupplierInfoQuery } from '@/api/supplier/erpSupplierInfo/types';

/**
 * 查询erp供应商信息列表
 * @param query
 * @returns {*}
 */

export const listErpSupplierInfo = (query?: ErpSupplierInfoQuery): AxiosPromise<ErpSupplierInfoVO[]> => {
  return request({
    url: '/customer/erpSupplierInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询erp供应商信息详细
 * @param id
 */
export const getErpSupplierInfo = (id: string | number): AxiosPromise<ErpSupplierInfoVO> => {
  return request({
    url: '/customer/erpSupplierInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增erp供应商信息
 * @param data
 */
export const addErpSupplierInfo = (data: ErpSupplierInfoForm) => {
  return request({
    url: '/customer/erpSupplierInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改erp供应商信息
 * @param data
 */
export const updateErpSupplierInfo = (data: ErpSupplierInfoForm) => {
  return request({
    url: '/customer/erpSupplierInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除erp供应商信息
 * @param id
 */
export const delErpSupplierInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/erpSupplierInfo/' + id,
    method: 'delete'
  });
};
