"""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 getbyorgop as models_getbyorgop
from mesa_sdk.types import BaseModel
from typing import Optional


class GetByOrgInternalServerErrorData(BaseModel):
    error: models_getbyorgop.GetByOrgInternalServerErrorError


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

    data: GetByOrgInternalServerErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgInternalServerErrorData,
        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 GetByOrgConflictErrorData(BaseModel):
    error: models_getbyorgop.GetByOrgConflictError


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

    data: GetByOrgConflictErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgConflictErrorData,
        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 GetByOrgNotAcceptableErrorData(BaseModel):
    error: models_getbyorgop.GetByOrgNotAcceptableError


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

    data: GetByOrgNotAcceptableErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgNotAcceptableErrorData,
        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 GetByOrgNotFoundErrorData(BaseModel):
    error: models_getbyorgop.GetByOrgNotFoundError


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

    data: GetByOrgNotFoundErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgNotFoundErrorData,
        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 GetByOrgForbiddenErrorData(BaseModel):
    error: models_getbyorgop.GetByOrgForbiddenError


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

    data: GetByOrgForbiddenErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgForbiddenErrorData,
        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 GetByOrgUnauthorizedErrorData(BaseModel):
    error: models_getbyorgop.GetByOrgUnauthorizedError


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

    data: GetByOrgUnauthorizedErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgUnauthorizedErrorData,
        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 GetByOrgBadRequestErrorData(BaseModel):
    error: models_getbyorgop.GetByOrgBadRequestError


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

    data: GetByOrgBadRequestErrorData = field(hash=False)

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