package com.ruoyi.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.PosOrderLineRefund;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface PosOrderLineRefundMapper extends BaseMapper<PosOrderLineRefund> {
    PosOrderLineRefund selectByPaymentId(@Param("paymentId") Long paymentId);

    int claimProcessing(@Param("id") Long id, @Param("version") Long version,
                        @Param("expectedStatus") String expectedStatus,
                        @Param("leaseOwner") String leaseOwner,
                        @Param("leaseUntil") Date leaseUntil,
                        @Param("updateTime") Date updateTime);

    int markUnknown(@Param("id") Long id, @Param("version") Long version,
                    @Param("nextReconcileAt") Date nextReconcileAt,
                    @Param("reconcileDeadline") Date reconcileDeadline,
                    @Param("updateTime") Date updateTime);
    int markRetryWait(@Param("id") Long id, @Param("version") Long version,
                      @Param("nextReconcileAt") Date nextReconcileAt,
                      @Param("updateTime") Date updateTime);
    int markFailed(@Param("id") Long id, @Param("version") Long version,
                   @Param("updateTime") Date updateTime);
    int recoverExpiredProcessing(@Param("id") Long id, @Param("version") Long version,
                                 @Param("nextReconcileAt") Date nextReconcileAt,
                                 @Param("reconcileDeadline") Date reconcileDeadline,
                                 @Param("updateTime") Date updateTime);
    int rescheduleUnknown(@Param("id") Long id, @Param("version") Long version,
                          @Param("nextReconcileAt") Date nextReconcileAt,
                          @Param("reconcileDeadline") Date reconcileDeadline,
                          @Param("updateTime") Date updateTime);

    int markRefunded(@Param("id") Long id, @Param("version") Long version,
                     @Param("refundTransactionId") String refundTransactionId,
                     @Param("refundTime") Date refundTime,
                     @Param("updateTime") Date updateTime);
    int markRefundedFromEvidence(@Param("id") Long id, @Param("version") Long version,
                                 @Param("expectedStatus") String expectedStatus,
                                 @Param("refundTransactionId") String refundTransactionId,
                                 @Param("refundTime") Date refundTime,
                                 @Param("updateTime") Date updateTime);
    List<PosOrderLineRefund> scanDue(@Param("now") Date now, @Param("batchSize") int batchSize);
    int markManualReview(@Param("id") Long id, @Param("version") Long version,
                         @Param("expectedStatus") String expectedStatus,
                         @Param("updateTime") Date updateTime);
    int markManualReviewFromEvidence(@Param("id") Long id, @Param("version") Long version,
                                     @Param("expectedStatus") String expectedStatus,
                                     @Param("updateTime") Date updateTime);
}
