import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ExpenseTypeVO, ExpenseTypeForm, ExpenseTypeQuery } from '@/api/customer/expenseType/types';

/**
 * 查询客户费用类型列表
 * @param query
 * @returns {*}
 */

export const listExpenseType = (query?: ExpenseTypeQuery): AxiosPromise<ExpenseTypeVO[]> => {
  return request({
    url: '/customer/expenseType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询客户费用类型详细
 * @param id
 */
export const getExpenseType = (id: string | number): AxiosPromise<ExpenseTypeVO> => {
  return request({
    url: '/customer/expenseType/' + id,
    method: 'get'
  });
};

/**
 * 新增客户费用类型
 * @param data
 */
export const addExpenseType = (data: ExpenseTypeForm) => {
  return request({
    url: '/customer/expenseType',
    method: 'post',
    data: data
  });
};

/**
 * 修改客户费用类型
 * @param data
 */
export const updateExpenseType = (data: ExpenseTypeForm) => {
  return request({
    url: '/customer/expenseType',
    method: 'put',
    data: data
  });
};

/**
 * 删除客户费用类型
 * @param id
 */
export const delExpenseType = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/expenseType/' + id,
    method: 'delete'
  });
};
