package com.bernard.greposimu.model.game;

import java.math.BigInteger;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class JsonPower {
    public Object effect;
    public Object name;
    public Object description;
    public int lifetime;
    public String id;
    public String short_effect;
    public int favor;
    public int fury_percentage_cost;
    public String god_id;
    public BigInteger temple_level_sum_dependency;
    public List<String> targets;
    public boolean only_own_towns;
    public boolean boost;
    public boolean is_fake_power;
    public List<String> area_of_effect;
    public boolean destructive;
    public boolean negative;
    public boolean extendible;
    public String power_group;
    public int power_group_level;
    public List<String> seeds_to;
    public Image images;
    public List<String> effects;
    public boolean is_valid_for_happenings;
    public List<String> meta_fields;
    public Object meta_defaults;
    public boolean removed_on_target_loss;
    public boolean needs_level;
    public boolean requires_god;
    public boolean ignores_democritus;
    public boolean display_amount;
    public boolean wasteable;
    public boolean is_ritual;
    public boolean recreate_on_restart;
    public boolean transfer_to_casual_world;
    public boolean is_onetime_power;
    public boolean is_upgradable;
    public boolean is_capped;
    public List<String> compatible_powers;
    public boolean no_lifetime;
    public boolean passive;
    
    @SuppressWarnings("unchecked")
	public Set<String> getTypes() {
    	Set<String> types = new HashSet<>();
    	if(name instanceof Map) {
    		if(((Map<String,Map<String,String>>)name).containsKey("type"))
    			types.addAll(((Map<String,Map<String,String>>)name).get("type").keySet());
    		else
    			name = ((Map<String,Map<String,String>>)name).get("god").get("athena");
    	}
    	if(description instanceof Map)
    		types.addAll(((Map<String,Map<String,String>>)description).get("type").keySet());
    	if(effect instanceof Map)
    		types.addAll(((Map<String,Map<String,String>>)effect).get("type").keySet());
    	return types;
    }

	@Override
	public String toString() {
		return "JsonPower [effect=" + effect + ", lifetime=" + lifetime + ", id=" + id + ", name=" + name
				+ ", description=" + description + ", short_effect=" + short_effect + ", favor=" + favor
				+ ", fury_percentage_cost=" + fury_percentage_cost + ", god_id=" + god_id
				+ ", temple_level_sum_dependency=" + temple_level_sum_dependency + ", targets=" + targets
				+ ", only_own_towns=" + only_own_towns + ", boost=" + boost + ", is_fake_power=" + is_fake_power
				+ ", area_of_effect=" + area_of_effect + ", destructive=" + destructive + ", negative=" + negative
				+ ", extendible=" + extendible + ", power_group=" + power_group + ", power_group_level="
				+ power_group_level + ", seeds_to=" + seeds_to + ", images=" + images + ", effects=" + effects
				+ ", is_valid_for_happenings=" + is_valid_for_happenings + ", meta_fields=" + meta_fields
				+ ", meta_defaults=" + meta_defaults + ", removed_on_target_loss=" + removed_on_target_loss
				+ ", needs_level=" + needs_level + ", requires_god=" + requires_god + ", ignores_democritus="
				+ ignores_democritus + ", display_amount=" + display_amount + ", wasteable=" + wasteable
				+ ", is_ritual=" + is_ritual + ", recreate_on_restart=" + recreate_on_restart
				+ ", transfer_to_casual_world=" + transfer_to_casual_world + ", is_onetime_power=" + is_onetime_power
				+ ", is_upgradable=" + is_upgradable + ", is_capped=" + is_capped + ", compatible_powers="
				+ compatible_powers + ", no_lifetime=" + no_lifetime + ", passive=" + passive + "]";
	}

	public Object getEffect() {
		return effect;
	}

	public void setEffect(Object effect) {
		this.effect = effect;
	}

	public Object getName() {
		return name;
	}

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

	public Object getDescription() {
		return description;
	}

	public void setDescription(Object description) {
		this.description = description;
	}
    
	
    
    
}
