/**
 * 应付模版-API
 */
import http from "@/http/http";
import { ActiveParams, Idparams } from "../base/BaseDataModel";
import { PayableModelParams, PayableModelDto, CostFeeSetProductIdParam } from "./payableModel";

enum Api {
    payableModelList = '/api/payableModel/list',
    getpayableModelByPId = '/api/payableModel/getModelByPId',
    add = '/api/payableModel/add',
    edit = '/api/payableModel/edit',
    delete = '/api/payableModel',
    costFeeSetProductId = '/api/costFeeSetProductId/list',
    active = '/api/payableModel/active',
}

/**
 * 应付模版查询列表
 * @param parms 
 * @returns 
 */
export const api_payableModelList = async (parms: PayableModelParams) => {
    return await http.post(Api.payableModelList, parms)
}

/**
 * 根据单号查询
 * @param parms 
 * @returns 
 */
export const api_getpayableModelByPId = async (parms: Idparams) => {
    return await http.get(Api.getpayableModelByPId, parms)
}

/**
 * 新增应付模版
 * @param parms 
 * @returns 
 */
export const api_addPayableModel = async (parms: PayableModelDto) => {
    return await http.post(Api.add, parms)
}

/**
 * 根据搜索的服务商搜索费用
 * @returns 
 */
export const api_costFeeSetProductIdList = async (param: CostFeeSetProductIdParam) => {
    return await http.post(Api.costFeeSetProductId, param)
}

/**
 * 编辑应付模版
 * @param parms 
 * @returns 
 */
export const api_editPayableModel = async (parms: PayableModelDto) => {
    return await http.post(Api.edit, parms)
}

/**
 * 删除应付模版
 * @param parms 
 * @returns 
 */
export const api_deletePayableModel = async (parms: Idparams) => {
    return await http.delete(Api.delete, parms)
}

/**
 * 应付模版是否激活
 * @param parms 
 * @returns 
 */
export const api_activePayableModel = async (parms: ActiveParams) => {
    return await http.post(Api.active, parms)
}
