package com.bernard.greposimu.model.game.units;

import java.util.Map;
import java.util.Objects;
import java.util.Set;

import com.bernard.greposimu.model.game.Identified;

public class Hero extends TerrestrialUnit implements Comparable<Hero>{
	
	// Zero population
	// Non mythological
	// No building cost/time
	// no research/building dependencies
	// No flight
	// Terrestrial
	public Hero(String id, String name, String description, int speed,
			int attack, FightType attackType, int pierceDef, int hackDef,
			int distanceDef, int booty, HeroCategory category, int cost, String shortDescription, double powerBaseValue, double powerValuePerLevel) {
		super(id, name, description, 0, speed, false, null, null, 0, 0,
				Set.of(), Map.of(), attack, attackType, pierceDef, hackDef, distanceDef, booty,	false);
		this.category = category;
		this.cost = cost;
		this.shortDescription = shortDescription;
		this.powerBaseValue = powerBaseValue;
		this.powerValuePerLevel = powerValuePerLevel;
	}


	HeroCategory category;
	int cost;

	String shortDescription;
    
    double powerBaseValue;
    double powerValuePerLevel;
	
    
    public static enum HeroCategory implements Identified{
    	WAR("war"),WISDOM("wisdom");
    	String id;

    	HeroCategory(String id) {
    		this.id = id;
    	}
    	
		@Override
		public String getId() {
			return id;
		}
    }


	public HeroCategory getCategory() {
		return category;
	}


	public int getCost() {
		return cost;
	}


	public String getShortDescription() {
		return shortDescription;
	}


	public double getPowerBaseValue() {
		return powerBaseValue;
	}


	public double getPowerValuePerLevel() {
		return powerValuePerLevel;
	}
    
	@Override
	public int compareTo(Hero o) {
		return this.getId().compareTo(o.getId());
	}

	@Override
	public int hashCode() {
		return Objects.hash(id);
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Hero other = (Hero) obj;
		return Objects.equals(id, other.id);
	}


	@Override
	public String toString() {
		return "Hero [category=" + category + ", cost=" + cost + ", shortDescription=" + shortDescription
				+ ", powerBaseValue=" + powerBaseValue + ", powerValuePerLevel=" + powerValuePerLevel + "]";
	}
    
	
}
