package org.raddatz.familienarchiv.ocr;

import org.raddatz.familienarchiv.ocr.OcrDocumentStatus;
import org.raddatz.familienarchiv.ocr.OcrJobDocument;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;
import java.util.Optional;
import java.util.UUID;

public interface OcrJobDocumentRepository extends JpaRepository<OcrJobDocument, UUID> {

    List<OcrJobDocument> findByJobIdOrderByCreatedAtAsc(UUID jobId);

    List<OcrJobDocument> findByJobIdAndStatus(UUID jobId, OcrDocumentStatus status);

    Optional<OcrJobDocument> findByJobIdAndDocumentId(UUID jobId, UUID documentId);

    Optional<OcrJobDocument> findFirstByDocumentIdAndStatusIn(UUID documentId, List<OcrDocumentStatus> statuses);
}
