import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ConfigurationVO, ConfigurationForm, ConfigurationQuery } from '@/api/wms/configuration/types';

/**
 * 查询仓库模块配置列表
 * @param query
 * @returns {*}
 */

export const listConfiguration = (query?: ConfigurationQuery): AxiosPromise<ConfigurationVO[]> => {
  return request({
    url: '/wms/configuration/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询仓库模块配置详细
 * @param configurationId
 */
export const getConfiguration = (configurationId: string | number): AxiosPromise<ConfigurationVO> => {
  return request({
    url: '/wms/configuration/' + configurationId,
    method: 'get'
  });
};

/**
 * 新增仓库模块配置
 * @param data
 */
export const addConfiguration = (data: ConfigurationForm) => {
  return request({
    url: '/wms/configuration',
    method: 'post',
    data: data
  });
};

/**
 * 修改仓库模块配置
 * @param data
 */
export const updateConfiguration = (data: ConfigurationForm) => {
  return request({
    url: '/wms/configuration',
    method: 'put',
    data: data
  });
};

/**
 * 删除仓库模块配置
 * @param configurationId
 */
export const delConfiguration = (configurationId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/configuration/' + configurationId,
    method: 'delete'
  });
};
