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


class GetByOrgByRepoInternalServerErrorData(BaseModel):
    error: models_getbyorgbyrepoop.GetByOrgByRepoInternalServerErrorError


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

    data: GetByOrgByRepoInternalServerErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoInternalServerErrorData,
        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 GetByOrgByRepoConflictErrorData(BaseModel):
    error: models_getbyorgbyrepoop.GetByOrgByRepoConflictError


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

    data: GetByOrgByRepoConflictErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoConflictErrorData,
        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 GetByOrgByRepoNotAcceptableErrorData(BaseModel):
    error: models_getbyorgbyrepoop.GetByOrgByRepoNotAcceptableError


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

    data: GetByOrgByRepoNotAcceptableErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoNotAcceptableErrorData,
        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 GetByOrgByRepoNotFoundErrorData(BaseModel):
    error: models_getbyorgbyrepoop.GetByOrgByRepoNotFoundError


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

    data: GetByOrgByRepoNotFoundErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoNotFoundErrorData,
        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 GetByOrgByRepoForbiddenErrorData(BaseModel):
    error: models_getbyorgbyrepoop.GetByOrgByRepoForbiddenError


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

    data: GetByOrgByRepoForbiddenErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoForbiddenErrorData,
        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 GetByOrgByRepoUnauthorizedErrorData(BaseModel):
    error: models_getbyorgbyrepoop.GetByOrgByRepoUnauthorizedError


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

    data: GetByOrgByRepoUnauthorizedErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoUnauthorizedErrorData,
        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 GetByOrgByRepoBadRequestErrorData(BaseModel):
    error: models_getbyorgbyrepoop.GetByOrgByRepoBadRequestError


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

    data: GetByOrgByRepoBadRequestErrorData = field(hash=False)

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