from __future__ import annotations

from enum import Enum, auto


class RollbotFailureException(BaseException):
    def __init__(self, failure: RollbotFailure, detail: str | None):
        super().__init__()
        self.failure = failure
        self.detail = detail


class RollbotFailure(Enum):
    INVALID_COMMAND = auto()
    MISSING_SUBCOMMAND = auto()
    INVALID_SUBCOMMAND = auto()
    INVALID_ARGUMENTS = auto()
    SERVICE_DOWN = auto()
    PERMISSIONS = auto()
    INTERNAL_ERROR = auto()

    def raise_exc(self, detail: str | None = None):
        raise RollbotFailureException(self, detail)
