room {
    id= "INT",
    player = [cle,valeur], // cle -> player || valeur -> nombre de points  (possible de JSON ça)
    deck = Deck
    settings = 
    {
        isHyperSet = BOOL,
        isPublic = BOOL,
        nbCards = INT,
        nbAttribs = INT,
        nbPlayers = INT
    }
}


fonctions = 
{
    checkFull()
    {
        return player.length === setting.nbPlayers
    }

    // utile pour enchainer les appel quand t'es sur de toi
    getRoom(id)
    {
        let res = rooms.filter(element => e.id===id)
        if(res)
        {
            return res;
        }
        else{
            return false;
        }
    }

    createRoom(socket)
    {
        if(!getRoom(socket.id))
        {
            rooms.push({
                id=id,
                player=socket.nom,
                deck = new Deck().create(),
                settings{
                    isHyperSet = socket.hyper,
                    isPublic = socket.public,
                    nbCards = socket.cards,
                    nbAttribs = socket.attribs,
                    nbPlayer = 1
                }
            })
        }
    }


    // LeaveRoom
    leaveRoom(){
        let room = getRoom(rooms,id);
        if(room.player.length === 1)
        {
            // Trouver une solution pour remove une room
        }
        else
        {
            let index = room.player.indexOf(idUser)
            room.player.slice(index,1)
        }
    }


    joinRoom(id)
    {
        let room = getRoom(id);
        if(!room)
        {
            return false;
        }
        if(room.setting.isPublic && room.player.length < room.setting.nbPlayer)
        {
            room.player.push(id)
            return true
        }
        return false;
    }



}
