# 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, UniversalBaseModel
from .....commons.types.primitive import Primitive
from .....commons.types.schema_id import SchemaId


class SchemaInstanceValidationError_MultipleInstancesForSchema(UniversalBaseModel):
    type: typing.Literal["multiple_instances_for_schema"] = "multiple_instances_for_schema"
    schema_id: SchemaId

    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


class SchemaInstanceValidationError_ValueDoesNotMatchKeyType(UniversalBaseModel):
    type: typing.Literal["value_does_not_match_key_type"] = "value_does_not_match_key_type"
    schema_id: SchemaId
    key: str
    expected_value_type: Primitive
    value: typing.Optional[typing.Any] = None

    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


class SchemaInstanceValidationError_KeyDoesNotExist(UniversalBaseModel):
    type: typing.Literal["key_does_not_exist"] = "key_does_not_exist"
    key: str
    schema_id: SchemaId

    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


class SchemaInstanceValidationError_SchemaDoesNotExist(UniversalBaseModel):
    type: typing.Literal["schema_does_not_exist"] = "schema_does_not_exist"
    schema_id: SchemaId

    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


class SchemaInstanceValidationError_SchemaUnauthorizedAccess(UniversalBaseModel):
    type: typing.Literal["schema_unauthorized_access"] = "schema_unauthorized_access"
    schema_id: SchemaId

    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


SchemaInstanceValidationError = typing.Union[
    SchemaInstanceValidationError_MultipleInstancesForSchema,
    SchemaInstanceValidationError_ValueDoesNotMatchKeyType,
    SchemaInstanceValidationError_KeyDoesNotExist,
    SchemaInstanceValidationError_SchemaDoesNotExist,
    SchemaInstanceValidationError_SchemaUnauthorizedAccess,
]
