import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { XfConsumedetailVO, XfConsumedetailForm, XfConsumedetailQuery } from '@/api/consumption/report/xfConsumedetail/types';

/**
 * 查询消费明细列表
 * @param query
 * @returns {*}
 */
export const listXfConsumedetail = (query?: XfConsumedetailQuery): AxiosPromise<XfConsumedetailVO[]> => {
  return request({
    url: '/backstage/consumption/xfConsumeDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询消费明细详细
 * @param consumeId
 */
export const getXfConsumedetail = (consumeId: string | number): AxiosPromise<XfConsumedetailVO> => {
  return request({
    url: '/backstage/consumption/xfConsumeDetail/' + consumeId,
    method: 'get'
  });
};

/**
 * 新增消费明细
 * @param data
 */
export const addXfConsumedetail = (data: XfConsumedetailForm) => {
  return request({
    url: '/backstage/consumption/xfConsumeDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改消费明细
 * @param data
 */
export const updateXfConsumedetail = (data: XfConsumedetailForm) => {
  return request({
    url: '/backstage/consumption/xfConsumeDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除消费明细
 * @param consumeId
 */
export const delXfConsumedetail = (consumeId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/consumption/xfConsumeDetail/' + consumeId,
    method: 'delete'
  });
};
