package de.oaa.xxx.subscription;

import org.springframework.data.jpa.repository.JpaRepository;

import java.time.LocalDate;
import java.util.List;
import java.util.Optional;
import java.util.UUID;

public interface UserSubscriptionRepository extends JpaRepository<UserSubscriptionEntity, UUID> {

    Optional<UserSubscriptionEntity> findTopByUserIdAndValidUntilGreaterThanEqualOrderByValidUntilDesc(
            UUID userId, LocalDate today);

    List<UserSubscriptionEntity> findByValidUntilGreaterThanEqualOrderByValidUntilDesc(LocalDate today);
}
