
package ca.uhn.fhir.model.dev.valueset;

import ca.uhn.fhir.model.api.*;
import java.util.HashMap;
import java.util.Map;

public enum DocumentRelationshipTypeEnum {

	/**
	 * Code Value: <b>replaces</b>
	 *
	 * This document logically replaces or supercedes the target document.
	 */
	REPLACES("replaces", "http://hl7.org/fhir/document-relationship-type"),
	
	/**
	 * Code Value: <b>transforms</b>
	 *
	 * This document was generated by transforming the target document (e.g. format or language conversion).
	 */
	TRANSFORMS("transforms", "http://hl7.org/fhir/document-relationship-type"),
	
	/**
	 * Code Value: <b>signs</b>
	 *
	 * This document is a signature of the target document.
	 */
	SIGNS("signs", "http://hl7.org/fhir/document-relationship-type"),
	
	/**
	 * Code Value: <b>appends</b>
	 *
	 * This document adds additional information to the target document.
	 */
	APPENDS("appends", "http://hl7.org/fhir/document-relationship-type"),
	
	;
	
	/**
	 * Identifier for this Value Set:
	 * http://hl7.org/fhir/vs/document-relationship-type
	 */
	public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/document-relationship-type";

	/**
	 * Name for this Value Set:
	 * DocumentRelationshipType
	 */
	public static final String VALUESET_NAME = "DocumentRelationshipType";

	private static Map<String, DocumentRelationshipTypeEnum> CODE_TO_ENUM = new HashMap<String, DocumentRelationshipTypeEnum>();
	private static Map<String, Map<String, DocumentRelationshipTypeEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, DocumentRelationshipTypeEnum>>();
	
	private final String myCode;
	private final String mySystem;
	
	static {
		for (DocumentRelationshipTypeEnum next : DocumentRelationshipTypeEnum.values()) {
			CODE_TO_ENUM.put(next.getCode(), next);
			
			if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) {
				SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, DocumentRelationshipTypeEnum>());
			}
			SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next);			
		}
	}
	
	/**
	 * Returns the code associated with this enumerated value
	 */
	public String getCode() {
		return myCode;
	}
	
	/**
	 * Returns the code system associated with this enumerated value
	 */
	public String getSystem() {
		return mySystem;
	}
	
	/**
	 * Returns the enumerated value associated with this code
	 */
	public DocumentRelationshipTypeEnum forCode(String theCode) {
		DocumentRelationshipTypeEnum retVal = CODE_TO_ENUM.get(theCode);
		return retVal;
	}

	/**
	 * Converts codes to their respective enumerated values
	 */
	public static final IValueSetEnumBinder<DocumentRelationshipTypeEnum> VALUESET_BINDER = new IValueSetEnumBinder<DocumentRelationshipTypeEnum>() {
		@Override
		public String toCodeString(DocumentRelationshipTypeEnum theEnum) {
			return theEnum.getCode();
		}

		@Override
		public String toSystemString(DocumentRelationshipTypeEnum theEnum) {
			return theEnum.getSystem();
		}
		
		@Override
		public DocumentRelationshipTypeEnum fromCodeString(String theCodeString) {
			return CODE_TO_ENUM.get(theCodeString);
		}
		
		@Override
		public DocumentRelationshipTypeEnum fromCodeString(String theCodeString, String theSystemString) {
			Map<String, DocumentRelationshipTypeEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString);
			if (map == null) {
				return null;
			}
			return map.get(theCodeString);
		}
		
	};
	
	/** 
	 * Constructor
	 */
	DocumentRelationshipTypeEnum(String theCode, String theSystem) {
		myCode = theCode;
		mySystem = theSystem;
	}

	
}
