import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SupplieraddressVO, SupplieraddressForm, SupplieraddressQuery } from '@/api/supplierAddress/supplieraddress/types';

/**
 * 查询供应商地址列表
 * @param query
 * @returns {*}
 */

export const listSupplieraddress = (query?: SupplieraddressQuery): AxiosPromise<SupplieraddressVO[]> => {
  return request({
    url: '/supplierAddress/supplieraddress/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询供应商地址详细
 * @param id
 */
export const getSupplieraddress = (id: string | number): AxiosPromise<SupplieraddressVO> => {
  return request({
    url: '/supplierAddress/supplieraddress/' + id,
    method: 'get'
  });
};

/**
 * 新增供应商地址
 * @param data
 */
export const addSupplieraddress = (data: SupplieraddressForm) => {
  return request({
    url: '/supplierAddress/supplieraddress',
    method: 'post',
    data: data
  });
};

/**
 * 修改供应商地址
 * @param data
 */
export const updateSupplieraddress = (data: SupplieraddressForm) => {
  return request({
    url: '/supplierAddress/supplieraddress',
    method: 'put',
    data: data
  });
};

/**
 * 删除供应商地址
 * @param id
 */
export const delSupplieraddress = (id: string | number | Array<string | number>) => {
  return request({
    url: '/supplierAddress/supplieraddress/' + id,
    method: 'delete'
  });
};
