from pydantic import BaseModel, ConfigDict


class OcrRegion(BaseModel):
    model_config = ConfigDict(populate_by_name=True)

    annotationId: str
    pageNumber: int
    x: float
    y: float
    width: float
    height: float


class OcrRequest(BaseModel):
    model_config = ConfigDict(populate_by_name=True)

    pdfUrl: str
    scriptType: str = "UNKNOWN"
    language: str = "de"
    regions: list[OcrRegion] | None = None
    senderModelPath: str | None = None


class OcrBlock(BaseModel):
    model_config = ConfigDict(populate_by_name=True)

    pageNumber: int
    x: float
    y: float
    width: float
    height: float
    polygon: list[list[float]] | None = None
    text: str
    annotationId: str | None = None
