import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WarehouseInventoryVO, WarehouseInventoryForm, WarehouseInventoryQuery } from '@/api/product/warehouseInventory/types';

/**
 * 查询仓库库存明细列表
 * @param query
 * @returns {*}
 */

export const listWarehouseInventory = (query?: WarehouseInventoryQuery): AxiosPromise<WarehouseInventoryVO[]> => {
  return request({
    url: '/product/warehouseInventory/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询仓库库存明细详细
 * @param id
 */
export const getWarehouseInventory = (id: string | number): AxiosPromise<WarehouseInventoryVO> => {
  return request({
    url: '/product/warehouseInventory/' + id,
    method: 'get'
  });
};

/**
 * 新增仓库库存明细
 * @param data
 */
export const addWarehouseInventory = (data: WarehouseInventoryForm) => {
  return request({
    url: '/product/warehouseInventory',
    method: 'post',
    data: data
  });
};

/**
 * 修改仓库库存明细
 * @param data
 */
export const updateWarehouseInventory = (data: WarehouseInventoryForm) => {
  return request({
    url: '/product/warehouseInventory',
    method: 'put',
    data: data
  });
};

/**
 * 删除仓库库存明细
 * @param id
 */
export const delWarehouseInventory = (id: string | number | Array<string | number>) => {
  return request({
    url: '/product/warehouseInventory/' + id,
    method: 'delete'
  });
};
