package dk.itu.mario.level;

import java.util.HashSet;
import java.util.Set;

public class PlayerProfile {
	//From Bartle/Yee models of player psychology: achiever, killer, explorer, manipulator
	public enum TYPE { BUMPER, COLLECTOR, RUNNER, SHOOTER, JUMPER}
	//Dreyfus model of skill acquisition:
	public enum SKILL_LEVEL { NOVICE, BEGINNER, COMPETENT, PROFICIENT, EXPERT}
	
	private Set<LevelComponent.TYPE> enabledComponents = new HashSet<LevelComponent.TYPE>();
	
	private SKILL_LEVEL skillLevel;
	private TYPE type;
	
	public PlayerProfile(SKILL_LEVEL skillLevel, TYPE type) {
		this.skillLevel = skillLevel;
		this .type = type;
	}
	
	public SKILL_LEVEL getSkillLevel() {
		return skillLevel;
	}
	
	public int getJumpSkill() {
		switch (type) {
			case JUMPER :
				switch (skillLevel) {
					case NOVICE :
						return 20;
					case BEGINNER :
						return 40;
					case COMPETENT :
						return 60;
					case PROFICIENT :
						return 80;
					case EXPERT :
						return 100;
					default :
						return 0;
				}
			default :
				return 0;
		}
	}
	
	public TYPE getType() {
		return type;
	}
	
	public void setDisabled(LevelComponent.TYPE type) {
		if (enabledComponents.contains(type)) {
			System.out.println("Component type disabled: " + type);
			enabledComponents.remove(type);
		}
	}
	
	public void setEnabled(LevelComponent.TYPE type) {
		if (!enabledComponents.contains(type)) {
			System.out.println("Component type enabled: " + type);
			enabledComponents.add(type);
		}
	}
	
	@Override
	public String toString() {
		return skillLevel + " " + type;
	}
}
