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

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.serialization import FieldMetadata
from ..core.unchecked_base_model import UncheckedBaseModel
from .legacy_splitter_advanced_options_split_method import LegacySplitterAdvancedOptionsSplitMethod
from .page_ranges import PageRanges


class LegacySplitterAdvancedOptions(UncheckedBaseModel):
    split_identifier_rules: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="splitIdentifierRules")
    ] = pydantic.Field(alias="splitIdentifierRules", default=None)
    """
    Custom rules for identifying split points.
    """

    split_method: typing_extensions.Annotated[
        typing.Optional[LegacySplitterAdvancedOptionsSplitMethod], FieldMetadata(alias="splitMethod")
    ] = pydantic.Field(alias="splitMethod", default=None)
    """
    The method to use for splitting documents. `high_precision` is more accurate but slower, while `low_latency` is faster but less precise.
    
    **Deprecated:** For `splitting_light` >= 1.3.0 and `splitting_performance` >= 1.5.0, this field has no impact and is ignored if provided. It is still accepted for compatibility with older integrations.
    """

    split_excel_documents_by_sheet_enabled: typing_extensions.Annotated[
        typing.Optional[bool], FieldMetadata(alias="splitExcelDocumentsBySheetEnabled")
    ] = pydantic.Field(alias="splitExcelDocumentsBySheetEnabled", default=None)
    """
    For Excel documents, split by worksheet.
    """

    fixed_page_limit: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="fixedPageLimit")] = (
        pydantic.Field(alias="fixedPageLimit", default=None)
    )
    """
    Limit processing to a specific number of pages from the beginning of the document. See [Page Ranges](https://docs.extend.ai/2026-02-09/product/page-ranges).
    """

    page_ranges: typing_extensions.Annotated[typing.Optional[PageRanges], FieldMetadata(alias="pageRanges")] = (
        pydantic.Field(alias="pageRanges", default=None)
    )

    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
