# 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


class SplitClassification(UncheckedBaseModel):
    """
    A classification for document splitting. Extends the base Classification with an optional `identifierKey` field for per-type identifier extraction rules.
    """

    id: str = pydantic.Field()
    """
    Unique identifier for the classification. We recommend lowercase, underscore-separated format.
    """

    type: str = pydantic.Field()
    """
    Type identifier for the classification.
    """

    description: str = pydantic.Field()
    """
    A detailed description of the classification.
    """

    identifier_key: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="identifierKey")] = (
        pydantic.Field(alias="identifierKey", default=None)
    )
    """
    A natural-language rule describing how to extract a unique identifier for subdocuments of this type. For example, `"Extract the invoice number from the document header"`.
    
    When provided, the splitter will extract the specified identifier for each subdocument of this type and include it in the output as the `identifier` field. This enables merging of related subdocuments that share the same extracted identifier.
    
    **Availability:** Supported on `splitting_light` >= 1.3.0 and `splitting_performance` >= 1.5.0. If provided on older versions, this field is accepted but ignored.
    """

    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
