package it.micegroup.gestioneferie.configurazionepf.repository;

import org.springframework.stereotype.Repository;

import java.util.Optional;
import java.util.Collection;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa.repository.EntityGraph.EntityGraphType;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import it.micegroup.gestioneferie.configurazionepf.entity.DregolePianiFerieH;

import it.micegroup.gestioneferie.configurazionepf.entity.DregolePianiFeriePk;
import it.micegroup.gestioneferie.libs.repository.BaseRepository;

@Repository
@EnableJpaRepositories
public interface DregolePianiFerieHRepository extends BaseRepository<DregolePianiFerieH, Long> {

	@EntityGraph(attributePaths = { "theDregolePianiFeriePk" }, type = EntityGraphType.FETCH)

	Optional<DregolePianiFerieH> findBySequIdRegolePianiFerieH(Long id);

	@EntityGraph(attributePaths = { "theDregolePianiFeriePk" }, type = EntityGraphType.FETCH)

	Page<DregolePianiFerieH> findByTheDregolePianiFeriePk(DregolePianiFeriePk parentEntity, Pageable pageable);

	@Query("DELETE FROM DregolePianiFerieH WHERE sequIdRegolePianiFerieH IN ?1")
	void deleteByIdIn(Collection<Long> ids);
}
