import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PartaddressVO, PartaddressForm, PartaddressQuery } from '@/api/order/partaddress/types';

/**
 * 查询伙伴商地址列表
 * @param query
 * @returns {*}
 */

export const listPartaddress = (query?: PartaddressQuery): AxiosPromise<PartaddressVO[]> => {
  return request({
    url: '/customer/partaddress/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询伙伴商地址详细
 * @param id
 */
export const getPartaddress = (id: string | number): AxiosPromise<PartaddressVO> => {
  return request({
    url: '/customer/partaddress/' + id,
    method: 'get'
  });
};

/**
 * 新增伙伴商地址
 * @param data
 */
export const addPartaddress = (data: PartaddressForm) => {
  return request({
    url: '/customer/partaddress',
    method: 'post',
    data: data
  });
};

/**
 * 修改伙伴商地址
 * @param data
 */
export const updatePartaddress = (data: PartaddressForm) => {
  return request({
    url: '/customer/partaddress',
    method: 'put',
    data: data
  });
};

/**
 * 删除伙伴商地址
 * @param id
 */
export const delPartaddress = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/partaddress/' + id,
    method: 'delete'
  });
};
