package com.gamepatriot.androidframework.framework;

import android.app.Activity;

/**
 * An AndroidMain implementation should behave as the application's primary {@link Activity}. In addition, the AndroidMain class should provide reference requests to each of the primary components of
 * the application ({@link AndroidAtlas}, {@link AndroidInputter}, {@link AndroidMusicHandler}, {@link AndroidSoundHandler}, {@link AndroidGameData}, and {@link AndroidRenderer}).
 * 
 * @author Pete Schmitz, May 9, 2013
 *
 */
public interface AndroidMain {
	
	/**
	 * Constructor for application-specific initializations.
	 */
	public void constructGame();
	
	/**
	 * Add the supplied {@link AndroidScreen} to this AndroidMain's draw routine.
	 * @param $screen		The AndroidScreen to add.
	 */
	public void addScreen(AndroidScreen $screen);
	
	/**
	 * Add the supplied {@link AndroidScreen} at the specified location to this AndroidMain's draw routine.
	 * @param $index		The index to add the supplied AndroidScreen.
	 * @param $screen		The AndroidScreen to add.
	 */
	public void addScreenAt(int $index, AndroidScreen $screen);
	
	/**
	 * Remove the supplied {@link AndroidScreen} from this AndroidMain's draw routine.
	 * @param $screen		The AndroidScreen to be removed.
	 * @return				Whether or not a removal process was necessary to remove the AndroidScreen.
	 */
	public boolean removeScreen(AndroidScreen $screen);
	
	/** Queue a screen removal from this AndoirdMain's display list. **/
	public void queueScreenRemoval(AndroidScreen $screen);
	
	/** Queue a screen removal from this AndoirdMain's display list. **/
	public void queueScreenAddition(AndroidScreen $screen);
	
	/** Remove screens queued for removal. **/
	public void clearQueueRemoval();
	
	/**
	 * Remove and return an {@link AndroidScreen} at the supplied index.
	 * @param $index		The index location of AndroidMain's draw routine to remove and return.
	 * @return				The AndroidScreen that was successfully removed; null if out of index bounds.
	 */
	public AndroidScreen removeScreenAt(int $index);
	
	/**
	 * Find where the requested {@link AndroidScreen} is currently indexed in this AndroidMain's draw routine.
	 * @param $screen		The requested AndroidScreen to locate.
	 * @return				The index that this AndroidScreen will be drawn at; -1 if this AndroidMain isn't the parent of the supplied AndroidScreen.
	 */
	public int getScreenIndex(AndroidScreen $screen);
	
	/**
	 * Remove all {@link AndroidScreen}s currently attached to this AndroidMain.
	 */
	public void removeScreens();
	
	/** Get the inputter associated with this AndroidMain. **/
	public AndroidInputter getInputter();
	
	/** Get the music handler associated with this AndroidMain .**/
	public AndroidMusicHandler getMusic();
	
	/** Get the sound handler associated with this AndroidMain. **/
	public AndroidSoundHandler getSound();
	
	/** Get the gamedata associated with this AndroidMain. **/
	public AndroidGameData getGameData();
	
	/** Get the renderer associated with this AndroidMain. **/
	public AndroidRenderer getRenderer();
	
	/** Stops this application and activity. **/
	public void stop();
	
}
