import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { XfQuotaVO, XfQuotaForm, XfQuotaQuery } from '@/api/consumption/xfQuota/types';

/**
 * 查询限额管理列表
 * @param query
 * @returns {*}
 */
export const listXfQuota = (query?: XfQuotaQuery): AxiosPromise<XfQuotaVO[]> => {
  return request({
    url: '/backstage/consumption/xfQuota/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询限额管理详细
 * @param quotaId
 */
export const getXfQuota = (quotaId: string | number): AxiosPromise<XfQuotaVO> => {
  return request({
    url: '/backstage/consumption/xfQuota/' + quotaId,
    method: 'get'
  });
};

/**
 * 新增限额管理
 * @param data
 */
export const addXfQuota = (data: XfQuotaForm) => {
  return request({
    url: '/backstage/consumption/xfQuota',
    method: 'post',
    data: data
  });
};

/**
 * 修改限额管理
 * @param data
 */
export const updateXfQuota = (data: XfQuotaForm) => {
  return request({
    url: '/backstage/consumption/xfQuota',
    method: 'put',
    data: data
  });
};

/**
 * 删除限额管理
 * @param quotaId
 */
export const delXfQuota = (quotaId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/consumption/xfQuota/' + quotaId,
    method: 'delete'
  });
};
