package jrummikub.control.turn;

import jrummikub.model.PlayerSettings;

/**
 * Creates a turn control for the active player, regarding if layer is human or
 * computer
 * 
 */
public abstract class TurnControlFactory {
	/**
	 * Creates a new turn control instance
	 * 
	 * @return the turn control
	 */
	public abstract ITurnControl create();

	/**
	 * returns the turn control factory for the specified type
	 * 
	 * @param type
	 *          Human or Computer
	 * @return TurnControlFactory for the player kind
	 */
	static public TurnControlFactory getFactory(PlayerSettings.Type type) {
		switch (type) {
			case HUMAN:
				return HumanTurnControl.getFactory();
			case COMPUTER:
				return AIControl.getFactory();
		}
		return null;
	}
}
