import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BaseWarehouseVO, BaseWarehouseForm, BaseWarehouseQuery } from '@/api/wms/baseWarehouse/types';

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

export const listBaseWarehouse = (query?: BaseWarehouseQuery): AxiosPromise<BaseWarehouseVO[]> => {
  return request({
    url: '/wms/baseWarehouse/list',
    method: 'get',
    params: query
  });
};

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

/**
 * 新增仓库基础信息
 * @param data
 */
export const addBaseWarehouse = (data: BaseWarehouseForm) => {
  return request({
    url: '/wms/baseWarehouse',
    method: 'post',
    data: data
  });
};

/**
 * 修改仓库基础信息
 * @param data
 */
export const updateBaseWarehouse = (data: BaseWarehouseForm) => {
  return request({
    url: '/wms/baseWarehouse',
    method: 'put',
    data: data
  });
};

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


/**
 * 下拉框查询仓库基础信息列表
 * @param query
 * @returns {*}
 */
export function getBaseWarehouseList (query) {
    return request({
        url: '/wms/baseWarehouse/getWmsBaseWarehouseList',
        method: 'get',
        params: query
    });
};
