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

from __future__ import annotations
from dataclasses import dataclass, field
import httpx
from que_media.errors import QueError
from que_media.models import problemresponse_error as models_problemresponse_error
from que_media.types import BaseModel, OptionalNullable, UNSET
from typing import Optional


class ProblemResponseErrorData(BaseModel):
    type: str

    title: str

    status: int

    code: str

    detail: OptionalNullable[str] = UNSET

    details: OptionalNullable[models_problemresponse_error.Details] = UNSET


@dataclass(frozen=True)
class ProblemResponseError(QueError):
    r"""An RFC 7807 problem details response."""

    data: ProblemResponseErrorData = field(hash=False)

    def __init__(
        self,
        data: ProblemResponseErrorData,
        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)
