# 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 ContainsAssertion(UncheckedBaseModel):
    """
    Contains assertion.

    Checks if the actual value contains the expected value.
    Works for strings (substring), lists (item), dicts (key).

    Example:
        assertion = ContainsAssertion(
            type="contains",
            field_path="description",
            expected="premium quality",
            description="Description should mention quality"
        )
    """

    type: typing.Literal["contains"] = "contains"
    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: typing.Optional[typing.Any] = None
    case_sensitive: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether string matching should be case-sensitive
    """

    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
