package com.sckw.transport.api.feign;

import com.sckw.core.web.response.BaseResult;
import com.sckw.transport.api.model.param.ParkingWalletFeeFreezeParam;
import com.sckw.transport.api.model.vo.ParkingWalletFeeFreezeResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;

/**
 * 服务费钱包远程调用 Feign 客户端。
 *
 * @author system
 */
@FeignClient(name = "sckw-ng-transport", contextId = "parkingWalletFeeFeignService")
public interface ParkingWalletFeeFeignService {

    /**
     * 交易订单下单时应用收费策略并冻结服务费余额。
     *
     * @param param 冻结参数
     * @return 收费策略应用结果
     */
    @PostMapping("/parking/wallet/remote/apply-charge-strategy-freeze")
    BaseResult<ParkingWalletFeeFreezeResult> applyChargeStrategyFreeze(@RequestBody @Validated ParkingWalletFeeFreezeParam param);

    /**
     * 交易订单审核拒绝时解冻服务费并返还余额。
     *
     * @param param 解冻参数
     * @return 解冻结果
     */
    @PostMapping("/parking/wallet/remote/unfreeze-charge-strategy")
    BaseResult<ParkingWalletFeeFreezeResult> unfreezeChargeStrategy(@RequestBody @Validated ParkingWalletFeeFreezeParam param);

    /**
     * 交易订单完结时结算服务费。
     *
     * @param param 结算参数
     * @return 结算结果
     */
    @PostMapping("/parking/wallet/remote/settle-charge-strategy")
    BaseResult<ParkingWalletFeeFreezeResult> settleChargeStrategy(@RequestBody @Validated ParkingWalletFeeFreezeParam param);

    /**
     * 查询采购方服务费余额。
     *
     * @param proEntId 采购方企业ID
     * @param supEntId 供应商企业ID，可为空
     * @return 服务费余额
     */
    @GetMapping("/parking/wallet/remote/service-fee-balance")
    BaseResult<BigDecimal> queryServiceFeeBalance(@RequestParam("proEntId") Long proEntId,
                                                  @RequestParam(value = "supEntId", required = false) Long supEntId);
}
