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

import typing

import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class Citation(UniversalBaseModel):
    """
    A reference to source text that led to a code extraction
    """

    text: str = pydantic.Field()
    """
    The exact text span containing evidence for the code
    """

    begin_offset: int = pydantic.Field()
    """
    Starting byte offset in the original input text (0-indexed)
    """

    end_offset: int = pydantic.Field()
    """
    Ending byte offset (exclusive), such that input[begin_offset:end_offset] == text
    """

    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
