import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ChrageRecordVO, ChrageRecordForm, ChrageRecordQuery } from '@/api/settlement/chargeRecord/types';

/**
 * 查询收费记录列表
 * @param query
 * @returns {*}
 */

export const listRecord = (query?: ChrageRecordQuery): AxiosPromise<ChrageRecordVO[]> => {
  return request({
    url: '/settlement/chargeRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询收费记录详细
 * @param id
 */
export const getRecord = (id: string | number): AxiosPromise<ChrageRecordVO> => {
  return request({
    url: '/settlement/chargeRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增收费记录
 * @param data
 */
export const addRecord = (data: ChrageRecordForm) => {
  return request({
    url: '/settlement/chargeRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改收费记录
 * @param data
 */
export const updateRecord = (data: ChrageRecordForm) => {
  return request({
    url: '/settlement/chargeRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除收费记录
 * @param id
 */
export const delRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/settlement/chargeRecord/' + id,
    method: 'delete'
  });
};
