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

from __future__ import annotations
from .error import ErrorData
from .validationerror import ValidationErrorData
from dataclasses import dataclass, field
import httpx
from paygentic_sdk.errors import PaygenticError
from typing import Optional, Union
from typing_extensions import TypeAliasType


BadRequestUnion = TypeAliasType(
    "BadRequestUnion", Union[ErrorData, ValidationErrorData]
)
r"""Bad Request - The request could not be understood or was missing required parameters"""


@dataclass(unsafe_hash=True)
class BadRequest(PaygenticError):
    r"""Bad Request - The request could not be understood or was missing required parameters"""

    data: BadRequestUnion = field(hash=False)

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