/*******************************************************************************
 *  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 java.util.Locale;

import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_MediaImportPPSDiscontinuationReasons;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ModalityPPSDiscontinuationReasons;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ProcedureDiscontinuationReasons;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_ProcedureDiscontinuationReasons;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConfig;
import cdac.medinfo.sdk.dcm30_04.utils.DicomLogger;
import cdac.medinfo.sdk.dcm30_04.utils.ResourceBundleWrapper;


/**
 * This class represents ProcedureDiscontinuationReasons - CID9300
 */
public class ProcedureDiscontinuationReasons_CID9300 
{
	
	/**
	 * The Code Value for template.
	 */
	private String strCodeValue = null;
	/**
	 * Object of ModalityPPSDiscontinuationReasons_CID9301
	 */
	private ModalityPPSDiscontinuationReasons_CID9301 objModalityPPSDiscontinuationReasonsCID9301;
	/**
	 * Object of MediaImportPPSDiscontinuationReasons_CID9302
	 */
	private MediaImportPPSDiscontinuationReasons_CID9302 objMediaImportPPSDiscontinuationReasonsCID9302;

	/**
	 * The Code Meaning for template.
	 */
	private String strCodeMeaning = null;
	/**
	 * The SNOMED CT ID for template.
	 */
	private String strSNOMEDCTID = null;

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

	/**
	 * Instantiates a new ProcedureDiscontinuationReasons_CID9300 Template 
	 */
	public ProcedureDiscontinuationReasons_CID9300()
	{

	}

	/**
	 * Retrieves the value for Code Meaning.
	 * @return String value for Code Meaning.
	 */
	public String getCodeMeaning()
	{
		return strCodeMeaning;
	}
	/**
	 * Retrieves the value for SNOMED-CT ID.
	 * @return String value for SNOMED-CT ID.
	 */
	public String getSNOMEDCTID() 
	{
		return strSNOMEDCTID;
	}
	/**
	 * 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;
	}

	/**
	 * Sets the Code Value according to Code Meaning.
	 * @param enumProcedureDiscontinuationReasons Object of EnumCM_ProcedureDiscontinuationReasons represents Code Meaning.
	 */
	private void setCodeValue(EnumCM_ProcedureDiscontinuationReasons enumProcedureDiscontinuationReasons)
	{
		switch(enumProcedureDiscontinuationReasons)
		{
		case RESOURCE_PRE_EMPTED: this.strCodeValue = EnumCV_ProcedureDiscontinuationReasons.RESOURCE_PRE_EMPTED_110526.getValue();break;
		case RESOURCE_INADEQUATE: this.strCodeValue = EnumCV_ProcedureDiscontinuationReasons.RESOURCE_INADEQUATE_110527.getValue();break;
		case DISCONTINUED_PROCEDURE_STEP_RESCHEDULED: this.strCodeValue = EnumCV_ProcedureDiscontinuationReasons.DISCONTINUED_PROCEDURE_STEP_RESCHEDULED_110528.getValue();break;
		case DISCONTINUED_PROCEDURE_STEP_RESCHEDULING_RECOMMENDED: this.strCodeValue = EnumCV_ProcedureDiscontinuationReasons.DISCONTINUED_PROCEDURE_STEP_RESCHEDULING_RECOMMENDED_110529.getValue();break;
		}
	}

	/**
	 * Sets the value for ProcedureDiscontinuationReasons
	 * @param enumProcedureDiscontinuationReasons Object of EnumCM_ProcedureDiscontinuationReasons.
	 */
	public void setProcedureDiscontinuationReasons(Enum enumValue)
	{
		if(enumValue instanceof EnumCM_ProcedureDiscontinuationReasons)
	{
		 /**
			 * Casting EnumValue to required Enum.
			 */
			EnumCM_ProcedureDiscontinuationReasons new_enumProcedureDiscontinuationReasons = (EnumCM_ProcedureDiscontinuationReasons)enumValue;
			
			this.strCodeMeaning = new_enumProcedureDiscontinuationReasons.getValue();
			this.strCodingSchemeDesignator = EnumCodingSchemeDesignator.DCM.getValue();
			/**
			 * set code Value
			 */
			setCodeValue(new_enumProcedureDiscontinuationReasons);
	}
	 else if(enumValue instanceof EnumCM_ModalityPPSDiscontinuationReasons)
		{
			/**
			 * Casting EnumValue to required Enum.
			 */
		 EnumCM_ModalityPPSDiscontinuationReasons new_enumModalityPPSDiscontinuationReasons = (EnumCM_ModalityPPSDiscontinuationReasons) enumValue;
			
			/**
			 * Creating object of require CID with respect to enum and setting value accordingly.
			 */
			if(null== this.objModalityPPSDiscontinuationReasonsCID9301)
			this.objModalityPPSDiscontinuationReasonsCID9301 = new ModalityPPSDiscontinuationReasons_CID9301();
			this.objModalityPPSDiscontinuationReasonsCID9301.setModalityPPSDiscontinuationReasons(new_enumModalityPPSDiscontinuationReasons);
			
			/**
			 * Retrieving attributes and setting it to member variables. 
			 */
			this.strCodeMeaning = objModalityPPSDiscontinuationReasonsCID9301.getCodeMeaning();
			this.strCodeValue = objModalityPPSDiscontinuationReasonsCID9301.getCodeValue();
			this.strCodingSchemeDesignator = objModalityPPSDiscontinuationReasonsCID9301.getCodingSchemeDesignator();
			this.strSNOMEDCTID = objModalityPPSDiscontinuationReasonsCID9301.getSNOMEDCTID();
		}
	 else if(enumValue instanceof EnumCM_MediaImportPPSDiscontinuationReasons)
		{
			/**
			 * Casting EnumValue to required Enum.
			 */
		 EnumCM_MediaImportPPSDiscontinuationReasons new_enumMediaImportPPSDiscontinuationReasons = (EnumCM_MediaImportPPSDiscontinuationReasons) enumValue;
			
			/**
			 * Creating object of require CID with respect to enum and setting value accordingly.
			 */
			if(null== this.objMediaImportPPSDiscontinuationReasonsCID9302)
			this.objMediaImportPPSDiscontinuationReasonsCID9302 = new MediaImportPPSDiscontinuationReasons_CID9302();
			this.objMediaImportPPSDiscontinuationReasonsCID9302.setMediaImportPPSDiscontinuationReasons(new_enumMediaImportPPSDiscontinuationReasons);
			
			/**
			 * Retrieving attributes and setting it to member variables. 
			 */
			this.strCodeMeaning = objMediaImportPPSDiscontinuationReasonsCID9302.getCodeMeaning();
			this.strCodeValue = objMediaImportPPSDiscontinuationReasonsCID9302.getCodeValue();
			this.strCodingSchemeDesignator = objMediaImportPPSDiscontinuationReasonsCID9302.getCodingSchemeDesignator();
			
		}
	else
	{
		if(DicomConfig.createInstance().isLoggingOn())
		{
			DicomLogger objDicomLogger = DicomLogger.getLogger();
			objDicomLogger.log(ResourceBundleWrapper.getValue("warning","InvalidEnumeratedValue",new Locale(DicomConfig.createInstance().getLocale())));
	}
}
	}
}
