package dk.itu.mario.level.generator;

import java.util.Random;

import dk.itu.mario.MarioInterface.GamePlay;
import dk.itu.mario.MarioInterface.LevelGenerator;
import dk.itu.mario.MarioInterface.LevelInterface;
import dk.itu.mario.engine.DataRecorder;
import dk.itu.mario.level.Level;
import dk.itu.mario.level.PCGLevel;

public class PCGLevelGenerator  implements
		LevelGenerator {
	@Override
	public int generateLevelDifficulty(GamePlay playerMetrics, DataRecorder dataRecorder) {
		System.out.println("Generating level difficulty based on playerMetrics, dataRecorder: 1");
		return 1;
	}
	
	@Override
	public int generateLevelType(GamePlay playerMetrics, DataRecorder dataRecorder) {
		System.out.println("Generating level type based on playerMetrics, dataRecorder: TYPE_OVERGROUND");
		return Level.TYPE_OVERGROUND;
	}
	
	@Override
	public LevelInterface generateLevel(GamePlay playerMetrics) {
		System.out.println("Generating customized level");
		LevelInterface level = new PCGLevel(320, 15,
				new Random().nextLong(), generateLevelDifficulty(playerMetrics,DataRecorder.BLANK_RECORD), generateLevelType(playerMetrics,DataRecorder.BLANK_RECORD), playerMetrics);
		return level;
	}
	
	@Override
	public LevelInterface generateLevel(GamePlay playerMetrics, DataRecorder dataRecorder) {
		System.out.println("Generating customized level");
		LevelInterface level = new PCGLevel(320, 15,
				new Random().nextLong(), generateLevelDifficulty(playerMetrics,DataRecorder.BLANK_RECORD), generateLevelType(playerMetrics,dataRecorder), playerMetrics, dataRecorder);
		return level;
	}

	@Override
	public LevelInterface generateLevel(String detailedInfo) {
		throw new UnsupportedOperationException("Level generation from DataRecorder String not implemented.");
	}
}
