/**
 * 账单主体-API
 */
import http from "@/http/http";
import { UploadFileParams } from "@/types/utils";
import { AddEditBillMainParams, BillMainRecount, BillMainSummaryParams } from "./billMainModle";
enum Api {
    getBillMainList = '/api/billmain/list',
    add = '/api/billmain/add',
    edit = '/api/billmain/edit',
    delete = '/api/billmain',
    getupLoadApi = "/api/billmain/upLoad",
    billDetail = "/api/billDetail/list",//总数
    billDetailPage = "/api/billDetail/pageList",//分页
    billMainRecount = "/api/billmain/recount",//重算
    billMainDetailExport = "/api/billDetail/download",//明细导出
    billMainPageSummary = "/api/billDetail/pageSummaryList",//汇总
    billMainDownloadSummary = "/api/billDetail/downloadSummary",//汇总导出 
    addRecord = "/api/billmain/addRecord",
    downloadBillShare = '/api/fileModel/downloadBillShare',//账单分摊模版
}

//查询列表
export const getBillMainListApi = async (parms: Recordable) => {
    return await http.get(Api.getBillMainList, parms)
}

//新增
export const addBillMainApi = async (parms: AddEditBillMainParams) => {
    return await http.post(Api.add, parms)
}
//编辑
export const editBillMainApi = async (parms: AddEditBillMainParams) => {
    return await http.put(Api.edit, parms)
}
//删除
export const deleteBillMainApi = async (parms: Recordable) => {
    return await http.delete(Api.delete, parms)
}

// 上传文件
export const uploadApi = async (params: UploadFileParams) => {
    return await http.uploadFile(Api.getupLoadApi, params);
}

// 查看明细列表
export const getBillMainDetailListApi = async (parms: Recordable) => {
    return await http.post(Api.billDetail, parms)
}

// 查看明细列表-分页
export const getBillMainDetailPageListApi = async (parms: Recordable) => {
    return await http.post(Api.billDetailPage, parms)
}

// 重算
export const getBillMainRecountListApi = async (parms: BillMainRecount) => {
    return await http.post(Api.billMainRecount, parms)
}

// 导出具体文件
export const getBillMainDetailExportApi = async (parms: Recordable) => {
    return await http.download(Api.billMainDetailExport, parms)
}

// 查看账单分摊主体
export const getBillMainPageSummaryListApi = async (parms: BillMainSummaryParams) => {
    return await http.post(Api.billMainPageSummary, parms)
}

// 汇总导出
export const getBillMainDownloadSummaryApi = async (parms: Recordable) => {
    return await http.download(Api.billMainDownloadSummary, parms)
}

// 补录
export const addRecordBillMainApi = async (parms: AddEditBillMainParams) => {
    return await http.post(Api.addRecord, parms)
}

// 导出xlsx文件模版
export const api_DownloadBillShare = async (parms: Recordable) => {
    return await http.download(Api.downloadBillShare, parms)
}