package com.jeesharp.business.modules.pay.application.api;

import com.jeesharp.business.modules.pay.api.PayProfitSharingChannelApi;
import com.jeesharp.business.modules.pay.profitsharing.dto.PayProfitSharingFinishRequestDTO;
import com.jeesharp.business.modules.pay.profitsharing.dto.PayProfitSharingReceiverAddRequestDTO;
import com.jeesharp.business.modules.pay.profitsharing.dto.PayProfitSharingReceiverDeleteRequestDTO;
import com.jeesharp.business.modules.pay.profitsharing.dto.PayProfitSharingReceiverResultDTO;
import com.jeesharp.business.modules.pay.profitsharing.dto.PayProfitSharingRequestDTO;
import com.jeesharp.business.modules.pay.profitsharing.dto.PayProfitSharingResultDTO;
import com.jeesharp.business.modules.pay.profitsharing.support.PayWechatProfitSharingClient;
import com.jeesharp.business.modules.pay.profitsharing.support.PayWechatProfitSharingReceiverClient;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * {@link PayProfitSharingChannelApi} 实现，委托微信 V3 分账客户端。
 *
 * @author jeesharp
 * @since 2026-06-11
 */
@Service
@AllArgsConstructor
public class PayProfitSharingChannelApiImpl implements PayProfitSharingChannelApi {

    private final PayWechatProfitSharingClient payWechatProfitSharingClient;
    private final PayWechatProfitSharingReceiverClient payWechatProfitSharingReceiverClient;

    @Override
    public PayProfitSharingResultDTO requestOrders(PayProfitSharingRequestDTO request) {
        return payWechatProfitSharingClient.requestOrders(request);
    }

    @Override
    public PayProfitSharingResultDTO queryOrders(String platformTenantId, String subMchId,
            String transactionId, String outOrderNo) {
        return payWechatProfitSharingClient.queryOrders(platformTenantId, subMchId, transactionId, outOrderNo);
    }

    @Override
    public PayProfitSharingResultDTO finishOrder(PayProfitSharingFinishRequestDTO request) {
        return payWechatProfitSharingClient.finishOrder(request);
    }

    @Override
    public PayProfitSharingReceiverResultDTO ensureSubMerchantSelfReceiver(String platformTenantId, String subMchId) {
        return payWechatProfitSharingReceiverClient.ensureSubMerchantSelfReceiver(platformTenantId, subMchId);
    }

    @Override
    public PayProfitSharingReceiverResultDTO addReceiver(PayProfitSharingReceiverAddRequestDTO request) {
        return payWechatProfitSharingReceiverClient.addReceiver(request);
    }

    @Override
    public PayProfitSharingReceiverResultDTO deleteReceiver(PayProfitSharingReceiverDeleteRequestDTO request) {
        return payWechatProfitSharingReceiverClient.deleteReceiver(request);
    }

    @Override
    public PayProfitSharingReceiverResultDTO queryReceivers(String platformTenantId, String subMchId) {
        return payWechatProfitSharingReceiverClient.queryReceivers(platformTenantId, subMchId);
    }
}
