package com.jeesharp.business.modules.finance.profitsharing.service;

import com.jeesharp.business.modules.finance.profitsharing.entity.ProfitSharingOrder;
import com.jeesharp.business.modules.finance.profitsharing.vo.ProfitSharingOrderQueryVO;
import com.jeesharp.framework.mybatis.core.service.BaseInterface;

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

/**
 * 微信分账单领域服务接口。
 *
 * @author jeesharp
 * @since 2026-06-11
 */
public interface ProfitSharingOrderService extends BaseInterface<ProfitSharingOrder, ProfitSharingOrderQueryVO> {

    ProfitSharingOrder findByMallOrderId(String mallOrderId);

    List<ProfitSharingOrder> listRetryCandidates(LocalDateTime now, int maxRetryCount, int limit);

    List<ProfitSharingOrder> listByPayBatchId(String payBatchId);

    List<ProfitSharingOrder> listByTransactionId(String transactionId);

    boolean isFinishDone(String transactionId, String subMchId);

    void markFinishDone(String payBatchId, String transactionId, String subMchId);

    /**
     * 退款场景取消待分账记录；{@code includeFailStatus} 为 true 时一并取消失败态分账单。
     */
    void cancelSharingForRefund(String mallOrderId, boolean includeFailStatus);
}
