/*******************************************************************************
 *  Copyright 2017-2018 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 cdac.medinfo.sdk.dcm30_04.templates.cid;


import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_StressTestProcedurePhases;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_TemporalPeriodsRelatingToProcedureOrTherapy;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_UltrasoundProtocolStageTypes;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_UltrasoundProtocolStageTypes;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConfig;
import cdac.medinfo.sdk.dcm30_04.utils.DicomLogger;
import cdac.medinfo.sdk.dcm30_04.utils.ResourceBundleWrapper;

import java.util.Locale;

import cdac.medinfo.sdk.dcm30_04.templates.dicomsnomedmap.EnumChestCardiacSNOMEDMap;

/**
 * This class represents UltrasoundProtocolStageTypes CID12002
 */
public class UltrasoundProtocolStageTypes_CID12002 {

	/**
	 * The Code Value for template.
	 */
	private String strCodeValue = null;
	/**
	 * Object of StressTestProcedurePhases_CID3207
	 */
	private StressTestProcedurePhases_CID3207 objStressTestProcedurePhasesCID3207;
	/**
	 * Object of TemporalPeriodsRelatingToProcedureOrTherapy_CID12102
	 */
	private TemporalPeriodsRelatingToProcedureOrTherapy_CID12102 objTemporalPeriodsRelatingToProcedureOrTherapyCID12102;

	/**
	 * The Code Meaning for template.
	 */
	private String strCodeMeaning = null;

	/**
	 * The Coding Scheme Designator for template.
	 */
	private String strCodingSchemeDesignator;

	/**
	 * The SNOMED CT ID for template.
	 */
	private String strSNOMEDCTID = null;
	/**
	 * Instantiates a new UltrasoundProtocolStageTypes_CID12002 Template 
	 */
	public UltrasoundProtocolStageTypes_CID12002()
	{

	}

	/**
	 * Retrieves the value for Code Meaning.
	 * @return String value for Code Meaning.
	 */
	public String getCodeMeaning()
	{
		return strCodeMeaning;
	}

	/**
	 * Retrieves the value for Code Value.
	 * @return String value for Code Value.
	 */
	public String getCodeValue() 
	{
		return strCodeValue;
	}

	/**
	 * Retrieves the value for Coding Scheme Designator.
	 * @return String value for Coding Scheme Designator.
	 */
	public String getCodingSchemeDesignator() 
	{
		return strCodingSchemeDesignator;
	}
	
	/**
	 * Retrieves the value for SNOMED-CT ID.
	 * @return String value for SNOMED-CT ID.
	 */
	public String getSNOMEDCTID() 
	{
		return strSNOMEDCTID;
	}
	/**
	 * Sets the Code Value according to Code Meaning.
	 * @param enumUltrasoundProtocolStageTypes Object of EnumCM_UltrasoundProtocolStageTypes represents Code Meaning.
	 */
	private void setCodeValue(EnumCM_UltrasoundProtocolStageTypes enumUltrasoundProtocolStageTypes)
	{
		switch(enumUltrasoundProtocolStageTypes)
		{
		case CARDIAC_PACING: this.strCodeValue =EnumCV_UltrasoundProtocolStageTypes.CARDIAC_PACING_P2_35000.getValue(); break;
		case HAND_GRIP: this.strCodeValue =EnumCV_UltrasoundProtocolStageTypes.HAND_GRIP_P2_71306.getValue(); break;
		case VALSALVA_MANEUVER: this.strCodeValue =EnumCV_UltrasoundProtocolStageTypes.VALSALVA_MANEUVER_R_40928.getValue(); break;
		}
	}

	/**
	 * Sets the SNOMED-CT ID.
	 * @param enumUltrasoundProtocolStageTypes Object of EnumCM_UltrasoundProtocolStageTypes represents Code Meaning.
	 */
	private void setSNOMEDCTID(EnumCM_UltrasoundProtocolStageTypes enumUltrasoundProtocolStageTypes)
	{
		switch(enumUltrasoundProtocolStageTypes)
		{
		case CARDIAC_PACING : this.strSNOMEDCTID =EnumChestCardiacSNOMEDMap.CARDIAC_PACING.getSNOMEDCTID(); break;
		case HAND_GRIP : this.strSNOMEDCTID =EnumChestCardiacSNOMEDMap.HAND_GRIP.getSNOMEDCTID(); break;
		case VALSALVA_MANEUVER : this.strSNOMEDCTID =EnumChestCardiacSNOMEDMap.VALSALVA_MANEUVER.getSNOMEDCTID(); break;
		}
	}

