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

from __future__ import annotations
from novu_py import utils
from novu_py.types import BaseModel, Nullable, OptionalNullable, UNSET
import pydantic
from typing import Any, Dict, List, Optional, Union
from typing_extensions import Annotated, TypeAliasType, TypedDict


Message5TypedDict = TypeAliasType(
    "Message5TypedDict", Union[str, float, bool, Dict[str, Any]]
)


Message5 = TypeAliasType("Message5", Union[str, float, bool, Dict[str, Any]])


class Message4TypedDict(TypedDict):
    pass


class Message4(BaseModel):
    pass


MessageTypedDict = TypeAliasType(
    "MessageTypedDict",
    Union[Message4TypedDict, str, float, bool, List[Nullable[Message5TypedDict]]],
)
r"""Value that failed validation"""


Message = TypeAliasType(
    "Message", Union[Message4, str, float, bool, List[Nullable[Message5]]]
)
r"""Value that failed validation"""


class ErrorDtoData(BaseModel):
    status_code: Annotated[float, pydantic.Field(alias="statusCode")]
    r"""HTTP status code of the error response."""

    timestamp: str
    r"""Timestamp of when the error occurred."""

    path: str
    r"""The path where the error occurred."""

    message: OptionalNullable[Message] = UNSET
    r"""Value that failed validation"""

    ctx: Optional[Dict[str, Any]] = None
    r"""Optional context object for additional error details."""

    error_id: Annotated[Optional[str], pydantic.Field(alias="errorId")] = None
    r"""Optional unique identifier for the error, useful for tracking using Sentry and
    New Relic, only available for 500.
    """


class ErrorDto(Exception):
    data: ErrorDtoData

    def __init__(self, data: ErrorDtoData):
        self.data = data

    def __str__(self) -> str:
        return utils.marshal_json(self.data, ErrorDtoData)
