package com.seer.teach.pay.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.seer.teach.pay.entity.PayMerchantRevenueDetailEntity;

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

/**
 * <p>
 * 商家收益流水明细表 服务类
 * </p>
 *
 * @author ZS
 * @since 2025-09-25
 */
public interface IPayMerchantRevenueDetailService extends IService<PayMerchantRevenueDetailEntity> {

    /**
     * 获取商家收益明细
     *
     * @param merchantUserId 商家ID
     * @return 商家收益明细
     */
    List<PayMerchantRevenueDetailEntity> getRevenueDetailsByMerchantUserId(Long merchantUserId);

    /**
     * 获取指定时间前的未结算商家收益明细
     *
     * @param cutoffTime 截止时间
     * @return 收益明细列表
     */
    List<PayMerchantRevenueDetailEntity> getUnsettledRevenueDetailsBeforeCutoff(LocalDateTime cutoffTime);

    /**
     * 标记商家收益明细为已结算
     *
     * @param detailIds 明细ID列表
     */
    void markRevenueAsSettled(Collection<Integer> detailIds);
    
    /**
     * 根据支付订单号获取商家收益明细
     * 
     * @param payOrderSn 支付订单号
     * @return 收益明细列表
     */
    List<PayMerchantRevenueDetailEntity> listByPayOrderSn(String payOrderSn);

    /**
     * 结算商家收益
     *
     * @param cutoffDateTime 结算截止时间
     * @return 结算结果
     */
    boolean settleMerchantRevenue(LocalDateTime cutoffDateTime);

}