# 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 .human_review_scorer_review_type import HumanReviewScorerReviewType
from .review_option import ReviewOption


class HumanReviewScorer(UncheckedBaseModel):
    """
    Human review scorer.

    Collects manual feedback from human reviewers. Can be continuous
    (slider), categorical (predefined options), or text (free-form notes).

    Example (continuous):
        scorer = HumanReviewScorer(
            id="human_accuracy",
            name="Human: Accuracy",
            type="human_review",
            review_type="continuous",
            description="How accurate is this response?",
            pass_threshold=0.75
        )

    Example (categorical):
        scorer = HumanReviewScorer(
            id="human_tone",
            name="Human: Tone",
            type="human_review",
            review_type="categorical",
            options=[
                ReviewOption(label="👍 Professional", score=1.0),
                ReviewOption(label="😐 Casual", score=0.5),
                ReviewOption(label="👎 Rude", score=0.0)
            ]
        )
    """

    type: typing.Literal["human_review"] = "human_review"
    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
    """

    review_type: HumanReviewScorerReviewType = pydantic.Field()
    """
    Type of human input
    """

    options: typing.Optional[typing.List[ReviewOption]] = pydantic.Field(default=None)
    """
    Available options for categorical review
    """

    allow_multiple: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Allow selecting multiple options
    """

    metadata_path: typing.Optional[str] = pydantic.Field(default=None)
    """
    Where to store free-form text (e.g., 'reviewer_notes')
    """

    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
