"""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_optionsop as models_post_v2_target_identifier_attributes_attribute_optionsop,
)
from attio.types import BaseModel
from dataclasses import dataclass, field
import httpx
from typing import Optional


class PostV2TargetIdentifierAttributesAttributeOptionsSlugConflictErrorData(BaseModel):
    status_code: float
    type: models_post_v2_target_identifier_attributes_attribute_optionsop.PostV2TargetIdentifierAttributesAttributeOptionsConflictType
    code: models_post_v2_target_identifier_attributes_attribute_optionsop.PostV2TargetIdentifierAttributesAttributeOptionsConflictCode
    message: str


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

    data: PostV2TargetIdentifierAttributesAttributeOptionsSlugConflictErrorData = field(
        hash=False
    )

    def __init__(
        self,
        data: PostV2TargetIdentifierAttributesAttributeOptionsSlugConflictErrorData,
        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 PostV2TargetIdentifierAttributesAttributeOptionsNotFoundErrorData(BaseModel):
    status_code: float
    type: models_post_v2_target_identifier_attributes_attribute_optionsop.PostV2TargetIdentifierAttributesAttributeOptionsNotFoundType
    code: models_post_v2_target_identifier_attributes_attribute_optionsop.PostV2TargetIdentifierAttributesAttributeOptionsNotFoundCode
    message: str


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

    data: PostV2TargetIdentifierAttributesAttributeOptionsNotFoundErrorData = field(
        hash=False
    )

    def __init__(
        self,
        data: PostV2TargetIdentifierAttributesAttributeOptionsNotFoundErrorData,
        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 PostV2TargetIdentifierAttributesAttributeOptionsValidationTypeErrorData(
    BaseModel
):
    status_code: float
    type: models_post_v2_target_identifier_attributes_attribute_optionsop.PostV2TargetIdentifierAttributesAttributeOptionsBadRequestType
    code: models_post_v2_target_identifier_attributes_attribute_optionsop.PostV2TargetIdentifierAttributesAttributeOptionsCodeValidationType
    message: str


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

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

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