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

import at.procon.dip.domain.document.RepresentationType;
import at.procon.dip.domain.document.entity.DocumentTextRepresentation;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import org.springframework.data.jpa.repository.JpaRepository;

public interface DocumentTextRepresentationRepository extends JpaRepository<DocumentTextRepresentation, UUID> {

    List<DocumentTextRepresentation> findByDocument_Id(UUID documentId);

    List<DocumentTextRepresentation> findByDocument_IdAndRepresentationType(UUID documentId, RepresentationType representationType);

    List<DocumentTextRepresentation> findByPrimaryRepresentationTrue();

    long countByPrimaryRepresentationTrue();

    long countByRepresentationType(RepresentationType representationType);

    Optional<DocumentTextRepresentation> findFirstByDocument_IdAndPrimaryRepresentationTrue(UUID documentId);
}
