package sfs.cluster.lobby.data;

import java.util.HashMap;
import java.util.Map;

/**
 * ClusterEvent objects are passed between nodes to notify changes in the status of the cluster
 * or to send specific messages between nodes.
 */
public class ClusterEvent
{
	public static final String ON_FRIEND_LIST_UPDATE = "onFriendListUpdate";
	public static final String ON_PRIVATE_MESSAGE = "onPrivateMessage";
	public static final String ON_CREATE_GAME = "onCreateGame";
	public static final String ON_JOIN_GAME = "onJoinGame";
	public static final String ON_ROOM_CREATED = "onRoomCreated";
	public static final String ON_ROOM_DESTROYED = "onRoomDestroyed";
	public static final String ON_GAME_UPDATE = "onGameUpdate";
	public static final String ON_BATCH_USER_REMOVE = "onBatchUserRemove";
	
	private String eventName;
	private Map<String, Object> params;
	
	public ClusterEvent(String eventName)
    {
		this.eventName = eventName;
		this.params = new HashMap<String, Object>();
	}
	
	/**
	 * Get the name of the event
	 * @return	the name of the event
	 */
	public String getEventName()
    {
    	return eventName;
    }
	
	/**
	 * Get the parameters associated with the event
	 * @return	the parameters map
	 */
	public Map<String, Object> getParams()
    {
    	return params;
    }
	
	@Override
	public String toString()
	{
		return String.format("{ CLUSTER EVENT: %s -> %s }", eventName, params );
	}
}
