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

import com.jeesharp.business.modules.finance.api.MerchantReceivableApi;
import com.jeesharp.business.modules.finance.merchantreceivable.application.MerchantReceivableApplicationService;
import com.jeesharp.business.modules.finance.api.dto.MerchantReceivableBriefDTO;
import com.jeesharp.business.modules.finance.merchantreceivable.vo.MerchantReceivableSettlementSummaryVO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

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

    private final MerchantReceivableApplicationService merchantReceivableApplicationService;

    @Override
    public void recordForMallPay(String financePayOrderId, String payBatchId, String transactionId) {
        merchantReceivableApplicationService.recordForMallPay(financePayOrderId, payBatchId, transactionId);
    }

    @Override
    public void recordForRefund(String payRefundOrderId) {
        merchantReceivableApplicationService.recordForRefund(payRefundOrderId);
    }

    @Override
    public List<MerchantReceivableBriefDTO> listByMallOrderId(String mallOrderId) {
        return merchantReceivableApplicationService.listByMallOrderId(mallOrderId);
    }

    @Override
    public MerchantReceivableSettlementSummaryVO summarizeForSettlementBill(String merchantTenantId,
            LocalDateTime periodStart, LocalDateTime periodEnd) {
        return merchantReceivableApplicationService.summarizeForSettlementBill(
                merchantTenantId, periodStart, periodEnd);
    }

    @Override
    public String resolveTenantCodeByMerchantTenantId(String merchantTenantId) {
        return merchantReceivableApplicationService.resolveTenantCodeByMerchantTenantId(merchantTenantId);
    }
}
