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


class GetByOrgByRepoAnalyticsInternalServerErrorData(BaseModel):
    error: (
        models_getbyorgbyrepoanalyticsop.GetByOrgByRepoAnalyticsInternalServerErrorError
    )


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

    data: GetByOrgByRepoAnalyticsInternalServerErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoAnalyticsInternalServerErrorData,
        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 GetByOrgByRepoAnalyticsConflictErrorData(BaseModel):
    error: models_getbyorgbyrepoanalyticsop.GetByOrgByRepoAnalyticsConflictError


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

    data: GetByOrgByRepoAnalyticsConflictErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoAnalyticsConflictErrorData,
        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 GetByOrgByRepoAnalyticsNotAcceptableErrorData(BaseModel):
    error: models_getbyorgbyrepoanalyticsop.GetByOrgByRepoAnalyticsNotAcceptableError


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

    data: GetByOrgByRepoAnalyticsNotAcceptableErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoAnalyticsNotAcceptableErrorData,
        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 GetByOrgByRepoAnalyticsNotFoundErrorData(BaseModel):
    error: models_getbyorgbyrepoanalyticsop.GetByOrgByRepoAnalyticsNotFoundError


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

    data: GetByOrgByRepoAnalyticsNotFoundErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoAnalyticsNotFoundErrorData,
        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 GetByOrgByRepoAnalyticsForbiddenErrorData(BaseModel):
    error: models_getbyorgbyrepoanalyticsop.GetByOrgByRepoAnalyticsForbiddenError


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

    data: GetByOrgByRepoAnalyticsForbiddenErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoAnalyticsForbiddenErrorData,
        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 GetByOrgByRepoAnalyticsUnauthorizedErrorData(BaseModel):
    error: models_getbyorgbyrepoanalyticsop.GetByOrgByRepoAnalyticsUnauthorizedError


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

    data: GetByOrgByRepoAnalyticsUnauthorizedErrorData = field(hash=False)

    def __init__(
        self,
        data: GetByOrgByRepoAnalyticsUnauthorizedErrorData,
        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 GetByOrgByRepoAnalyticsBadRequestErrorData(BaseModel):
    error: models_getbyorgbyrepoanalyticsop.GetByOrgByRepoAnalyticsBadRequestError


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

    data: GetByOrgByRepoAnalyticsBadRequestErrorData = field(hash=False)

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