// Path: core/src/model/battlefield/army/components/UnitMemento.java
// public class UnitMemento {
// 	@JsonProperty
// 	private String builderID;
// 	@JsonProperty
// 	private String factionName;
// 	@JsonProperty
// 	private Point3D pos;
// 	@JsonProperty
// 	private double orientation;
// 
// 	public UnitMemento() {
// 
// 	}
// 
// 	public UnitMemento(Unit u) {
// 		builderID = u.builderID;
// 		factionName = u.faction.getName();
// 		pos = u.pos;
// 		orientation = u.getOrientation();
// 	}
// 
// 	public Unit getUnit(List<Faction> factions) {
// 		for(Faction f : factions) {
// 			if (f.getName().equals(factionName)) {
// 				Unit u = BuilderManager.getUnitBuilder(builderID).build(f, pos, orientation);
// 				u.drawOnBattlefield();
// 				return u;
// 			}
// 		}
// 		throw new RuntimeException("impossible to build unit, check faction names");
// 	}
// }


import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import model.battlefield.army.components.Unit;
import model.battlefield.army.components.UnitMemento;
import model.battlefield.warfare.Faction;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

package model.battlefield.army;




/**
 * Stores units and factions, and provide a serializable version of the initial situation
 */

public class Engagement {

	private static final Logger logger = Logger.getLogger(Engagement.class.getName());

	@JsonIgnore
	private List<Faction> factions = new ArrayList<>();

	@JsonProperty
	private List<UnitMemento> initialEngagement = new ArrayList<>();

	public Engagement() {
		Faction f1 = new Faction(Color.red, "1");
		Faction f2 = new Faction(Color.blue, "2");
		f1.setEnemy(f2);
		factions.add(f1);
		factions.add(f2);
	}

	public void reset() {
		logger.info("reseting engagement");
		ArmyManager.reset();


// Path: core/src/model/battlefield/army/components/UnitMemento.java
// public class UnitMemento {
// 	@JsonProperty
// 	private String builderID;
// 	@JsonProperty
// 	private String factionName;
// 	@JsonProperty
// 	private Point3D pos;
// 	@JsonProperty
// 	private double orientation;
// 
// 	public UnitMemento() {
// 
// 	}
// 
// 	public UnitMemento(Unit u) {
// 		builderID = u.builderID;
// 		factionName = u.faction.getName();
// 		pos = u.pos;
// 		orientation = u.getOrientation();
// 	}
// 
// 	public Unit getUnit(List<Faction> factions) {
// 		for(Faction f : factions) {
// 			if (f.getName().equals(factionName)) {
// 				Unit u = BuilderManager.getUnitBuilder(builderID).build(f, pos, orientation);
// 				u.drawOnBattlefield();
// 				return u;
// 			}
// 		}
// 		throw new RuntimeException("impossible to build unit, check faction names");
// 	}
// }


// Path: core/src/model/battlefield/army/Engagement.java
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import model.battlefield.army.components.Unit;
import model.battlefield.army.components.UnitMemento;
import model.battlefield.warfare.Faction;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

package model.battlefield.army;




/**
 * Stores units and factions, and provide a serializable version of the initial situation
 */

public class Engagement {

	private static final Logger logger = Logger.getLogger(Engagement.class.getName());

	@JsonIgnore
	private List<Faction> factions = new ArrayList<>();

	@JsonProperty
	private List<UnitMemento> initialEngagement = new ArrayList<>();

	public Engagement() {
		Faction f1 = new Faction(Color.red, "1");
		Faction f2 = new Faction(Color.blue, "2");
		f1.setEnemy(f2);
		factions.add(f1);
		factions.add(f2);
	}

	public void reset() {
		logger.info("reseting engagement");
		ArmyManager.reset();


		for (UnitMemento su : initialEngagement) {
