# 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 .assertion_result_assertion_type import AssertionResultAssertionType


class AssertionResult(UncheckedBaseModel):
    """
    Result of a single assertion check
    """

    assertion: typing.Optional[typing.Any] = None
    assertion_type: AssertionResultAssertionType = pydantic.Field()
    """
    Type of assertion (redundant with assertion.type)
    """

    field_path: typing.Optional[str] = pydantic.Field(default=None)
    """
    JSON path to field being checked (e.g., 'response.products[0].id')
    """

    expected_value: typing.Optional[typing.Optional[typing.Any]] = pydantic.Field(default=None)
    """
    Expected value
    """

    actual_value: typing.Optional[typing.Optional[typing.Any]] = pydantic.Field(default=None)
    """
    Actual value from output
    """

    passed: bool = pydantic.Field()
    """
    Whether assertion passed
    """

    score: typing.Optional[float] = pydantic.Field(default=None)
    """
    Numeric score for similarity checks (0-1)
    """

    description: str = pydantic.Field()
    """
    Human-readable assertion description
    """

    error_message: typing.Optional[str] = pydantic.Field(default=None)
    """
    Error message if assertion failed
    """

    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
