/*******************************************************************************
 *  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.hemodynamicsreporttemplates;

import cdac.medinfo.sdk.dcm30_04.baselibs.ContentSequenceItem;
import cdac.medinfo.sdk.dcm30_04.enums.EnumTemporalRangeType;
import cdac.medinfo.sdk.dcm30_04.srtree.SRTree;
import cdac.medinfo.sdk.dcm30_04.templates.cid.CardiovascularAnatomicLocationModifiers_CID3019;
import cdac.medinfo.sdk.dcm30_04.templates.cid.HemodynamicMeasurementTechniques_CID3241;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_CardiovascularAnatomicLocationModifiers;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_HemodynamicAcquisitionContext;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_HemodynamicMeasurementTechniques;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_HemodynamicAcquisitionContext;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.Template;

/**
 * This class represents HemodynamicAcquisitionContext - TID3530
 */
public class HemodynamicAcquisitionContext_TID3530 extends Template
{
	/**
	 * Object of CardiovascularAnatomicLocationModifiers_CID3019
	 */
	private CardiovascularAnatomicLocationModifiers_CID3019 objAnatomicLocationModifiersCID3019;

	/**
	 * Object of HemodynamicMeasurementTechniques_CID3241
	 */
	private HemodynamicMeasurementTechniques_CID3241 objHemodynamicMeasurementTechniquesCID3241;

	/**
	 * Instantiates a new HemodynamicAcquisitionContext_TID3530 Template.
	 * @param objTree Object of SRTree.
	 */
	public HemodynamicAcquisitionContext_TID3530(SRTree objTree)
	{
		super(objTree);
	}

	/**
	 * Sets value for Topographical modifier.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumCardiovascularAnatomicLocationModifiers Enumerated value for Topographical modifier.
	 */
	public void setTopographicalModifier(int[] arrPosition, EnumCM_CardiovascularAnatomicLocationModifiers enumCardiovascularAnatomicLocationModifiers)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_HemodynamicAcquisitionContext.TOPOGRAPHICAL_MODIFIER.getValue();
		String strCodeValue = EnumCV_HemodynamicAcquisitionContext.TOPOGRAPHICAL_MODIFIER_G_A1F8.getValue();
		String strCSDesg = EnumCodingSchemeDesignator.SRT.getValue();

		/**
		 * Setting value for Topographical modifier
		 */
		if(null== this.objAnatomicLocationModifiersCID3019)
			this.objAnatomicLocationModifiersCID3019 = new CardiovascularAnatomicLocationModifiers_CID3019();
		this.objAnatomicLocationModifiersCID3019.setCardiovascularAnatomicLocationModifiers(enumCardiovascularAnatomicLocationModifiers);

		String strCM = objAnatomicLocationModifiersCID3019.getCodeMeaning();
		String strCV = objAnatomicLocationModifiersCID3019.getCodeValue();
		String strCSD = objAnatomicLocationModifiersCID3019.getCodingSchemeDesignator();
		String strSNOMEDCTID = objAnatomicLocationModifiersCID3019.getSNOMEDCTID();

		/**
		 * Creating a node of Value Type CODE and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createCodeNode(arrPosition, strCodeMeaning, strCodeValue, strCSDesg, strCV, strCSD, "", strCM,strSNOMEDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets value for Measurement Method.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumHemodynamicMeasurementTechniques Enumerated value for Measurement Method.
	 */
	public void setMeasurementMethod(int[] arrPosition, EnumCM_HemodynamicMeasurementTechniques enumHemodynamicMeasurementTechniques)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_HemodynamicAcquisitionContext.MEASUREMENT_METHOD.getValue();
		String strCodeValue = EnumCV_HemodynamicAcquisitionContext.MEASUREMENT_METHOD_G_C036.getValue();
		String strCSDesg = EnumCodingSchemeDesignator.SRT.getValue();

		/**
		 * Setting value for Topographical modifier
		 */
		if(null== this.objHemodynamicMeasurementTechniquesCID3241)
			this.objHemodynamicMeasurementTechniquesCID3241 = new HemodynamicMeasurementTechniques_CID3241();
		this.objHemodynamicMeasurementTechniquesCID3241.setHemodynamicMeasurementTechniques(enumHemodynamicMeasurementTechniques);

		String strCM = objHemodynamicMeasurementTechniquesCID3241.getCodeMeaning();
		String strCV = objHemodynamicMeasurementTechniquesCID3241.getCodeValue();
		String strCSD = objHemodynamicMeasurementTechniquesCID3241.getCodingSchemeDesignator();
		String strCSV = objHemodynamicMeasurementTechniquesCID3241.getCodingSchemeDesignator();
		String strSNOMEDCTID = objHemodynamicMeasurementTechniquesCID3241.getSNOMEDCTID();
		
		/**
		 * Creating a node of Value Type CODE and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createCodeNode(arrPosition, strCodeMeaning, strCodeValue, strCSDesg, strCV, strCSD, strCSV, strCM,strSNOMEDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets Source of measurement.
	 * @param arrPosition position at which the node will get added in the tree.
	 * @param strRefSOPClassUID Referenced SOP Class UID..
	 * @param strRefSOPInstanceUID Referenced SOP Instance UID..
	 * @param arrShReferencedWaveformChannels
	 */
	public void setSourceOfMeasurement(int[] arrPosition, String strRefSOPClassUID, String strRefSOPInstanceUID, short[] arrShReferencedWaveformChannels)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_HemodynamicAcquisitionContext.SOURCE_OF_MEASUREMENT.getValue();
		String strCodeValue = EnumCV_HemodynamicAcquisitionContext.SOURCE_OF_MEASUREMENT_121112.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Creating a node of Value Type WAVWFORM and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createWaveformNode(arrPosition, strCodeMeaning, strCodeValue, strCSD, strRefSOPClassUID, strRefSOPInstanceUID, arrShReferencedWaveformChannels);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets Source of measurement
	 * @param arrPosition position at which node is to be added in the tree.
	 * @param arrStrReferencedDatetime String array for ReferencedDatetime
	 * @param lArrReferencedSamplePositions long array for ReferencedSamplePositions
	 * @param arrStrReferencedTimeOffsets String array for ReferencedTimeOffsets 
	 * @param enumTemporalRangeType Enum value for TemporalRangeType
	 */
	public void setSourceOfMeasurement(int[] arrPosition,String []arrStrReferencedDatetime,int []lArrReferencedSamplePositions, String []arrStrReferencedTimeOffsets,EnumTemporalRangeType enumTemporalRangeType)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_HemodynamicAcquisitionContext.SOURCE_OF_MEASUREMENT.getValue();
		String strCodeValue = EnumCV_HemodynamicAcquisitionContext.SOURCE_OF_MEASUREMENT_121112.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Creating a node of Value Type TCOORD and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createTCOORDNode(arrPosition, strCodeMeaning, strCodeValue, strCSD, arrStrReferencedDatetime, lArrReferencedSamplePositions, arrStrReferencedTimeOffsets, enumTemporalRangeType);
		getSRTree().addChild(objContentSequenceItem);
	}
}
