package com.bernard.greposimu.model.simulator;

import java.util.List;
import java.util.Map;
import java.util.Set;

import com.bernard.greposimu.model.game.God;
import com.bernard.greposimu.model.game.Resources;
import com.bernard.greposimu.model.runtime.Timestamp;

public class Ville {
	int id;
	String nom;
	
	Map<String,Integer> batiments;
	
	Troupes troupes;
	
	// origin town id -> troupes
	Map<Integer,Troupes> soutiens;
	
	// Destination town -> troupes
	Map<Integer,Troupes> soutenus;
	
	// sortilegeId -> effectEnd
	Map<String,Timestamp> sortileges;
	
	// Agora
	Timestamp festivalEnd,olympiquesEnd,marchEnd,theaterEnd;
	
	// Academie
	Set<String> researches;
	List<QueueItem> researchQueue;
	
	// Senat
	List<QueueItem> buildingQueue;
	
	// Farm
	Timestamp miliceAppel;
	
	// Entrepôt
	Resources storage;
	
	// Caserne
	List<QueueItem> terrestrialQueue;
	
	// Temple
	God god;
	
	// Port
	List<QueueItem> navalQueue;
	
	// Remparts
	Troupes slainAsOff,slainAsDef,lostAsOff,lostAsDef;
	
	// Grotte
	int piecesStoquees;
	
	/* Ordres */
	Set<UnitOrder> ordresMilitaires;
	Set<TradeOrder> incomingTrade;
	Set<TradeOrder> outgoingTrade;
	
	public static class TradeOrder {
		Resources resources;
		Integer other;
	}
	public static class UnitOrder {
		Troupes attq;
		Timestamp arrivee;
		OrderType type;
		Set<String> sortileges;
	}
	public static enum OrderType {
		ATTACK,
		SUPPORT,
		ATTACK_CANCELED,
		ATTACK_RETURN;
	}
	
	public static class QueueItem {
		String buildingId;
		Timestamp startTime;
		Timestamp endTime;
		long duration;
	}
	
}
