package com.izouma.nineth.repo;

import com.izouma.nineth.domain.BalanceRecord;
import com.izouma.nineth.enums.BalanceType;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

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

public interface BalanceRecordRepo extends JpaRepository<BalanceRecord, Long>, JpaSpecificationExecutor<BalanceRecord> {
    List<BalanceRecord> findByUserIdAndCreatedAtBetweenOrderByCreatedAt(Long userId, LocalDateTime start, LocalDateTime end);

    List<BalanceRecord> findByUserIdOrderByCreatedAt(Long userId);

    Page<BalanceRecord> findByUserId(Long userId, Pageable pageable);

    BalanceRecord findByOrderIdAndType(Long orderId, BalanceType type);
}
