import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SettlementVO, SettlementForm, SettlementQuery } from '@/api/system/settlement/types';

/**
 * 查询结算管理列表
 * @param query
 * @returns {*}
 */

export const listSettlement = (query?: SettlementQuery): AxiosPromise<SettlementVO[]> => {
  return request({
    url: '/system/settlement/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询结算管理详细
 * @param id
 */
export const getSettlement = (id: string | number): AxiosPromise<SettlementVO> => {
  return request({
    url: '/system/settlement/' + id,
    method: 'get'
  });
};

/**
 * 新增结算管理
 * @param data
 */
export const addSettlement = (data: SettlementForm) => {
  return request({
    url: '/system/settlement',
    method: 'post',
    data: data
  });
};

/**
 * 修改结算管理
 * @param data
 */
export const updateSettlement = (data: SettlementForm) => {
  return request({
    url: '/system/settlement',
    method: 'put',
    data: data
  });
};

/**
 * 删除结算管理
 * @param id
 */
export const delSettlement = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/settlement/' + id,
    method: 'delete'
  });
};
