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


class GetByOrgByRepoWebhooksInternalServerErrorData(BaseModel):
    error: (
        models_getbyorgbyrepowebhooksop.GetByOrgByRepoWebhooksInternalServerErrorError
    )


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

    data: GetByOrgByRepoWebhooksInternalServerErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoWebhooksInternalServerErrorData,
        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 GetByOrgByRepoWebhooksConflictErrorData(BaseModel):
    error: models_getbyorgbyrepowebhooksop.GetByOrgByRepoWebhooksConflictError


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

    data: GetByOrgByRepoWebhooksConflictErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoWebhooksConflictErrorData,
        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 GetByOrgByRepoWebhooksNotAcceptableErrorData(BaseModel):
    error: models_getbyorgbyrepowebhooksop.GetByOrgByRepoWebhooksNotAcceptableError


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

    data: GetByOrgByRepoWebhooksNotAcceptableErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoWebhooksNotAcceptableErrorData,
        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 GetByOrgByRepoWebhooksNotFoundErrorData(BaseModel):
    error: models_getbyorgbyrepowebhooksop.GetByOrgByRepoWebhooksNotFoundError


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

    data: GetByOrgByRepoWebhooksNotFoundErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoWebhooksNotFoundErrorData,
        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 GetByOrgByRepoWebhooksForbiddenErrorData(BaseModel):
    error: models_getbyorgbyrepowebhooksop.GetByOrgByRepoWebhooksForbiddenError


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

    data: GetByOrgByRepoWebhooksForbiddenErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoWebhooksForbiddenErrorData,
        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 GetByOrgByRepoWebhooksUnauthorizedErrorData(BaseModel):
    error: models_getbyorgbyrepowebhooksop.GetByOrgByRepoWebhooksUnauthorizedError


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

    data: GetByOrgByRepoWebhooksUnauthorizedErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoWebhooksUnauthorizedErrorData,
        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 GetByOrgByRepoWebhooksBadRequestErrorData(BaseModel):
    error: models_getbyorgbyrepowebhooksop.GetByOrgByRepoWebhooksBadRequestError


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

    data: GetByOrgByRepoWebhooksBadRequestErrorData = field(hash=False)

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