import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BusinessConfigVO, BusinessConfigForm, BusinessConfigQuery } from '@/api/system/business/businessConfig/types';

/**
 * 查询需求业务配置列表
 * @param query
 * @returns {*}
 */

export const listBusinessConfig = (query?: BusinessConfigQuery): AxiosPromise<BusinessConfigVO[]> => {
  return request({
    url: '/business/businessConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询需求业务配置详细
 * @param id
 */
export const getBusinessConfig = (id: string | number): AxiosPromise<BusinessConfigVO> => {
  return request({
    url: '/business/businessConfig/' + id,
    method: 'get'
  });
};

/**
 * 新增需求业务配置
 * @param data
 */
export const addBusinessConfig = (data: BusinessConfigForm) => {
  return request({
    url: '/business/businessConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改需求业务配置
 * @param data
 */
export const updateBusinessConfig = (data: BusinessConfigForm) => {
  return request({
    url: '/business/businessConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除需求业务配置
 * @param id
 */
export const delBusinessConfig = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/businessConfig/' + id,
    method: 'delete'
  });
};
