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


class PostByOrgByRepoBranchesInternalServerErrorData(BaseModel):
    error: (
        models_postbyorgbyrepobranchesop.PostByOrgByRepoBranchesInternalServerErrorError
    )


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

    data: PostByOrgByRepoBranchesInternalServerErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoBranchesInternalServerErrorData,
        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 PostByOrgByRepoBranchesConflictErrorData(BaseModel):
    error: models_postbyorgbyrepobranchesop.PostByOrgByRepoBranchesConflictError


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

    data: PostByOrgByRepoBranchesConflictErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoBranchesConflictErrorData,
        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 PostByOrgByRepoBranchesNotAcceptableErrorData(BaseModel):
    error: models_postbyorgbyrepobranchesop.PostByOrgByRepoBranchesNotAcceptableError


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

    data: PostByOrgByRepoBranchesNotAcceptableErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoBranchesNotAcceptableErrorData,
        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 PostByOrgByRepoBranchesNotFoundErrorData(BaseModel):
    error: models_postbyorgbyrepobranchesop.PostByOrgByRepoBranchesNotFoundError


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

    data: PostByOrgByRepoBranchesNotFoundErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoBranchesNotFoundErrorData,
        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 PostByOrgByRepoBranchesForbiddenErrorData(BaseModel):
    error: models_postbyorgbyrepobranchesop.PostByOrgByRepoBranchesForbiddenError


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

    data: PostByOrgByRepoBranchesForbiddenErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoBranchesForbiddenErrorData,
        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 PostByOrgByRepoBranchesUnauthorizedErrorData(BaseModel):
    error: models_postbyorgbyrepobranchesop.PostByOrgByRepoBranchesUnauthorizedError


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

    data: PostByOrgByRepoBranchesUnauthorizedErrorData = field(hash=False)

    def __init__(
        self,
        data: PostByOrgByRepoBranchesUnauthorizedErrorData,
        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 PostByOrgByRepoBranchesBadRequestErrorData(BaseModel):
    error: models_postbyorgbyrepobranchesop.PostByOrgByRepoBranchesBadRequestError


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

    data: PostByOrgByRepoBranchesBadRequestErrorData = field(hash=False)

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