package dk.itu.mario.level.matcher;

import dk.itu.mario.level.LevelArchetype;
import dk.itu.mario.level.LevelArchetype.TYPE;
import dk.itu.mario.level.PlayerProfile;

public class ArchetypeMatcher {
	public static LevelArchetype getMatchingArchetype(
			PlayerProfile playerProfile) {
		System.out
				.println("Selecting PlayerProfile based on GamePlay metrics, DataRecorder logs.");

		TYPE levelType;
		int primarySkill;

		switch (playerProfile.getType()) {
		case BUMPER:
			levelType = TYPE.OVERGROUND;
			primarySkill = (int) Math
					.round(playerProfile.getBumpSkill() / 10.0);
			break;
		case COLLECTOR:
			levelType = TYPE.UNDERGROUND;
			primarySkill = (int) Math
					.round(playerProfile.getCollectSkill() / 10.0);
			break;
		case JUMPER:
			levelType = TYPE.CASTLE;
			primarySkill = (int) Math
					.round(playerProfile.getJumpSkill() / 10.0);
			break;
		case RUNNER:
			levelType = TYPE.OVERGROUND;
			primarySkill = (int) Math.round(playerProfile.getRunSkill() / 10.0);
			break;
		case SHOOTER:
			levelType = TYPE.UNDERGROUND;
			primarySkill = (int) Math
					.round(playerProfile.getShootSkill() / 10.0);
			break;
		default:
			levelType = TYPE.CASTLE;
			primarySkill = 1;
		}

		return new LevelArchetype(levelType, Math.max(primarySkill,1));
	}
}
