package com.jwipc.sys.constant;

import com.alibaba.fastjson2.JSONObject;
import com.dtflys.forest.annotation.*;
import com.dtflys.forest.converter.json.GsonEncoder;
import com.jwipc.api.dto.ErpApiResult;
import com.jwipc.log.annotation.ApiOperateLog;
import com.jwipc.log.constant.ApiDirection;
import com.jwipc.log.constant.ThirdSysType;
import com.jwipc.sys.dto.FinancialShareApiResultDTO;
import com.jwipc.sys.dto.PaymentImportToOpenResultDTO;

/**
 * <p>
 *  财务共享系统接口
 * </p>
 *
 * @author Chen Tianshi
 * @since 2025/12/8 17:16
 */
@BaseRequest(baseURL = "#{sys.kingdee.financial-share.host}")
public interface FinancialShareClient {
    /**
     * 合同审批申请单新增接口
     */
    @Post(
            url = "/kapi/v2/m4p4/em/er_contractbill/contract_applicaion_bill_create",
            contentType = "application/json; charset=UTF-8"
    )
    @ApiOperateLog(
            code = "createContractApplicationBill",
            name = "合同审批申请单新增接口",
            direction = ApiDirection.SRM_TO_OTHER,
            thirdSysType = ThirdSysType.SHARE
    )
    FinancialShareApiResultDTO createContractApplicationBill(@Query("access_token") String token, @Body JSONObject body);

    @GsonEncoder
    @Post(value = "#{sys.kingdee.financial-share.host}/kapi/v2/m4p4/ap/ap_payapply/ap_payapply_save")
    @ApiOperateLog(code = "contractPayImportToOpen", name = "SRM资产合同付款信息提交共享系统", direction = ApiDirection.SRM_TO_OTHER,
            thirdSysType = ThirdSysType.ERP)
    ErpApiResult<PaymentImportToOpenResultDTO> contractPayImportToOpen(@Header("accessToken") String accessToken, @JSONBody Object supplierPayImportDTO);


    /**
     * 合同创建到共享接口
     */
    @Post(url = "/kapi/v2/m4p4/fa/m4p4_fa_contractreview/contractReviewSave", contentType = "application/json; charset=UTF-8"
    )
    @ApiOperateLog(
            code = "submitContractToFinance",
            name = "合同创建单推送共享接口",
            direction = ApiDirection.SRM_TO_OTHER,
            thirdSysType = ThirdSysType.SHARE
    )
    FinancialShareApiResultDTO submitContractToFinance(@Header("access_token") String token, @Body JSONObject body);
    @Post(
            url = "/kapi/v2/m4p4/fa/m4p4_receipt_bill/saveReceiptBill",
            contentType = "application/json; charset=UTF-8"
    )
    @ApiOperateLog(
            code = "createContractDelivery",
            name = "合同交货单创建",
            direction = ApiDirection.SRM_TO_OTHER,
            thirdSysType = ThirdSysType.SHARE
    )
    FinancialShareApiResultDTO createContractDelivery(@Query("access_token") String token, @Body JSONObject body);


}
