import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { XfQuotatermVO, XfQuotatermForm, XfQuotatermQuery } from '@/api/consumption/xfQuotaterm/types';

/**
 * 查询限额设备绑定列表
 * @param query
 * @returns {*}
 */
export const listXfQuotaterm = (query?: XfQuotatermQuery): AxiosPromise<XfQuotatermVO[]> => {
  return request({
    url: '/backstage/consumption/xfQuotaterm/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询限额设备绑定详细
 * @param quotaTermId
 */
export const getXfQuotaterm = (quotaTermId: string | number): AxiosPromise<XfQuotatermVO> => {
  return request({
    url: '/backstage/consumption/xfQuotaterm/' + quotaTermId,
    method: 'get'
  });
};

/**
 * 新增限额设备绑定
 * @param data
 */
export const addXfQuotaterm = (data: XfQuotatermForm) => {
  return request({
    url: '/backstage/consumption/xfQuotaterm',
    method: 'post',
    data: data
  });
};

/**
 * 批量新增限额设备
 * @param data
 */
export const batchAddTerm = (data: number[]) => {
  return request({
    url: '/backstage/consumption/xfQuotaterm/batchAdd',
    method: 'post',
    data: data
  });
};

/**
 * 修改限额设备绑定
 * @param data
 */
export const updateXfQuotaterm = (data: XfQuotatermForm) => {
  return request({
    url: '/backstage/consumption/xfQuotaterm',
    method: 'put',
    data: data
  });
};

/**
 * 删除限额设备绑定
 * @param quotaTermId
 */
export const delXfQuotaterm = (quotaTermId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/consumption/xfQuotaterm/' + quotaTermId,
    method: 'delete'
  });
};
