import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BaseMaterialCategoryVO, BaseMaterialCategoryForm, BaseMaterialCategoryQuery } from '@/api/wms/baseMaterialCategory/types';

/**
 * 查询物料大类信息列表
 * @param query
 * @returns {*}
 */

export const listBaseMaterialCategoryInWMS = (query?: BaseMaterialCategoryQuery): AxiosPromise<BaseMaterialCategoryVO[]> => {
  return request({
    url: '/wms/baseMaterialCategory/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询物料大类信息详细
 * @param materialCategoryId
 */
export const getBaseMaterialCategoryInWMS = (materialCategoryId: string | number): AxiosPromise<BaseMaterialCategoryVO> => {
  return request({
    url: '/wms/baseMaterialCategory/' + materialCategoryId,
    method: 'get'
  });
};

/**
 * 新增物料大类信息
 * @param data
 */
export const addBaseMaterialCategoryInWMS = (data: BaseMaterialCategoryForm) => {
  return request({
    url: '/wms/baseMaterialCategory',
    method: 'post',
    data: data
  });
};

/**
 * 修改物料大类信息
 * @param data
 */
export const updateBaseMaterialCategoryInWMS = (data: BaseMaterialCategoryForm) => {
  return request({
    url: '/wms/baseMaterialCategory',
    method: 'put',
    data: data
  });
};

/**
 * 删除物料大类信息
 * @param materialCategoryId
 */
export const delBaseMaterialCategoryInWMS = (materialCategoryId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/baseMaterialCategory/' + materialCategoryId,
    method: 'delete'
  });
};


/**
 * 下拉框查询物料大类信息列表
 * @param query
 * @returns {*}
 */
export function getBaseMaterialCategoryListInWMS (query) {
    return request({
        url: '/wms/baseMaterialCategory/getBaseMaterialCategoryList',
        method: 'get',
        params: query
    });
};
