package common.block.foliage;

import common.util.Identifyable;

public enum LeavesType implements Identifyable {
	SPRING(0, "spring", true, "Frühling"),
	SUMMER(1, "summer", true, "Sommer"),
	AUTUMN(2, "autumn", false, "Herbst"),
	WINTER(3, "winter", false, "Winter"),
	SNOWY(4, "snowy", false, "Beschneit");

    private final int index;
    private final String name;
    private final boolean tint;
    private final String display;
    
    private LeavesType(int index, String name, boolean tint, String display) {
    	this.index = index;
    	this.name = name;
    	this.tint = tint;
    	this.display = display;
    }
    
    public String getName() {
    	return this.name;
    }
    
    public String getDisplayName() {
    	return this.display;
    }
    
    public int getIndex() {
    	return this.index;
    }
    
    public boolean isTinted() {
    	return this.tint;
    }
    
    public static LeavesType getById(int id) {
    	return LeavesType.values()[id % values().length];
    }

	public static LeavesType getByName(String name) {
		for(LeavesType type : values()) {
			if(("" + type.getIndex()).equals(name) || type.getName().equalsIgnoreCase(name)) {
				return type;
			}
		}
		return null;
	}

    public String toString() {
        return this.name;
    }
}
