package org.sistema.spring.aspects.models;

import java.util.Random;

/**
 * Represents a circuit.
 * 
 * @author Eugenia Pérez Martínez
 *
 */
public class Circuit {

	private String name;
	private int distance;

	/**
	 * Creates a circuit.
	 * 
	 * @param name
	 * @param distance
	 */
	public Circuit(String name, int distance) {
		this.name = name;
		this.distance = distance;

	}

	/**
	 * returns random difficulty for karts
	 * 
	 * @return
	 */
	public int difficulty() {

		Random random = new Random();

		// just in 33% of the cases
		if (random.nextInt(3) == 0) {
			return random.nextInt(4);
		} else {
			return 0;
		}
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getDistance() {
		return distance;
	}

	public void setDistance(int distance) {
		this.distance = distance;
	}

	@Override
	public String toString() {
		return "Circuit [name=" + name + ", distance=" + distance + "]";
	}

}
