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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .native_scorer_config_type import NativeScorerConfigType


class NativeScorer(UncheckedBaseModel):
    """
    Native code-based scorer implemented in Python.

    Native scorers are fast, type-safe, and have direct access
    to the codebase. They use typed config models from configs.py.

    Example:
        scorer = NativeScorer(
            id="exact_match",
            name="Exact Match",
            type="native",
            config_type="exact_match",
            description="Deep equality check",
            pass_threshold=1.0
        )
    """

    type: typing.Literal["native"] = "native"
    id: str = pydantic.Field()
    """
    Unique scorer identifier
    """

    name: str = pydantic.Field()
    """
    Human-readable scorer name
    """

    description: str = pydantic.Field()
    """
    What this scorer evaluates
    """

    pass_threshold: typing.Optional[float] = pydantic.Field(default=None)
    """
    Optional pass/fail threshold (0-1)
    """

    tags: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Categorization tags
    """

    config_type: NativeScorerConfigType = pydantic.Field()
    """
    Which config schema this scorer uses
    """

    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
