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.DconfigPaPfUoH;

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

@Repository
@EnableJpaRepositories
public interface DconfigPaPfUoHRepository extends BaseRepository<DconfigPaPfUoH, Long> {

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

	Optional<DconfigPaPfUoH> findBySequIdConfigPaPfUoH(Long id);

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

	Page<DconfigPaPfUoH> findByTheDconfigPaPianiFerie(DconfigPaPianiFerie parentEntity, Pageable pageable);

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