package at.procon.dip.domain.document.repository;

import at.procon.dip.domain.document.RelationType;
import at.procon.dip.domain.document.entity.DocumentRelation;
import java.util.List;
import java.util.UUID;
import org.springframework.data.jpa.repository.JpaRepository;

public interface DocumentRelationRepository extends JpaRepository<DocumentRelation, UUID> {

    List<DocumentRelation> findByParentDocument_Id(UUID parentDocumentId);

    List<DocumentRelation> findByChildDocument_Id(UUID childDocumentId);

    List<DocumentRelation> findByParentDocument_IdAndRelationType(UUID parentDocumentId, RelationType relationType);

    boolean existsByParentDocument_IdAndChildDocument_IdAndRelationType(UUID parentDocumentId, UUID childDocumentId, RelationType relationType);
}
