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


class PatchByOrgByRepoInternalServerErrorData(BaseModel):
    error: models_patchbyorgbyrepoop.PatchByOrgByRepoInternalServerErrorError


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

    data: PatchByOrgByRepoInternalServerErrorData = field(hash=False)

    def __init__(
        self,
        data: PatchByOrgByRepoInternalServerErrorData,
        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 PatchByOrgByRepoConflictErrorData(BaseModel):
    error: models_patchbyorgbyrepoop.PatchByOrgByRepoConflictError


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

    data: PatchByOrgByRepoConflictErrorData = field(hash=False)

    def __init__(
        self,
        data: PatchByOrgByRepoConflictErrorData,
        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 PatchByOrgByRepoNotAcceptableErrorData(BaseModel):
    error: models_patchbyorgbyrepoop.PatchByOrgByRepoNotAcceptableError


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

    data: PatchByOrgByRepoNotAcceptableErrorData = field(hash=False)

    def __init__(
        self,
        data: PatchByOrgByRepoNotAcceptableErrorData,
        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 PatchByOrgByRepoNotFoundErrorData(BaseModel):
    error: models_patchbyorgbyrepoop.PatchByOrgByRepoNotFoundError


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

    data: PatchByOrgByRepoNotFoundErrorData = field(hash=False)

    def __init__(
        self,
        data: PatchByOrgByRepoNotFoundErrorData,
        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 PatchByOrgByRepoForbiddenErrorData(BaseModel):
    error: models_patchbyorgbyrepoop.PatchByOrgByRepoForbiddenError


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

    data: PatchByOrgByRepoForbiddenErrorData = field(hash=False)

    def __init__(
        self,
        data: PatchByOrgByRepoForbiddenErrorData,
        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 PatchByOrgByRepoUnauthorizedErrorData(BaseModel):
    error: models_patchbyorgbyrepoop.PatchByOrgByRepoUnauthorizedError


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

    data: PatchByOrgByRepoUnauthorizedErrorData = field(hash=False)

    def __init__(
        self,
        data: PatchByOrgByRepoUnauthorizedErrorData,
        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 PatchByOrgByRepoBadRequestErrorData(BaseModel):
    error: models_patchbyorgbyrepoop.PatchByOrgByRepoBadRequestError


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

    data: PatchByOrgByRepoBadRequestErrorData = field(hash=False)

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