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


class PostByOrgByRepoWebhooksInternalServerErrorData(BaseModel):
    error: (
        models_postbyorgbyrepowebhooksop.PostByOrgByRepoWebhooksInternalServerErrorError
    )


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

    data: PostByOrgByRepoWebhooksInternalServerErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoWebhooksInternalServerErrorData,
        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 PostByOrgByRepoWebhooksConflictErrorData(BaseModel):
    error: models_postbyorgbyrepowebhooksop.PostByOrgByRepoWebhooksConflictError


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

    data: PostByOrgByRepoWebhooksConflictErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoWebhooksConflictErrorData,
        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 PostByOrgByRepoWebhooksNotAcceptableErrorData(BaseModel):
    error: models_postbyorgbyrepowebhooksop.PostByOrgByRepoWebhooksNotAcceptableError


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

    data: PostByOrgByRepoWebhooksNotAcceptableErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoWebhooksNotAcceptableErrorData,
        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 PostByOrgByRepoWebhooksNotFoundErrorData(BaseModel):
    error: models_postbyorgbyrepowebhooksop.PostByOrgByRepoWebhooksNotFoundError


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

    data: PostByOrgByRepoWebhooksNotFoundErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoWebhooksNotFoundErrorData,
        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 PostByOrgByRepoWebhooksForbiddenErrorData(BaseModel):
    error: models_postbyorgbyrepowebhooksop.PostByOrgByRepoWebhooksForbiddenError


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

    data: PostByOrgByRepoWebhooksForbiddenErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoWebhooksForbiddenErrorData,
        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 PostByOrgByRepoWebhooksUnauthorizedErrorData(BaseModel):
    error: models_postbyorgbyrepowebhooksop.PostByOrgByRepoWebhooksUnauthorizedError


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

    data: PostByOrgByRepoWebhooksUnauthorizedErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoWebhooksUnauthorizedErrorData,
        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 PostByOrgByRepoWebhooksBadRequestErrorData(BaseModel):
    error: models_postbyorgbyrepowebhooksop.PostByOrgByRepoWebhooksBadRequestError


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

    data: PostByOrgByRepoWebhooksBadRequestErrorData = field(hash=False)

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