package ru.soune.nocopy.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import ru.soune.nocopy.entity.tarif.TariffInfo;

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

@Repository
public interface TariffInfoRepository extends JpaRepository<TariffInfo, String> {
    @Query("SELECT t FROM TariffInfo t WHERE t.autoRenewal = true AND t.endTariff <= :date")
    List<TariffInfo> findForAutoRenewal(@Param("date") LocalDateTime date);
}
