# 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


class TemplateVariable(UncheckedBaseModel):
    """
    Template variable declaration for AgentScorer prompts.

    Defines variables that can be used in prompt templates with {{variable}} syntax.
    At execution time, validates that required variables are present in the context.

    Example:
        variable = TemplateVariable(
            name="input",
            description="The test case input data",
            required=True
        )
    """

    name: str = pydantic.Field()
    """
    Variable name (used in {{name}} syntax)
    """

    description: str = pydantic.Field()
    """
    Human-readable description of the variable
    """

    required: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether this variable must be provided at execution time
    """

    default_value: typing.Optional[str] = pydantic.Field(default=None)
    """
    Optional default value if not provided in context
    """

    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
