from Classes.Objects.Player import Player


class QueueManager:
    __queue:list

    def __init__(self):
        self.__queue = []

    def getQueue(self) -> list:
        return self.__queue

    def addToQueue(self, user) -> list:
        if self.isInQueue(user["id"]):
            self.__queue.append(user)
            return self.__queue

    def removeFromQueue(self, player:Player) -> list:
        self.__queue.remove(player)
        return self.__queue

    def isInQueue(self, user:int) -> bool:
        for user in self.__queue:
            if int(user["id"]) == user:
                return True
        return False
            
    def isInQueue(self, user:str) -> bool:
        for user in self.__queue:
            if user["username"] == user:
                return True
        return False