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

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata
from .analysis_scope import AnalysisScope
from .attached_system_evaluation_ref_analysis_item_id import AttachedSystemEvaluationRefAnalysisItemId


class AgentAnalysisItemsInputEvaluationCriteriaItem_System(UncheckedBaseModel):
    source: typing.Literal["system"] = "system"
    analysis_item_id: AttachedSystemEvaluationRefAnalysisItemId
    scope: typing.Optional[AnalysisScope] = None
    weight: typing.Optional[float] = None

    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


class AgentAnalysisItemsInputEvaluationCriteriaItem_User(UncheckedBaseModel):
    source: typing.Literal["user"] = "user"
    analysis_item_id: str
    version_id: typing.Optional[str] = None
    additional_version_ids: typing.Optional[typing.List[str]] = None
    scope: typing.Optional[AnalysisScope] = None
    weight: typing.Optional[float] = None

    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


AgentAnalysisItemsInputEvaluationCriteriaItem = typing_extensions.Annotated[
    typing.Union[
        AgentAnalysisItemsInputEvaluationCriteriaItem_System, AgentAnalysisItemsInputEvaluationCriteriaItem_User
    ],
    UnionMetadata(discriminant="source"),
]
