package in.cdac.medinfo.csnotk.csnolib.commons;

import java.io.Serializable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 	If EnumState value is,<br>
 *  	ACTIVE - refers to active Components.<br>
 * 		INACTIVE - refers to inactive Components.<br>
 * 		BOTH - both refers to active and inactive Components.<br>
 */

public enum EnumState implements Serializable{

	
	ACTIVE("active"),
	INACTIVE("inactive"),
	BOTH("both");
	
	private static final Map<String, EnumState> lookup = new ConcurrentHashMap<String, EnumState>();
    static 
    {
        for (EnumState d : EnumState.values())
            lookup.put(d.getValue(), d);
    }
    	
	private String value;
	
	private EnumState( String value) {
		this.value = value;
	}
	
	/**
	 * Returns the value associated with enumeration.
	 * @return {@link String} value for enumeration.
	 */
	public String getValue() {
		return value;
	}
	
	/**
	 * Sets value for enumeration.
	 * @param value {@link String} value to be set.
	 */
	public void setValue(String value) {
		this.value = value;
	}
 
	/**
	 * Returns enumeration for given string value.
	 * @param val {@link String} value for which enumeration is to be retrieve.
	 * @return {@link EnumState} enumeration for given string value
	 */
	public static EnumState getEnum(String val) 
	{
		return lookup.get(val);
	}
}
