# 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_extract_chunking_options_chunk_selection_strategy import LegacyExtractChunkingOptionsChunkSelectionStrategy
from .legacy_extract_chunking_options_chunking_strategy import LegacyExtractChunkingOptionsChunkingStrategy


class LegacyExtractChunkingOptions(UncheckedBaseModel):
    chunking_strategy: typing_extensions.Annotated[
        typing.Optional[LegacyExtractChunkingOptionsChunkingStrategy], FieldMetadata(alias="chunkingStrategy")
    ] = pydantic.Field(alias="chunkingStrategy", default=None)
    """
    The strategy to use for chunking the document.
    """

    page_chunk_size: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="pageChunkSize")] = (
        pydantic.Field(alias="pageChunkSize", default=None)
    )
    """
    The size of page chunks.
    """

    chunk_selection_strategy: typing_extensions.Annotated[
        typing.Optional[LegacyExtractChunkingOptionsChunkSelectionStrategy],
        FieldMetadata(alias="chunkSelectionStrategy"),
    ] = pydantic.Field(alias="chunkSelectionStrategy", default=None)
    """
    The strategy to use for selecting chunks.
    """

    custom_semantic_chunking_rules: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="customSemanticChunkingRules")
    ] = pydantic.Field(alias="customSemanticChunkingRules", default=None)
    """
    Custom rules for semantic chunking.
    """

    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
