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

from __future__ import annotations
from enum import Enum
from polar_sdk import utils
from polar_sdk.types import BaseModel
import pydantic
from typing import Final
from typing_extensions import Annotated


class UnauthorizedType(str, Enum):
    UNAUTHORIZED = "Unauthorized"


class UnauthorizedData(BaseModel):
    detail: str

    # fmt: off
    TYPE: Annotated[Final[UnauthorizedType], pydantic.Field(alias="type")] = UnauthorizedType.UNAUTHORIZED # type: ignore
    # fmt: on


class Unauthorized(Exception):
    r"""Not authorized to manage license key."""

    data: UnauthorizedData

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

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