# 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 .analysis_scope import AnalysisScope
from .conversation_history_evaluation_criteria_result_common_model import (
    ConversationHistoryEvaluationCriteriaResultCommonModel,
)
from .data_collection_result_common_model import DataCollectionResultCommonModel
from .evaluation_success_result import EvaluationSuccessResult


class ScopedAnalysisResult(UncheckedBaseModel):
    scope: AnalysisScope = pydantic.Field()
    """
    The scope of the analysis. 'conversation' uses the full transcript; 'agent' uses only the portion where the defining agent was active.
    """

    source_agent_id: str
    source_branch_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Branch of the agent for this scoped block; disambiguates repeated agent_id.
    """

    evaluation_criteria_results: typing.Optional[
        typing.Dict[str, ConversationHistoryEvaluationCriteriaResultCommonModel]
    ] = None
    data_collection_results: typing.Optional[typing.Dict[str, DataCollectionResultCommonModel]] = None
    successful: EvaluationSuccessResult
    success_score: 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
