# 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 .type_check_assertion_expected_type import TypeCheckAssertionExpectedType


class TypeCheckAssertion(UncheckedBaseModel):
    """
    Type check assertion.

    Checks if the actual value is of the expected type.

    Example:
        assertion = TypeCheckAssertion(
            type="type_check",
            field_path="price",
            expected_type="float",
            description="Price should be a number"
        )
    """

    type: typing.Literal["type_check"] = "type_check"
    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    Human-readable description of this assertion
    """

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

    expected_type: TypeCheckAssertionExpectedType = pydantic.Field()
    """
    Expected Python type
    """

    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
