package cn.novalon.gym.manage.member.service;

import cn.novalon.gym.manage.member.entity.MemberCard;
import cn.novalon.gym.manage.member.entity.MemberCardRecord;
import org.springframework.data.domain.Pageable;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
 * 会员卡服务接口
 * 
 * @author 付嘉
 * @date 2026-05-27
 */
public interface IMemberCardService {
    
    Mono<MemberCard> findByMemberCardIdAndDeletedAtIsNull(Long memberCardId);
    
    Flux<MemberCard> findWithConditions(Integer status, String name, String type,
                                        Double minPrice, Double maxPrice, Pageable pageable);
    
    Mono<Long> countWithConditions(Integer status, String name, String type,
                                   Double minPrice, Double maxPrice);
    
    Flux<MemberCard> findByMemberCardStatusAndDeletedAtIsNull(Integer status, Pageable pageable);
    
    Mono<Boolean> existsPurchasedRecord(Long memberCardId);
    
    Mono<Integer> logicalDelete(Long memberCardId);
    
    Flux<MemberCard> findActiveCards(Integer status);
    
    Mono<MemberCard> save(MemberCard entity);
    
    Mono<MemberCardRecord> purchaseCard(Long memberId, Long memberCardId, Long sourceOrderId);
    
    Mono<MemberCardRecord> renewCard(Long recordId, Integer addTimes, Double addAmount, Integer addDays, Long sourceOrderId);
    
    Mono<MemberCardRecord> useCard(Long recordId, Integer deductTimes, Double deductAmount);
    
    Mono<Void> refundCard(Long recordId);
    
    Mono<Integer> processExpiredCards();
}
