"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
# @generated-id: 4946ae06717e

from __future__ import annotations
from dataclasses import dataclass, field
import httpx
from mistralai.client.errors import MistralError
from mistralai.client.models import (
    observabilityerrordetail as models_observabilityerrordetail,
)
from mistralai.client.types import BaseModel
from typing import Optional


class ObservabilityErrorData(BaseModel):
    detail: models_observabilityerrordetail.ObservabilityErrorDetail


@dataclass(unsafe_hash=True)
class ObservabilityError(MistralError):
    data: ObservabilityErrorData = field(hash=False)

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