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

from __future__ import annotations

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
from ..core.unchecked_base_model import UncheckedBaseModel
from .conversation_history_transcript_common_model_input import ConversationHistoryTranscriptCommonModelInput
from .conversation_initiation_source import ConversationInitiationSource
from .dynamic_variable_value_type_input import DynamicVariableValueTypeInput
from .llm import Llm
from .simulation_tool_mock_behavior_config import SimulationToolMockBehaviorConfig
from .test_from_conversation_metadata_input import TestFromConversationMetadataInput


class UpdateSimulationTestRequest(UncheckedBaseModel):
    from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = pydantic.Field(default=None)
    """
    Metadata of a conversation this test was created from (if applicable).
    """

    dynamic_variables: typing.Optional[typing.Dict[str, typing.Optional[DynamicVariableValueTypeInput]]] = (
        pydantic.Field(default=None)
    )
    """
    Dynamic variables to replace in the agent config during testing
    """

    chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None
    conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None)
    """
    Simulate the test as if the conversation originated from this channel.
    """

    success_condition: typing.Optional[str] = pydantic.Field(default=None)
    """
    Deprecated legacy single success criterion. Use success_conditions instead. At least one of success_condition or success_conditions is required.
    """

    success_conditions: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    List of prompts that evaluate whether the simulation was successful. If provided, all criteria are evaluated and merged into a final result. Capped at the maximum number of evaluation criteria.
    """

    simulation_scenario: typing.Optional[str] = pydantic.Field(default=None)
    """
    Description of the simulation scenario and user persona for simulation tests.
    """

    simulation_max_turns: typing.Optional[int] = pydantic.Field(default=None)
    """
    Maximum number of conversation turns for simulation tests.
    """

    simulation_environment: typing.Optional[str] = pydantic.Field(default=None)
    """
    The environment to use when running this simulation test. If not provided, defaults to 'production'.
    """

    tool_mock_config: typing.Optional[SimulationToolMockBehaviorConfig] = pydantic.Field(default=None)
    """
    Configuration for which tools to mock and fallback behavior.
    """

    evaluation_model: typing.Optional[Llm] = pydantic.Field(default=None)
    """
    LLM model to use for evaluating simulation results. Defaults to Claude Sonnet 4.6.
    """

    simulated_user_model: typing.Optional[Llm] = pydantic.Field(default=None)
    """
    LLM model for the simulated user. Defaults to Claude Sonnet 4.6.
    """

    name: str
    parent_folder_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the parent folder. If not provided, the test will be moved to the root level.
    """

    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


update_forward_refs(UpdateSimulationTestRequest)
