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

from __future__ import annotations
from attio.errors import SDKError
from attio.models import (
    post_v2_target_identifier_attributes_attribute_statusesop as models_post_v2_target_identifier_attributes_attribute_statusesop,
)
from attio.types import BaseModel
from dataclasses import dataclass, field
import httpx
from typing import Optional


class PostV2TargetIdentifierAttributesAttributeStatusesSlugConflictErrorData(BaseModel):
    status_code: float
    type: models_post_v2_target_identifier_attributes_attribute_statusesop.PostV2TargetIdentifierAttributesAttributeStatusesConflictType
    code: models_post_v2_target_identifier_attributes_attribute_statusesop.PostV2TargetIdentifierAttributesAttributeStatusesConflictCode
    message: str


@dataclass(unsafe_hash=True)
class PostV2TargetIdentifierAttributesAttributeStatusesSlugConflictError(SDKError):
    r"""Conflict"""

    data: PostV2TargetIdentifierAttributesAttributeStatusesSlugConflictErrorData = (
        field(hash=False)
    )

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


class PostV2TargetIdentifierAttributesAttributeStatusesNotFoundErrorData(BaseModel):
    status_code: float
    type: models_post_v2_target_identifier_attributes_attribute_statusesop.PostV2TargetIdentifierAttributesAttributeStatusesNotFoundType
    code: models_post_v2_target_identifier_attributes_attribute_statusesop.PostV2TargetIdentifierAttributesAttributeStatusesNotFoundCode
    message: str


@dataclass(unsafe_hash=True)
class PostV2TargetIdentifierAttributesAttributeStatusesNotFoundError(SDKError):
    r"""Not Found"""

    data: PostV2TargetIdentifierAttributesAttributeStatusesNotFoundErrorData = field(
        hash=False
    )

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


class PostV2TargetIdentifierAttributesAttributeStatusesValidationTypeErrorData(
    BaseModel
):
    status_code: float
    type: models_post_v2_target_identifier_attributes_attribute_statusesop.PostV2TargetIdentifierAttributesAttributeStatusesBadRequestType
    code: models_post_v2_target_identifier_attributes_attribute_statusesop.PostV2TargetIdentifierAttributesAttributeStatusesCodeValidationType
    message: str


@dataclass(unsafe_hash=True)
class PostV2TargetIdentifierAttributesAttributeStatusesValidationTypeError(SDKError):
    r"""Bad Request"""

    data: PostV2TargetIdentifierAttributesAttributeStatusesValidationTypeErrorData = (
        field(hash=False)
    )

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