# 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 .page_ranges import PageRanges
from .split_advanced_options_split_method import SplitAdvancedOptionsSplitMethod


class SplitAdvancedOptions(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.
    
    **Deprecated:** For `splitting_light` >= 1.3.0 and `splitting_performance` >= 1.5.0, use the `identifierKey` field on each classification in `splitClassifications` instead. This provides per-type identifier extraction rules rather than a single global rule. On those versions, this field is accepted but ignored if provided.
    """

    split_method: typing_extensions.Annotated[
        typing.Optional[SplitAdvancedOptionsSplitMethod], FieldMetadata(alias="splitMethod")
    ] = pydantic.Field(alias="splitMethod", default=None)
    """
    The method to use for splitting documents. `high_precision` is more accurate but slower, while `basic_precision` 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.
    """

    page_ranges: typing_extensions.Annotated[typing.Optional[PageRanges], FieldMetadata(alias="pageRanges")] = (
        pydantic.Field(alias="pageRanges", default=None)
    )
    page_overlap_enabled: typing_extensions.Annotated[
        typing.Optional[bool], FieldMetadata(alias="pageOverlapEnabled")
    ] = pydantic.Field(alias="pageOverlapEnabled", default=None)
    """
    When enabled, the splitter will allow for page overlap when splitting a document such that a page can occur in multiple adjacent splits when context from the previous split is on the page and context from the next split is on the page.
    """

    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
