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


class PostByOrgByRepoCommitsInternalServerErrorData(BaseModel):
    error: (
        models_postbyorgbyrepocommitsop.PostByOrgByRepoCommitsInternalServerErrorError
    )


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

    data: PostByOrgByRepoCommitsInternalServerErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoCommitsInternalServerErrorData,
        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 PostByOrgByRepoCommitsConflictErrorData(BaseModel):
    error: models_postbyorgbyrepocommitsop.PostByOrgByRepoCommitsConflictError


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

    data: PostByOrgByRepoCommitsConflictErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoCommitsConflictErrorData,
        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 PostByOrgByRepoCommitsNotAcceptableErrorData(BaseModel):
    error: models_postbyorgbyrepocommitsop.PostByOrgByRepoCommitsNotAcceptableError


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

    data: PostByOrgByRepoCommitsNotAcceptableErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoCommitsNotAcceptableErrorData,
        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 PostByOrgByRepoCommitsNotFoundErrorData(BaseModel):
    error: models_postbyorgbyrepocommitsop.PostByOrgByRepoCommitsNotFoundError


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

    data: PostByOrgByRepoCommitsNotFoundErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoCommitsNotFoundErrorData,
        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 PostByOrgByRepoCommitsForbiddenErrorData(BaseModel):
    error: models_postbyorgbyrepocommitsop.PostByOrgByRepoCommitsForbiddenError


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

    data: PostByOrgByRepoCommitsForbiddenErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoCommitsForbiddenErrorData,
        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 PostByOrgByRepoCommitsUnauthorizedErrorData(BaseModel):
    error: models_postbyorgbyrepocommitsop.PostByOrgByRepoCommitsUnauthorizedError


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

    data: PostByOrgByRepoCommitsUnauthorizedErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoCommitsUnauthorizedErrorData,
        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 PostByOrgByRepoCommitsBadRequestErrorData(BaseModel):
    error: models_postbyorgbyrepocommitsop.PostByOrgByRepoCommitsBadRequestError


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

    data: PostByOrgByRepoCommitsBadRequestErrorData = field(hash=False)

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