import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ConfiginfoBatchForm, ConfiginfoForm, ConfiginfoId, ConfiginfoIds, ConfiginfoQuery, ConfiginfoVO } from './types';

export const listConfiginfo = (query?: ConfiginfoQuery): AxiosPromise<ConfiginfoVO[]> => {
  return request({ url: '/wcs/configinfo/list', method: 'get', params: query });
};

export const getConfiginfo = (configId: ConfiginfoId): AxiosPromise<ConfiginfoVO> => {
  return request({ url: '/wcs/configinfo/' + configId, method: 'get' });
};

export const addConfiginfo = (data: ConfiginfoForm) => {
  return request({ url: '/wcs/configinfo', method: 'post', data });
};

export const updateConfiginfo = (data: ConfiginfoForm) => {
  return request({ url: '/wcs/configinfo', method: 'put', data });
};

export const updateConfiginfoBatch = (data: ConfiginfoBatchForm[]) => {
  return request({ url: '/wcs/configinfo/batch', method: 'put', data });
};

export const delConfiginfo = (configId: ConfiginfoId | ConfiginfoIds) => {
  return request({ url: '/wcs/configinfo/' + configId, method: 'delete' });
};
