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


class PostByOrgByRepoSyncInternalServerErrorData(BaseModel):
    error: models_postbyorgbyreposyncop.PostByOrgByRepoSyncInternalServerErrorError


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

    data: PostByOrgByRepoSyncInternalServerErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoSyncInternalServerErrorData,
        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 PostByOrgByRepoSyncConflictErrorData(BaseModel):
    error: models_postbyorgbyreposyncop.PostByOrgByRepoSyncConflictError


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

    data: PostByOrgByRepoSyncConflictErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoSyncConflictErrorData,
        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 PostByOrgByRepoSyncNotAcceptableErrorData(BaseModel):
    error: models_postbyorgbyreposyncop.PostByOrgByRepoSyncNotAcceptableError


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

    data: PostByOrgByRepoSyncNotAcceptableErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoSyncNotAcceptableErrorData,
        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 PostByOrgByRepoSyncNotFoundErrorData(BaseModel):
    error: models_postbyorgbyreposyncop.PostByOrgByRepoSyncNotFoundError


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

    data: PostByOrgByRepoSyncNotFoundErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoSyncNotFoundErrorData,
        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 PostByOrgByRepoSyncForbiddenErrorData(BaseModel):
    error: models_postbyorgbyreposyncop.PostByOrgByRepoSyncForbiddenError


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

    data: PostByOrgByRepoSyncForbiddenErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoSyncForbiddenErrorData,
        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 PostByOrgByRepoSyncUnauthorizedErrorData(BaseModel):
    error: models_postbyorgbyreposyncop.PostByOrgByRepoSyncUnauthorizedError


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

    data: PostByOrgByRepoSyncUnauthorizedErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoSyncUnauthorizedErrorData,
        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 PostByOrgByRepoSyncBadRequestErrorData(BaseModel):
    error: models_postbyorgbyreposyncop.PostByOrgByRepoSyncBadRequestError


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

    data: PostByOrgByRepoSyncBadRequestErrorData = field(hash=False)

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