import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WmsBaseCustomerVO, WmsBaseCustomerForm, WmsBaseCustomerQuery } from '@/api/wms/wmsBaseCustomer/types';

/**
 * 查询客户基础信息列表
 * @param query
 * @returns {*}
 */

export const listWmsBaseCustomer = (query?: WmsBaseCustomerQuery): AxiosPromise<WmsBaseCustomerVO[]> => {
  return request({
    url: '/wms/wmsBaseCustomer/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询客户基础信息详细
 * @param customerId
 */
export const getWmsBaseCustomer = (customerId: string | number): AxiosPromise<WmsBaseCustomerVO> => {
  return request({
    url: '/wms/wmsBaseCustomer/' + customerId,
    method: 'get'
  });
};

/**
 * 新增客户基础信息
 * @param data
 */
export const addWmsBaseCustomer = (data: WmsBaseCustomerForm) => {
  return request({
    url: '/wms/wmsBaseCustomer',
    method: 'post',
    data: data
  });
};

/**
 * 修改客户基础信息
 * @param data
 */
export const updateWmsBaseCustomer = (data: WmsBaseCustomerForm) => {
  return request({
    url: '/wms/wmsBaseCustomer',
    method: 'put',
    data: data
  });
};

/**
 * 删除客户基础信息
 * @param customerId
 */
export const delWmsBaseCustomer = (customerId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/wmsBaseCustomer/' + customerId,
    method: 'delete'
  });
};


/**
 * 下拉框查询客户基础信息列表
 * @param query
 * @returns {*}
 */
export function getWmsBaseCustomerList (query) {
    return request({
        url: '/wms/wmsBaseCustomer/getWmsBaseCustomerList',
        method: 'get',
        params: query
    });
};
