package net.w_horse.excelpojo.xml.tag;

public enum Use {
	NONE("none"), OPTIONAL("optional"), REQUIRED("required");

	private String value;
	private Use(String value) {
		this.value = value;
	}
	public String getValue() {
		return this.value;
	}

	public static boolean equalas(Use elementName, String expr) {
		Use retrieveTypeExpr = getElement(expr);
		return (retrieveTypeExpr == elementName);
	}

	public static boolean equalsIgnoreCase(Use elementName, String expr) {
		Use retrieveTypeExpr = getElementIgnoreCase(expr);
		return (retrieveTypeExpr == elementName);
	}
	private static Use getElement(String elementName) {
		if (elementName.equals(OPTIONAL.getValue())) {
			return OPTIONAL;
		} else if (elementName.equals(REQUIRED.getValue())) {
			return REQUIRED;
		} else {
			return NONE;
		}
	}
	private static Use getElementIgnoreCase(String elementName) {
		if (elementName.equalsIgnoreCase(OPTIONAL.getValue())) {
			return OPTIONAL;
		} else if (elementName.equalsIgnoreCase(REQUIRED.getValue())) {
			return REQUIRED;
		} else {
			return NONE;
		}
	}
	public static String getTagName() {
		return "use";
	}
}
