/*******************************************************************************
 *  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_CatheterizationDevices;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_IntracoronaryDevices;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_CatheterizationDevices;
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 CatheterizationDevices CID3429
 */
public class CatheterizationDevices_CID3429 {

	/**
	 * The Code Value for template.
	 */
	private String strCodeValue = null;
	/**
	 * Object of IntracoronaryDevices_CID3411
	 */
	private IntracoronaryDevices_CID3411 objIntracoronaryDevices_CID3411;
	/**
	 * 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 CatheterizationDevices_CID3429 Template 
	 */
	public CatheterizationDevices_CID3429()
	{

	}

	/**
	 * 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 enumCatheterizationDevices Object of EnumCM_CatheterizationDevices represents Code Meaning.
	 */
	private void setCodeValue(EnumCM_CatheterizationDevices enumCatheterizationDevices)
	{
		switch(enumCatheterizationDevices) 
		{
		case INTRA_AORTIC_BALLOON_PUMP_IABP: this.strCodeValue =EnumCV_CatheterizationDevices.INTRA_AORTIC_BALLOON_PUMP_IABP_A_28051.getValue(); break;
		case FLUID_FILLED_CATHETER: this.strCodeValue =EnumCV_CatheterizationDevices.FLUID_FILLED_CATHETER_R_00306.getValue(); break;
		case FIBEROPTIC_CATHETER: this.strCodeValue =EnumCV_CatheterizationDevices.FIBEROPTIC_CATHETER_R_00304.getValue(); break;
		case HALL_CATHETER: this.strCodeValue =EnumCV_CatheterizationDevices.HALL_CATHETER_R_0030A.getValue(); break;
		case THERMISTOR_CATHETER: this.strCodeValue =EnumCV_CatheterizationDevices.THERMISTOR_CATHETER_R_00379.getValue(); break;
		case TIP_MANOMETER: this.strCodeValue =EnumCV_CatheterizationDevices.TIP_MANOMETER_R_00383.getValue(); break;
		case SWANN_GANZ_CATHETER: this.strCodeValue =EnumCV_CatheterizationDevices.SWANN_GANZ_CATHETER_A_26860.getValue(); break;
		case SHEATH: this.strCodeValue =EnumCV_CatheterizationDevices.SHEATH_F_9B75C.getValue(); break;
		case TRANSSEPTAL_CATHETER: this.strCodeValue =EnumCV_CatheterizationDevices.TRANSSEPTAL_CATHETER_R_10041.getValue(); break;
		case BIOPTOME: this.strCodeValue =EnumCV_CatheterizationDevices.BIOPTOME_122052.getValue(); break;
		}
	}

	/**
	 * Sets the SNOMED-CT ID.
	 * @param enumCatheterizationDevices Object of EnumCM_CatheterizationDevices represents Code Meaning.
	 */
	private void setSNOMEDCTID(EnumCM_CatheterizationDevices enumCatheterizationDevices)
	{
		switch(enumCatheterizationDevices)
		{
		case INTRA_AORTIC_BALLOON_PUMP_IABP : this.strSNOMEDCTID =EnumChestCardiacSNOMEDMap.INTRA_AORTIC_BALLOON_PUMP_IABP.getSNOMEDCTID(); break;
		case FLUID_FILLED_CATHETER : this.strSNOMEDCTID =EnumChestCardiacSNOMEDMap.FLUID_FILLED_CATHETER.getSNOMEDCTID(); break;
		case FIBEROPTIC_CATHETER : this.strSNOMEDCTID =EnumChestCardiacSNOMEDMap.FIBEROPTIC_CATHETER.getSNOMEDCTID(); break;
		case HALL_CATHETER : this.strSNOMEDCTID =EnumChestCardiacSNOMEDMap.HALL_CATHETER.getSNOMEDCTID(); break;
		case THERMISTOR_CATHETER : this.strSNOMEDCTID =EnumChestCardiacSNOMEDMap.THERMISTOR_CATHETER.getSNOMEDCTID(); break;
		case TIP_MANOMETER : this.strSNOMEDCTID =EnumChestCardiacSNOMEDMap.TIP_MANOMETER.getSNOMEDCTID(); break;
		case SWANN_GANZ_CATHETER : this.strSNOMEDCTID =EnumChestCardiacSNOMEDMap.SWANN_GANZ_CATHETER.getSNOMEDCTID(); break;
		case SHEATH : this.strSNOMEDCTID =EnumChestCardiacSNOMEDMap.SHEATH.getSNOMEDCTID(); break;
		case TRANSSEPTAL_CATHETER : this.strSNOMEDCTID =EnumChestCardiacSNOMEDMap.TRANSSEPTAL_CATHETER.getSNOMEDCTID(); break;
		}
	}

	/**
	 * Sets the value for CatheterizationDevices
	 * @param enumCatheterizationDevices Object of EnumCM_CatheterizationDevices.
	 */
	public void setCatheterizationDevices(Enum enumValue)
	{
		if (enumValue instanceof EnumCM_CatheterizationDevices) 
		{
			/**
			 * Casting EnumValue to required Enum.
			 */
			EnumCM_CatheterizationDevices new_enumCatheterizationDevices = (EnumCM_CatheterizationDevices)enumValue;
			
			this.strCodeMeaning = new_enumCatheterizationDevices.getValue();
			if(new_enumCatheterizationDevices.getValue().equalsIgnoreCase(EnumCM_CatheterizationDevices.BIOPTOME.getValue()))
			{
				this.strCodingSchemeDesignator = EnumCodingSchemeDesignator.DCM.getValue();
			}
			else
			{
				this.strCodingSchemeDesignator = EnumCodingSchemeDesignator.SRT.getValue();
			}			
			setCodeValue(new_enumCatheterizationDevices);
			/**
			 * set SNOMED-CT ID
			 */
			setSNOMEDCTID(new_enumCatheterizationDevices);
		}
		else if(enumValue instanceof EnumCM_IntracoronaryDevices)
		{
			/**
			 * Casting EnumValue to required Enum.
			 */
			EnumCM_IntracoronaryDevices new_enumIntracoronaryDevices = (EnumCM_IntracoronaryDevices) enumValue;
			
			/**
			 * Creating object of require CID with respect to enum and setting value accordingly.
			 */
			if(null== this.objIntracoronaryDevices_CID3411)
			this.objIntracoronaryDevices_CID3411 = new IntracoronaryDevices_CID3411();
			this.objIntracoronaryDevices_CID3411.setIntracoronaryDevices(new_enumIntracoronaryDevices);
			
			/**
			 * Retrieving attributes and setting it to member variables. 
			 */
			this.strCodeMeaning = objIntracoronaryDevices_CID3411.getCodeMeaning();
			this.strCodeValue = objIntracoronaryDevices_CID3411.getCodeValue();
			this.strCodingSchemeDesignator = objIntracoronaryDevices_CID3411.getCodingSchemeDesignator();
			this.strSNOMEDCTID = objIntracoronaryDevices_CID3411.getSNOMEDCTID();
		}
		else
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger objDicomLogger = DicomLogger.getLogger();
				objDicomLogger.log(ResourceBundleWrapper.getValue("warning","InvalidEnumeratedValue",new Locale(DicomConfig.createInstance().getLocale())));
			}
		}
	}
}
