import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RevenueExpenseVO, RevenueExpenseForm, RevenueExpenseQuery } from '@/api/company/revenueExpense/types';

export const listRevenueExpense = (query?: RevenueExpenseQuery): AxiosPromise<RevenueExpenseVO[]> => {
  return request({
    url: '/company/revenueExpense/list',
    method: 'get',
    params: query
  });
};

export const getRevenueExpense = (id: string | number): AxiosPromise<RevenueExpenseVO> => {
  return request({
    url: '/company/revenueExpense/' + id,
    method: 'get'
  });
};

export const addRevenueExpense = (data: RevenueExpenseForm) => {
  return request({
    url: '/company/revenueExpense',
    method: 'post',
    data
  });
};

export const updateRevenueExpense = (data: RevenueExpenseForm) => {
  return request({
    url: '/company/revenueExpense',
    method: 'put',
    data
  });
};

export const delRevenueExpense = (id: string | number | Array<string | number>) => {
  return request({
    url: '/company/revenueExpense/' + id,
    method: 'delete'
  });
};
