"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from ascend_sdk import utils
from ascend_sdk.models.components import (
    googleprotobufany as components_googleprotobufany,
)
from ascend_sdk.types import BaseModel
from typing import List, Optional


class StatusData(BaseModel):
    code: Optional[int] = None
    r"""The code field contains an enum value of google.rpc.Code."""

    details: Optional[List[components_googleprotobufany.GoogleProtobufAny]] = None
    r"""The details field contains one or more technical error details."""

    message: Optional[str] = None
    r"""The message field contains human-friendly messages about the error."""


class Status(Exception):
    r"""The status message serves as the general-purpose service error message. Each status message includes a gRPC error code, error message, and error details."""

    data: StatusData

    def __init__(self, data: StatusData):
        self.data = data

    def __str__(self) -> str:
        return utils.marshal_json(self.data, StatusData)
