//= require <mootools-core-1.3-full-nocompat>
//= require <puremvc-mootools-port>
//= require <findsalons/ApplicationFacade>
//= require <findsalons/RetrieveContentCommand>
//= require <findsalons/StartupCommand>
//= require <findsalons/RetrieveListingCommand>
//= require <findsalons/RetrieveListingPreviewCommand>
//= require <findsalons/RetrieveCurrentHashCommand>

var ApplicationFacade = function()
{
	this.Extends = new Class(new Facade());

	this.initializeController = function()
	{
		this.parent();

		this.registerCommand(ApplicationFacade.STARTUP, StartupCommand);
		this.registerCommand(ApplicationFacade.URL_CHANGE, RetrieveContentCommand);
		this.registerCommand(ApplicationFacade.RETRIEVE_LISTING_SUMMARY, RetrieveListingPreviewCommand);
		this.registerCommand(ApplicationFacade.RETRIEVE_CURRENT_HASH, RetrieveCurrentHashCommand);
	};

	/**
	 * Startup method the the system
	 * 
	 * @param viewComponent
	 *            FindSalon instance used as the vew.
	 */
	this.startup = function(viewComponent /* FindSalons */)
	{
		this.sendNotification(ApplicationFacade.STARTUP, viewComponent);
	};
};

ApplicationFacade.STARTUP = "startup";
ApplicationFacade.SET_HASH = "setHash";
ApplicationFacade.URL_CHANGE = "urlChange";
ApplicationFacade.RETRIEVE_CURRENT_HASH = "retrieveCurrentHash";
ApplicationFacade.HASH_RETRIEVED = "hashRetrieved";
ApplicationFacade.BREADCRUMB_DATA_CHANGED = "breadcrumbDataChanged";
ApplicationFacade.RETRIEVE_LISTING_SUMMARY = "retrieveListingSummary";
ApplicationFacade.EDIT_LISTING = "editListing";
/**
 * Singleton implementation for the ApplicationFacade.
 */
ApplicationFacade.getInstance = function()
{
	if (Facade.instance == undefined)
	{
		// The classFactory is used as a descriptor for the ApplicatonFacade
		// when hierarchical relationships are required as in this case.
		var classFactory = new Class(new ApplicationFacade());
		Facade.instance = new classFactory();
	}
	return Facade.instance;
};
