import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WmsBaseAreaVO, WmsBaseAreaForm, WmsBaseAreaQuery } from '@/api/wms/wmsBaseArea/types';

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

export const listWmsBaseArea = (query?: WmsBaseAreaQuery): AxiosPromise<WmsBaseAreaVO[]> => {
  return request({
    url: '/wms/wmsBaseArea/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询区域基础信息详细
 * @param areaId
 */
export const getWmsBaseArea = (areaId: string | number): AxiosPromise<WmsBaseAreaVO> => {
  return request({
    url: '/wms/wmsBaseArea/' + areaId,
    method: 'get'
  });
};

/**
 * 新增区域基础信息
 * @param data
 */
export const addWmsBaseArea = (data: WmsBaseAreaForm) => {
  return request({
    url: '/wms/wmsBaseArea',
    method: 'post',
    data: data
  });
};

/**
 * 修改区域基础信息
 * @param data
 */
export const updateWmsBaseArea = (data: WmsBaseAreaForm) => {
  return request({
    url: '/wms/wmsBaseArea',
    method: 'put',
    data: data
  });
};

/**
 * 删除区域基础信息
 * @param areaId
 */
export const delWmsBaseArea = (areaId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/wmsBaseArea/' + areaId,
    method: 'delete'
  });
};


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