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

from __future__ import annotations
from dataclasses import dataclass, field
import httpx
from mesa_sdk.errors import MesaError
from mesa_sdk.models import postbyorgapikeysop as models_postbyorgapikeysop
from mesa_sdk.types import BaseModel
from typing import Optional


class PostByOrgAPIKeysInternalServerErrorData(BaseModel):
    error: models_postbyorgapikeysop.PostByOrgAPIKeysInternalServerErrorError


@dataclass(unsafe_hash=True)
class PostByOrgAPIKeysInternalServerError(MesaError):
    r"""Internal error"""

    data: PostByOrgAPIKeysInternalServerErrorData = field(hash=False)

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


class PostByOrgAPIKeysConflictErrorData(BaseModel):
    error: models_postbyorgapikeysop.PostByOrgAPIKeysConflictError


@dataclass(unsafe_hash=True)
class PostByOrgAPIKeysConflictError(MesaError):
    r"""Conflict"""

    data: PostByOrgAPIKeysConflictErrorData = field(hash=False)

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


class PostByOrgAPIKeysNotAcceptableErrorData(BaseModel):
    error: models_postbyorgapikeysop.PostByOrgAPIKeysNotAcceptableError


@dataclass(unsafe_hash=True)
class PostByOrgAPIKeysNotAcceptableError(MesaError):
    r"""Not acceptable"""

    data: PostByOrgAPIKeysNotAcceptableErrorData = field(hash=False)

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


class PostByOrgAPIKeysNotFoundErrorData(BaseModel):
    error: models_postbyorgapikeysop.PostByOrgAPIKeysNotFoundError


@dataclass(unsafe_hash=True)
class PostByOrgAPIKeysNotFoundError(MesaError):
    r"""Not found"""

    data: PostByOrgAPIKeysNotFoundErrorData = field(hash=False)

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


class PostByOrgAPIKeysForbiddenErrorData(BaseModel):
    error: models_postbyorgapikeysop.PostByOrgAPIKeysForbiddenError


@dataclass(unsafe_hash=True)
class PostByOrgAPIKeysForbiddenError(MesaError):
    r"""Forbidden"""

    data: PostByOrgAPIKeysForbiddenErrorData = field(hash=False)

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


class PostByOrgAPIKeysUnauthorizedErrorData(BaseModel):
    error: models_postbyorgapikeysop.PostByOrgAPIKeysUnauthorizedError


@dataclass(unsafe_hash=True)
class PostByOrgAPIKeysUnauthorizedError(MesaError):
    r"""Unauthorized"""

    data: PostByOrgAPIKeysUnauthorizedErrorData = field(hash=False)

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


class PostByOrgAPIKeysBadRequestErrorData(BaseModel):
    error: models_postbyorgapikeysop.PostByOrgAPIKeysBadRequestError


@dataclass(unsafe_hash=True)
class PostByOrgAPIKeysBadRequestError(MesaError):
    r"""Invalid request"""

    data: PostByOrgAPIKeysBadRequestErrorData = field(hash=False)

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