#pragma once

#include "network/IProtocolHandler.h"
#include "caveexpress/server/map/Map.h"

namespace caveexpress {

class StartMapHandler: public IServerProtocolHandler {
private:
	Map& _map;
public:
	StartMapHandler (Map& map) :
			_map(map)
	{
	}

	void execute (const ClientId& clientId, const IProtocolMessage& message) override
	{
		if (!_map.isReadyToStart()) {
			_map.sendMessage(clientId, "Not enough players yet");
			return;
		}
		_map.startMap();
	}
};

}
