import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { XfCreditaccountVO, XfCreditaccountForm, XfCreditaccountQuery } from '@/api/cardCenter/report/xfCreditaccount/types';

/**
 * 查询资金收支明细列表
 * @param query
 * @returns {*}
 */
export const listXfCreditaccount = (query?: XfCreditaccountQuery): AxiosPromise<XfCreditaccountVO[]> => {
  return request({
    url: '/backstage/consumption/xfCreditaccount/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询资金收支明细详细
 * @param creditId
 */
export const getXfCreditaccount = (creditId: string | number): AxiosPromise<XfCreditaccountVO> => {
  return request({
    url: '/backstage/consumption/xfCreditaccount/' + creditId,
    method: 'get'
  });
};

/**
 * 新增资金收支明细
 * @param data
 */
export const addXfCreditaccount = (data: XfCreditaccountForm) => {
  return request({
    url: '/backstage/consumption/xfCreditaccount',
    method: 'post',
    data: data
  });
};

/**
 * 修改资金收支明细
 * @param data
 */
export const updateXfCreditaccount = (data: XfCreditaccountForm) => {
  return request({
    url: '/backstage/consumption/xfCreditaccount',
    method: 'put',
    data: data
  });
};

/**
 * 删除资金收支明细
 * @param creditId
 */
export const delXfCreditaccount = (creditId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/consumption/xfCreditaccount/' + creditId,
    method: 'delete'
  });
};
