from abc import ABCMeta, abstractmethod
from enum import Enum, auto


class AbstractCommand(metaclass=ABCMeta):
    """
    This is the base class for commands. In order to load a command a few conditions must be met:
    1) The class name MUST begin with 'Command' i.e. CommandTTS, CommandBan, etc...
    2) the class MUST extend AbstractCommand

    Generally, it would be advisable to define the command (something like !so, !tts, !songrequest) as a variable of the
    class and to then call super().__init__(command)
    """

    class CommandType(Enum):
        NONE = auto()
        Praxis = auto()
        TWITCH = auto()
        DISCORD = auto()
        Ver2 = auto()

    class CommandSource(Enum):
        default = 0
        Praxis = 1
        Twitch = 2
        Discord = 3

    def __init__(self, command: str, n_args: int = 0, command_type=CommandType.NONE, helpText:list=["No Help"], CommandEnabled = True):
        self.command = command
        self.n_args = n_args
        self.command_type = command_type
        self.help = helpText
        self.isCommandEnabled = CommandEnabled

    # no touch!
    def get_args(self, text: str) -> list:
        return text.split(" ")[0:self.n_args + 1]

    # no touch!
    def get_command(self) -> str:
        return self.command

    # no touch!
    def get_commandType(self):
        return self.command_type

    # no touch!
    def get_help(self):
        return self.help

    # no touch!
    def is_command_enabled(self):
        return self.isCommandEnabled

    @abstractmethod
    def do_command(self, source, user, command, rest, bonusData):
        pass