package de.votian.services.repository;

import de.votian.services.entity.PublicHoliday;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface PublicHolidayRepository extends JpaRepository<PublicHoliday, Long> {

    List<PublicHoliday> findByHeadquartersIdAndYearValueOrderByMonthValueAscDayValueAscTimeFromAsc(Long headquartersId, Integer yearValue);

    void deleteByHeadquartersIdAndYearValue(Long headquartersId, Integer yearValue);

    @Query("select distinct ph.yearValue from PublicHoliday ph where ph.headquartersId = :headquartersId order by ph.yearValue")
    List<Integer> findDistinctYearsByHeadquartersId(Long headquartersId);
}
