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

import com.jeesharp.business.modules.finance.api.ProfitSharingApi;
import com.jeesharp.business.modules.finance.paymentrecord.enums.PayRecordBizSceneEnum;
import com.jeesharp.business.modules.finance.profitsharing.application.ProfitSharingApplicationService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * {@link ProfitSharingApi} 实现，委托 {@link ProfitSharingApplicationService}。
 *
 * @author jeesharp
 * @since 2026-06-11
 */
@Service
@AllArgsConstructor
public class ProfitSharingApiImpl implements ProfitSharingApi {

    private final ProfitSharingApplicationService profitSharingApplicationService;

    @Override
    public void createPendingForPay(String financePayOrderId, String bizScene, String payBatchId, String bizOrderId,
            String transactionId) {
        profitSharingApplicationService.createPendingForPay(financePayOrderId, bizScene, payBatchId, bizOrderId,
                transactionId);
    }

    @Override
    public void scheduleSharingByBizOrder(String bizScene, String bizOrderId) {
        profitSharingApplicationService.scheduleSharingByBizOrder(bizScene, bizOrderId);
    }

    @Override
    public void createPendingForMallPay(String financePayOrderId, String payBatchId, String transactionId) {
        createPendingForPay(financePayOrderId, PayRecordBizSceneEnum.MALL_ORDER.getCode(), payBatchId, null,
                transactionId);
    }

    @Override
    public void scheduleSharingBySubOrder(String mallOrderId) {
        scheduleSharingByBizOrder(PayRecordBizSceneEnum.MALL_ORDER.getCode(), mallOrderId);
    }

    @Override
    public void retry(String profitSharingOrderId) {
        profitSharingApplicationService.retry(profitSharingOrderId);
    }
}
