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

from __future__ import annotations
from dataclasses import dataclass, field
import httpx
from paygentic_sdk.errors import PaygenticError
from paygentic_sdk.models import deletecustomerop as models_deletecustomerop
from paygentic_sdk.types import BaseModel
from typing import Optional


class DeleteCustomerConflictErrorData(BaseModel):
    error: Optional[models_deletecustomerop.DeleteCustomerError] = None
    message: Optional[str] = None
    details: Optional[models_deletecustomerop.DeleteCustomerDetails] = None


@dataclass(unsafe_hash=True)
class DeleteCustomerConflictError(PaygenticError):
    r"""Customer cannot be deleted due to active dependencies"""

    data: DeleteCustomerConflictErrorData = field(hash=False)

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