# This file was auto-generated by Fern from our API Definition.

from __future__ import annotations

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
from ..core.unchecked_base_model import UncheckedBaseModel
from .chunk import Chunk
from .parse_run_output_ocr import ParseRunOutputOcr


class ParseRunOutput(UncheckedBaseModel):
    """
    The parse run output.

    **Availability:** Present when `status` is `"PROCESSED"` and the request was made without the `responseType=url` query parameter. Contains the parsed chunks.
    """

    chunks: typing.List[Chunk] = pydantic.Field()
    """
    An array of chunks that were parsed from the file.
    """

    ocr: typing.Optional[ParseRunOutputOcr] = pydantic.Field(default=None)
    """
    Raw OCR data from the parsing process. Only included when `returnOcr` is configured in the parse config's advanced options.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


update_forward_refs(ParseRunOutput)
