package com.jsowell.pile.service;

import com.jsowell.pile.domain.MemberAdapayRecord;

import java.math.BigDecimal;
import java.util.List;
public interface MemberAdapayRecordService{

    int insertSelective(MemberAdapayRecord record);

    MemberAdapayRecord selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(MemberAdapayRecord record);

    int updateBatch(List<MemberAdapayRecord> list);

    int batchInsert(List<MemberAdapayRecord> list);

    int insertOrUpdate(MemberAdapayRecord record);

    int insertOrUpdateSelective(MemberAdapayRecord record);

    /**
     * 查询会员的汇付支付记录
     * @param memberId 会员id
     * @param scenarioType 场景类型 订单/余额
     * @return
     */
    List<MemberAdapayRecord> selectAdapayRecordList(String memberId, String scenarioType);

    MemberAdapayRecord selectByPaymentId(String paymentId);

    /**
     * 查询会员可用余额充值记录
     * @param memberId 会员id
     */
    List<MemberAdapayRecord> selectAvailableBalance(String memberId);

    void updateSpendAmount(String paymentId, BigDecimal amount);

    void unfreezeAmount(String paymentId, BigDecimal unfreezeAmount);

    void unfreezeAmountAndUpdateSpendAmount(String paymentId, BigDecimal unfreezeAmount, BigDecimal spendAmount);

    void updateRefundAmountFromFreezeAmount(String paymentId, BigDecimal refundAmount);

    void updateRefundAmount(String paymentId, BigDecimal amount);

    void updateFreezeAmount(String paymentId, BigDecimal amount);

    void commonUpdateAmountMethod(String paymentId, BigDecimal SpendAmount, BigDecimal RefundAmount, BigDecimal freezeAmount);

    List<MemberAdapayRecord> selectAvailableFreeze(String memberId);
}
