package com.ruoyi.system.mapper;

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

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

public interface PosOrderLinePaymentMapper extends BaseMapper<PosOrderLinePayment> {
    PosOrderLinePayment selectActiveByDdId(@Param("ddId") String ddId);
    PosOrderLinePayment selectByLineOrderId(@Param("lineOrderId") String lineOrderId);
    PosOrderLinePayment selectByTransactionId(@Param("transactionId") String transactionId);
    PosOrderLinePayment selectPaymentById(@Param("id") Long id);
    List<PosOrderLinePayment> selectByDdId(@Param("ddId") String ddId);
    List<PosOrderLinePayment> selectCancelledPaidWithoutRefund(@Param("batchSize") int batchSize);
    int markTerminal(@Param("id") Long id, @Param("version") Long version,
                     @Param("expectedStatus") String expectedStatus,
                     @Param("targetStatus") String targetStatus,
                     @Param("updateTime") Date updateTime);
    int markRequestSucceeded(@Param("id") Long id, @Param("version") Long version,
                             @Param("transactionId") String transactionId,
                             @Param("paymentUrlWeb") String paymentUrlWeb,
                             @Param("paymentUrlApp") String paymentUrlApp,
                             @Param("nextReconcileAt") Date nextReconcileAt,
                             @Param("reconcileDeadline") Date reconcileDeadline,
                             @Param("updateTime") Date updateTime);
    int markRequestUnknown(@Param("id") Long id, @Param("version") Long version,
                           @Param("nextReconcileAt") Date nextReconcileAt,
                           @Param("reconcileDeadline") Date reconcileDeadline,
                           @Param("updateTime") Date updateTime);
    int markOfflineWaitingAuth(@Param("id") Long id, @Param("version") Long version,
                               @Param("transactionId") String transactionId,
                               @Param("nextReconcileAt") Date nextReconcileAt,
                               @Param("reconcileDeadline") Date reconcileDeadline,
                               @Param("updateTime") Date updateTime);
    int markOfflineEvidence(@Param("id") Long id, @Param("version") Long version,
                            @Param("expectedStatus") String expectedStatus,
                            @Param("targetStatus") String targetStatus,
                            @Param("transactionId") String transactionId,
                            @Param("paymentProvider") String paymentProvider,
                            @Param("capturedAmount") Integer capturedAmount,
                            @Param("payTime") Date payTime,
                            @Param("updateTime") Date updateTime);
    int rescheduleOffline(@Param("id") Long id, @Param("version") Long version,
                          @Param("expectedStatus") String expectedStatus,
                          @Param("nextReconcileAt") Date nextReconcileAt,
                          @Param("reconcileDeadline") Date reconcileDeadline,
                          @Param("updateTime") Date updateTime);
    int claimConfirm(@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 markAuthDoneOrderCancelled(@Param("id") Long id, @Param("version") Long version,
                                   @Param("expectedStatus") String expectedStatus,
                                   @Param("nextReconcileAt") Date nextReconcileAt,
                                   @Param("reconcileDeadline") Date reconcileDeadline,
                                   @Param("updateTime") Date updateTime);
    int markConfirmUnknown(@Param("id") Long id, @Param("version") Long version,
                           @Param("nextReconcileAt") Date nextReconcileAt,
                           @Param("reconcileDeadline") Date reconcileDeadline,
                           @Param("updateTime") Date updateTime);
    int markPaid(@Param("id") Long id, @Param("version") Long version,
                 @Param("expectedStatus") String expectedStatus,
                 @Param("transactionId") String transactionId,
                 @Param("paymentProvider") String paymentProvider,
                 @Param("payTime") Date payTime, @Param("updateTime") Date updateTime);
    int markManualReview(@Param("id") Long id, @Param("version") Long version,
                         @Param("expectedStatus") String expectedStatus,
                         @Param("updateTime") Date updateTime);
    List<PosOrderLinePayment> scanDue(@Param("now") Date now, @Param("batchSize") int batchSize);
    int claimReconcileLease(@Param("id") Long id, @Param("version") Long version,
                            @Param("leaseOwner") String leaseOwner,
                            @Param("leaseUntil") Date leaseUntil, @Param("now") Date now);
}
