package com.ecep.contract.ds.other.repository;

import java.time.LocalDate;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import com.ecep.contract.model.HolidayTable;

@Repository
public interface HolidayTableRepository // curd
                extends CrudRepository<HolidayTable, LocalDate>, PagingAndSortingRepository<HolidayTable, LocalDate> {

        /**
         * 根据是否为节假日过滤
         * 
         * @param isHoliday 是否为节假日
         * @param pageable  分页参数
         * @return 分页结果
         */
        Page<HolidayTable> findByHoliday(boolean isHoliday, Pageable pageable);

        /**
         * 根据日期范围过滤
         * 
         * @param startDate 开始日期
         * @param endDate   结束日期
         * @param pageable  分页参数
         * @return 分页结果
         */
        Page<HolidayTable> findByIdBetween(LocalDate startDate, LocalDate endDate, Pageable pageable);

        /**
         * 根据是否为节假日和日期范围组合过滤
         * 
         * @param isHoliday 是否为节假日
         * @param startDate 开始日期
         * @param endDate   结束日期
         * @param pageable  分页参数
         * @return 分页结果
         */
        Page<HolidayTable> findByHolidayAndIdBetween(boolean isHoliday, LocalDate startDate, LocalDate endDate,
                        Pageable pageable);
}