	/**
	 * Sets the value for UltrasoundProtocolStageTypes
	 * @param enumUltrasoundProtocolStageTypes Object of EnumCM_UltrasoundProtocolStageTypes.
	 */
	public void setUltrasoundProtocolStageTypes(Enum enumValue)
	{
		if(enumValue instanceof EnumCM_UltrasoundProtocolStageTypes)
		{
			 /**
				 * Casting EnumValue to required Enum.
				 */
			EnumCM_UltrasoundProtocolStageTypes new_enumUltrasoundProtocolStageTypes = (EnumCM_UltrasoundProtocolStageTypes)enumValue;
				
				this.strCodeMeaning = new_enumUltrasoundProtocolStageTypes.getValue();
				this.strCodingSchemeDesignator = EnumCodingSchemeDesignator.LN.getValue();
				/**
				 * set code Value
				 */
				setCodeValue(new_enumUltrasoundProtocolStageTypes);

				/**
				 * set SNOMED-CT ID
				 */
				setSNOMEDCTID(new_enumUltrasoundProtocolStageTypes);
		}
		 else if(enumValue instanceof EnumCM_StressTestProcedurePhases)
			{
				/**
				 * Casting EnumValue to required Enum.
				 */
			 EnumCM_StressTestProcedurePhases new_enumStressTestProcedurePhases = (EnumCM_StressTestProcedurePhases) enumValue;
				
				/**
				 * Creating object of require CID with respect to enum and setting value accordingly.
				 */
				if(null== this.objStressTestProcedurePhasesCID3207)
				this.objStressTestProcedurePhasesCID3207 = new StressTestProcedurePhases_CID3207();
				this.objStressTestProcedurePhasesCID3207.setStressTestProcedurePhases(new_enumStressTestProcedurePhases);
				
				/**
				 * Retrieving attributes and setting it to member variables. 
				 */
				this.strCodeMeaning = objStressTestProcedurePhasesCID3207.getCodeMeaning();
				this.strCodeValue = objStressTestProcedurePhasesCID3207.getCodeValue();
				this.strCodingSchemeDesignator = objStressTestProcedurePhasesCID3207.getCodingSchemeDesignator();
				this.strSNOMEDCTID = objStressTestProcedurePhasesCID3207.getSNOMEDCTID();
			}
		
		 else if(enumValue instanceof EnumCM_TemporalPeriodsRelatingToProcedureOrTherapy)
			{
				/**
				 * Casting EnumValue to required Enum.
				 */
			 EnumCM_TemporalPeriodsRelatingToProcedureOrTherapy new_enumTemporalPeriodsRelatingToProcedureOrTherapy = (EnumCM_TemporalPeriodsRelatingToProcedureOrTherapy) enumValue;
				
				/**
				 * Creating object of require CID with respect to enum and setting value accordingly.
				 */
				if(null== this.objTemporalPeriodsRelatingToProcedureOrTherapyCID12102)
				this.objTemporalPeriodsRelatingToProcedureOrTherapyCID12102 = new TemporalPeriodsRelatingToProcedureOrTherapy_CID12102();
				this.objTemporalPeriodsRelatingToProcedureOrTherapyCID12102.setTemporalPeriodsRelatingToProcedureOrTherapy(new_enumTemporalPeriodsRelatingToProcedureOrTherapy);
				
				/**
				 * Retrieving attributes and setting it to member variables. 
				 */
				this.strCodeMeaning = objTemporalPeriodsRelatingToProcedureOrTherapyCID12102.getCodeMeaning();
				this.strCodeValue = objTemporalPeriodsRelatingToProcedureOrTherapyCID12102.getCodeValue();
				this.strCodingSchemeDesignator = objTemporalPeriodsRelatingToProcedureOrTherapyCID12102.getCodingSchemeDesignator();
				this.strSNOMEDCTID = objTemporalPeriodsRelatingToProcedureOrTherapyCID12102.getSNOMEDCTID();
			}		 
		else
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger objDicomLogger = DicomLogger.getLogger();
				objDicomLogger.log(ResourceBundleWrapper.getValue("warning","InvalidEnumeratedValue",new Locale(DicomConfig.createInstance().getLocale())));
		}
	  }
	}
}
