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

from __future__ import annotations
from anncsu.common.errors import AnncsuError
from anncsu.common.sdk.types import BaseModel
from dataclasses import dataclass, field
import httpx
from typing import Optional


class RispostaErroreData(BaseModel):
    id: Optional[str] = None
    r"""Identificativo dell'operazione."""
    codice: Optional[str] = None
    r"""Codice di errore"""
    messaggio: Optional[str] = None
    r"""Messaggio di errore."""


@dataclass(unsafe_hash=True)
class RispostaErrore(AnncsuError):
    data: RispostaErroreData = field(hash=False)

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