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


class GetByOrgByRepoBranchesInternalServerErrorData(BaseModel):
    error: (
        models_getbyorgbyrepobranchesop.GetByOrgByRepoBranchesInternalServerErrorError
    )


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

    data: GetByOrgByRepoBranchesInternalServerErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoBranchesInternalServerErrorData,
        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 GetByOrgByRepoBranchesConflictErrorData(BaseModel):
    error: models_getbyorgbyrepobranchesop.GetByOrgByRepoBranchesConflictError


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

    data: GetByOrgByRepoBranchesConflictErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoBranchesConflictErrorData,
        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 GetByOrgByRepoBranchesNotAcceptableErrorData(BaseModel):
    error: models_getbyorgbyrepobranchesop.GetByOrgByRepoBranchesNotAcceptableError


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

    data: GetByOrgByRepoBranchesNotAcceptableErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoBranchesNotAcceptableErrorData,
        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 GetByOrgByRepoBranchesNotFoundErrorData(BaseModel):
    error: models_getbyorgbyrepobranchesop.GetByOrgByRepoBranchesNotFoundError


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

    data: GetByOrgByRepoBranchesNotFoundErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoBranchesNotFoundErrorData,
        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 GetByOrgByRepoBranchesForbiddenErrorData(BaseModel):
    error: models_getbyorgbyrepobranchesop.GetByOrgByRepoBranchesForbiddenError


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

    data: GetByOrgByRepoBranchesForbiddenErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoBranchesForbiddenErrorData,
        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 GetByOrgByRepoBranchesUnauthorizedErrorData(BaseModel):
    error: models_getbyorgbyrepobranchesop.GetByOrgByRepoBranchesUnauthorizedError


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

    data: GetByOrgByRepoBranchesUnauthorizedErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoBranchesUnauthorizedErrorData,
        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 GetByOrgByRepoBranchesBadRequestErrorData(BaseModel):
    error: models_getbyorgbyrepobranchesop.GetByOrgByRepoBranchesBadRequestError


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

    data: GetByOrgByRepoBranchesBadRequestErrorData = field(hash=False)

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