"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from dataclasses import dataclass, field
import httpx
from owasp_nest.models import NestError
from owasp_nest.types import BaseModel, OptionalNullable, UNSET
from typing import Any, Dict, List, Optional, Union
from typing_extensions import TypeAliasType


ErrorsTypedDict = TypeAliasType(
    "ErrorsTypedDict", Union[List[Dict[str, Any]], Dict[str, Any]]
)


Errors = TypeAliasType("Errors", Union[List[Dict[str, Any]], Dict[str, Any]])


class ValidationErrorSchemaData(BaseModel):
    message: str
    errors: OptionalNullable[Errors] = UNSET


@dataclass(unsafe_hash=True)
class ValidationErrorSchema(NestError):
    r"""Schema for validation error."""

    data: ValidationErrorSchemaData = field(hash=False)

    def __init__(
        self,
        data: ValidationErrorSchemaData,
        raw_response: httpx.Response,
        body: Optional[str] = None,
    ):
        fallback = body or raw_response.text
        message = str(data.message) or fallback
        super().__init__(message, raw_response, body)
        object.__setattr__(self, "data", data)
