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

from __future__ import annotations
from duckyai.models import DuckyAiError
from duckyai.types import BaseModel
import httpx
from typing import Optional


class ErrorResponseData(BaseModel):
    error: Optional[str] = None
    r"""Error message explaining the issue"""


class ErrorResponse(DuckyAiError):
    data: ErrorResponseData

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