package com.bernard.greposimu.model.simulator.command;

import com.bernard.greposimu.model.game.Building;
import com.bernard.greposimu.model.game.Resources;

public class BuildCommand extends TownCommand {

	Building building;
	
	// Destination level of the build
	int level;
	
	boolean tearingDown;

	public BuildCommand(int town, Resources need, Building building, int level, boolean tearingDown) {
		this.town = town;
		this.need = need;
		this.building = building;
		this.level = level;
		this.tearingDown = tearingDown;
	}
	
	@Override
	public String toString() {
		if(tearingDown)
			return "[%d] Destroy %s from %d -> %d".formatted(this.town,this.building.name(),this.level+1,this.level);
		else
			return "[%d] Build %s from %d -> %d".formatted(this.town,this.building.name(),this.level-1,this.level);
	}
	
}
