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


class PostByOrgReposInternalServerErrorData(BaseModel):
    error: models_postbyorgreposop.PostByOrgReposInternalServerErrorError


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

    data: PostByOrgReposInternalServerErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgReposInternalServerErrorData,
        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 PostByOrgReposConflictErrorData(BaseModel):
    error: models_postbyorgreposop.PostByOrgReposConflictError


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

    data: PostByOrgReposConflictErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgReposConflictErrorData,
        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 PostByOrgReposNotAcceptableErrorData(BaseModel):
    error: models_postbyorgreposop.PostByOrgReposNotAcceptableError


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

    data: PostByOrgReposNotAcceptableErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgReposNotAcceptableErrorData,
        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 PostByOrgReposNotFoundErrorData(BaseModel):
    error: models_postbyorgreposop.PostByOrgReposNotFoundError


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

    data: PostByOrgReposNotFoundErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgReposNotFoundErrorData,
        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 PostByOrgReposForbiddenErrorData(BaseModel):
    error: models_postbyorgreposop.PostByOrgReposForbiddenError


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

    data: PostByOrgReposForbiddenErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgReposForbiddenErrorData,
        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 PostByOrgReposUnauthorizedErrorData(BaseModel):
    error: models_postbyorgreposop.PostByOrgReposUnauthorizedError


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

    data: PostByOrgReposUnauthorizedErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgReposUnauthorizedErrorData,
        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 PostByOrgReposBadRequestErrorData(BaseModel):
    error: models_postbyorgreposop.PostByOrgReposBadRequestError


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

    data: PostByOrgReposBadRequestErrorData = field(hash=False)

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