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

/**
 * 查询收入费用设定列表
 * @param query
 * @returns {*}
 */

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

/**
 * 查询收入费用设定详细
 * @param id
 */
export const getRevenueExpense = (id: string | number): AxiosPromise<RevenueExpenseVO> => {
  return request({
    url: '/system/revenueExpense/' + id,
    method: 'get'
  });
};

/**
 * 新增收入费用设定
 * @param data
 */
export const addRevenueExpense = (data: RevenueExpenseForm) => {
  return request({
    url: '/system/revenueExpense',
    method: 'post',
    data: data
  });
};

/**
 * 修改收入费用设定
 * @param data
 */
export const updateRevenueExpense = (data: RevenueExpenseForm) => {
  return request({
    url: '/system/revenueExpense',
    method: 'put',
    data: data
  });
};

/**
 * 删除收入费用设定
 * @param id
 */
export const delRevenueExpense = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/revenueExpense/' + id,
    method: 'delete'
  });
};
export function changeStatus(id: string | number, isShow: string) {
  const data = {
    id,
    isShow
  };
  return request({
    url: '/system/revenueExpense/changeStatus',
    method: 'put',
    data: data
  });
}
