feat(ocr): add OcrStreamEvent sealed interface with Start/Page/Error/Done records

Defines the event types for NDJSON streaming OCR. Uses Java 21 sealed
interface with record subtypes for exhaustive pattern matching in the
consumer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-13 10:00:02 +02:00
parent 97c6cf6a65
commit e21d01e10b
2 changed files with 65 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
package org.raddatz.familienarchiv.service;
import java.util.List;
public sealed interface OcrStreamEvent {
record Start(int totalPages) implements OcrStreamEvent {}
record Page(int pageNumber, List<OcrBlockResult> blocks) implements OcrStreamEvent {}
record Error(int pageNumber, String message) implements OcrStreamEvent {}
record Done(int totalBlocks, int skippedPages) implements OcrStreamEvent {}
}