import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ChargeSetVO, ChargeSetForm, ChargeSetQuery } from '@/api/parameter/chargeSet/types';

/**
 * 查询收费设置列表
 * @param query
 * @returns {*}
 */

export const listSet = (query?: ChargeSetQuery): AxiosPromise<ChargeSetVO[]> => {
  return request({
    url: '/parameter/chargeSet/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询收费设置详细
 * @param chargeId
 */
export const getSet = (chargeId: string | number): AxiosPromise<ChargeSetVO> => {
  return request({
    url: '/parameter/chargeSet/' + chargeId,
    method: 'get'
  });
};

/**
 * 新增收费设置
 * @param data
 */
export const addSet = (data: ChargeSetForm) => {
  return request({
    url: '/parameter/chargeSet',
    method: 'post',
    data: data
  });
};

/**
 * 修改收费设置
 * @param data
 */
export const updateSet = (data: ChargeSetForm) => {
  return request({
    url: '/parameter/chargeSet',
    method: 'put',
    data: data
  });
};

/**
 * 删除收费设置
 * @param chargeId
 */
export const delSet = (chargeId: string | number | Array<string | number>) => {
  return request({
    url: '/parameter/chargeSet/' + chargeId,
    method: 'delete'
  });
};
