"""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 (
    getbyorgbyrepocommitsbyshaop as models_getbyorgbyrepocommitsbyshaop,
)
from mesa_sdk.types import BaseModel
from typing import Optional


class GetByOrgByRepoCommitsByShaInternalServerErrorData(BaseModel):
    error: models_getbyorgbyrepocommitsbyshaop.GetByOrgByRepoCommitsByShaInternalServerErrorError


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

    data: GetByOrgByRepoCommitsByShaInternalServerErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoCommitsByShaInternalServerErrorData,
        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 GetByOrgByRepoCommitsByShaConflictErrorData(BaseModel):
    error: models_getbyorgbyrepocommitsbyshaop.GetByOrgByRepoCommitsByShaConflictError


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

    data: GetByOrgByRepoCommitsByShaConflictErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoCommitsByShaConflictErrorData,
        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 GetByOrgByRepoCommitsByShaNotAcceptableErrorData(BaseModel):
    error: (
        models_getbyorgbyrepocommitsbyshaop.GetByOrgByRepoCommitsByShaNotAcceptableError
    )


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

    data: GetByOrgByRepoCommitsByShaNotAcceptableErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoCommitsByShaNotAcceptableErrorData,
        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 GetByOrgByRepoCommitsByShaNotFoundErrorData(BaseModel):
    error: models_getbyorgbyrepocommitsbyshaop.GetByOrgByRepoCommitsByShaNotFoundError


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

    data: GetByOrgByRepoCommitsByShaNotFoundErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoCommitsByShaNotFoundErrorData,
        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 GetByOrgByRepoCommitsByShaForbiddenErrorData(BaseModel):
    error: models_getbyorgbyrepocommitsbyshaop.GetByOrgByRepoCommitsByShaForbiddenError


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

    data: GetByOrgByRepoCommitsByShaForbiddenErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoCommitsByShaForbiddenErrorData,
        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 GetByOrgByRepoCommitsByShaUnauthorizedErrorData(BaseModel):
    error: (
        models_getbyorgbyrepocommitsbyshaop.GetByOrgByRepoCommitsByShaUnauthorizedError
    )


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

    data: GetByOrgByRepoCommitsByShaUnauthorizedErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoCommitsByShaUnauthorizedErrorData,
        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 GetByOrgByRepoCommitsByShaBadRequestErrorData(BaseModel):
    error: models_getbyorgbyrepocommitsbyshaop.GetByOrgByRepoCommitsByShaBadRequestError


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

    data: GetByOrgByRepoCommitsByShaBadRequestErrorData = field(hash=False)

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