import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WarehouseInfoForm, WarehouseInfoQuery, WarehouseInfoVO } from '@/api/wms/warehouseInfo/types';

/**
 * 查询仓库信息列表
 * @param query
 * @returns {*}
 */

export const listWarehouseInfo = (query?: WarehouseInfoQuery): AxiosPromise<WarehouseInfoVO[]> => {
  return request({
    url: '/wms/warehouseInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询仓库信息详细
 * @param warehouseId
 */
export const getWarehouseInfo = (warehouseId: string | number): AxiosPromise<WarehouseInfoVO> => {
  return request({
    url: '/wms/warehouseInfo/' + warehouseId,
    method: 'get'
  });
};

/**
 * 新增仓库信息
 * @param data
 */
export const addWarehouseInfo = (data: WarehouseInfoForm) => {
  return request({
    url: '/wms/warehouseInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改仓库信息
 * @param data
 */
export const updateWarehouseInfo = (data: WarehouseInfoForm) => {
  return request({
    url: '/wms/warehouseInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除仓库信息
 * @param warehouseId
 */
export const delWarehouseInfo = (warehouseId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/warehouseInfo/' + warehouseId,
    method: 'delete'
  });
};

/**
 * 下拉框查询仓库信息列表
 * @param query
 * @returns {*}
 */
export function getWmsWarehouseInfoList(query?: WarehouseInfoQuery) {
  return request({
    url: '/wms/warehouseInfo/getWmsWarehouseInfoList',
    method: 'get',
    params: query
  });
}
