/*******************************************************************************
 * Copyright 2014 Centre for Development of Advanced Computing("C-DAC"), Pune
 * 
 * Licensed under the Apache License, Version 2.0 ("the "License"");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package in.cdac.medinfo.csnotk.csnolib.commons;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
 * Provides the SNOMED CT Concept id corresponding to a particular type of Relationship
 */
public enum EnumRelationshipType
{
	ALL("all",""),
	ATTRIBUTE("attribute","410662002"),
	IS_A("is a", "116680003");

	private static final Map<String, EnumRelationshipType> lookupForValue = new ConcurrentHashMap<String, EnumRelationshipType>();
	private static final Map<String, EnumRelationshipType> lookupForId = new ConcurrentHashMap<String, EnumRelationshipType>();
	
	static 
     {
         for (EnumRelationshipType d : EnumRelationshipType.values())
             lookupForValue.put(d.getValue(), d);
         
         for (EnumRelationshipType d : EnumRelationshipType.values())
             lookupForId.put(d.getId(), d);
     }
	private String value;
	private String id;
	
	private EnumRelationshipType(String value, String id)
	{
		this.setValue(value);
		this.setId(id);
	}
	
	/**
	 * Sets value for enumeration.
	 * @param value {@link String} value to be set.
	 */
	public void setValue(String value) 
	{
		this.value = value;
	}

	/**
	 * Returns the value associated with enumeration.
	 * @return {@link String} value for enumeration.
	 */
	public String getValue() 
	{
		return value;
	}
	
	/**
	 * Returns SNOMEDCT identifier associated with enumeration.
	 * @return {@link String} value for SNOMEDCT identifier associated with enumeration.
	 */
	public String getId()
	{
		return id;
	}

	/**
	 * Sets SNOMEDCT identifier for enumeration.
	 * @param id {@link String} value for SNOMEDCT identifier.
	 */
	public void setId(String id) 
	{
		this.id = id;
	}
	
	/**
	 * Returns enumeration for given value
	 * @param value {@link String} value to retrieve enumeration
	 * @return {@link EnumRelationshipType}
	 */
	public static EnumRelationshipType getEnumForValue(String value)
	{
		return lookupForValue.get(value);
	}
	
	/**
	 * Returns enumeration for given string value.
	 * @param id {@link String} identifier for which enumeration is to be retrieve.
	 * @return {@link EnumRelationshipType} enumeration for given string value
	 */
	public static EnumRelationshipType getEnumForId(String id)
	{
		return lookupForId.get(id);
	}		

	
}
