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

import cdac.medinfo.sdk.dcm30_04.baselibs.ContentSequenceItem;
import cdac.medinfo.sdk.dcm30_04.enums.EnumContinuityOfContent;
import cdac.medinfo.sdk.dcm30_04.srtree.SRTree;
import cdac.medinfo.sdk.dcm30_04.templates.cid.ECGControlVariablesNumeric_CID3690;
import cdac.medinfo.sdk.dcm30_04.templates.cid.ElectrodePlacementValues_CID3263;
import cdac.medinfo.sdk.dcm30_04.templates.cid.ECGControlVariablesText_CID3691;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ECGControlVariablesNumeric;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ECGControlVariablesText;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ECGWaveformInformation;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ElectrodePlacementValues;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_Unit;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_ECGWaveformInformation;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_Unit;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.PersonObserverIdentifyingAttributes_TID1003;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.Template;
import cdac.medinfo.sdk.dcm30_04.templates.mammographycadsriodtemplates.CADAlgorithmIdentificationTemplate_TID4019;

/**
 * This class represents ECGWaveformInformation - TID3708
 */
public class ECGWaveformInformation_TID3708 extends Template
{
	/**
	 * Object of ECGControlVariablesNumeric_CID3690
	 */
	private ECGControlVariablesNumeric_CID3690 objECGControlVariablesNumeric_CID3690;

	
	/**
	 * Object of ElectrodePlacementValues_CID3263
	 */
	private ElectrodePlacementValues_CID3263 objElectrodePlacementValuesCID3263;
	/**
	 * Object of TID1003_PersonObserverIdentifyingAttributes which represents the TID1003 Template. 
	 */

	/**
	 * Object of ECGControlVariablesText_CID3691
	 */
	private ECGControlVariablesText_CID3691 objECGControlVariablesText_CID3691;
	
	private PersonObserverIdentifyingAttributes_TID1003 objPersonObserverIdentifyingAttributes = null;

	/**
	 * Object of CADAlgorithmIdentificationTemplate_TID4019 . 
	 */

	private CADAlgorithmIdentificationTemplate_TID4019 objCADAlgorithmIdentificationTemplate_TID4019 = null;

	

	/**
	 * Instantiates a new ECGWaveformInformation_TID3708 Template.
	 * @param objTree Object of SRTree.
	 */
	public ECGWaveformInformation_TID3708(SRTree objTree)
	{
		super(objTree);
	}
	/**
	 * Retrieves the Object of CADAlgorithmIdentificationTemplate_TID4019 template
	 * @return objPersonObserverIdentifyingAttributes Object of CADAlgorithmIdentificationTemplate_TID4019 template
	 */
	public CADAlgorithmIdentificationTemplate_TID4019 getCADAlgorithmIdentificationTemplate() 
	{
		if(null == objCADAlgorithmIdentificationTemplate_TID4019)
			objCADAlgorithmIdentificationTemplate_TID4019 = new CADAlgorithmIdentificationTemplate_TID4019(getSRTree());
		return objCADAlgorithmIdentificationTemplate_TID4019;
	}
	/**
	 * Retrieves the Object of PersonObserverIdentifyingAttributes_TID1003 template
	 * @return objPersonObserverIdentifyingAttributes Object of PersonObserverIdentifyingAttributes_TID1003 template
	 */
	public PersonObserverIdentifyingAttributes_TID1003 getPersonObserverIdentifyingAttributes() 
	{
		if(null == objPersonObserverIdentifyingAttributes)
			objPersonObserverIdentifyingAttributes = new PersonObserverIdentifyingAttributes_TID1003(getSRTree());
		return objPersonObserverIdentifyingAttributes;
	}


	/**
	 * Sets the value for Current Procedure Descriptions
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumContinuityOfContent Enumerated Value for ContinuityOfContent.
	 */
	public void setCurrentProcedureDescriptions(int[] arrPosition, EnumContinuityOfContent enumContinuityOfContent)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGWaveformInformation.CURRENT_PROCEDURE_DESCRIPTIONS.getValue();
		String strCodeValue = EnumCV_ECGWaveformInformation.CURRENT_PROCEDURE_DESCRIPTIONS_121064.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Creating a node of Value Type Container and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createContainer(arrPosition, strCodeMeaning, strCodeValue, strCSD, enumContinuityOfContent);
		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 Short array of ReferencedWaveformChannels 
	 */
	public void setSourceOfMeasurement(int[] arrPosition, String strRefSOPClassUID, String strRefSOPInstanceUID, short[] arrShReferencedWaveformChannels)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGWaveformInformation.SOURCE_OF_MEASUREMENT.getValue();
		String strCodeValue = EnumCV_ECGWaveformInformation.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 the value for lEAD sYSTEM.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumElectrodePlacementValues Enumerated value for value for Electrode Placement Values
	 */
	public void setLeadSystem(int[] arrPosition, EnumCM_ElectrodePlacementValues enumElectrodePlacementValues)
	{
		/**
		 * Sets the value forElectrodePlacementValues which follows the template CID7455
		 */
		if(null== this.objElectrodePlacementValuesCID3263)
			this.objElectrodePlacementValuesCID3263 = new ElectrodePlacementValues_CID3263();
		this.objElectrodePlacementValuesCID3263.setElectrodePlacementValues(enumElectrodePlacementValues);

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCM = objElectrodePlacementValuesCID3263.getCodeMeaning();
		String strCV = objElectrodePlacementValuesCID3263.getCodeValue();
		String strCSD1 = objElectrodePlacementValuesCID3263.getCodingSchemeDesignator();
		String strCSV = objElectrodePlacementValuesCID3263.getCodingSchemeVersion();

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGWaveformInformation.LEAD_SYSTEM.getValue();
		String strCodeValue = EnumCV_ECGWaveformInformation.LEAD_SYSTEM_0_11345.getValue();
		String strCSD2 = EnumCodingSchemeDesignator.SCPECG.getValue();

		/**
		 * 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 , strCSD2, strCV, strCSD1, strCSV, strCM);
		getSRTree().addChild(objContentSequenceItem);
	}

	

	/**
	 * Sets the value for Acquisition Device Type
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strAcquisitionDeviceType String value for Acquisition Device Type.
	 */
	public void setAcquisitionDeviceType(int[] arrPosition, String strAcquisitionDeviceType)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGWaveformInformation.ACQUISITION_DEVICE_TYPE.getValue();
		String strCodeValue = EnumCV_ECGWaveformInformation.ACQUISITION_DEVICE_TYPE_122142.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

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

	/**
	 * Sets the value for Equipment Identifier
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strEquipmentIdentifier String value for Acquisition Device Type.
	 */
	public void setEquipmentIdentifier(int[] arrPosition, String strEquipmentIdentifier)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGWaveformInformation.EQUIPMENT_IDENTIFIER.getValue();
		String strCodeValue = EnumCV_ECGWaveformInformation.EQUIPMENT_IDENTIFIER_121122.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

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

	/**
	 * Sets the value for RoomIdentification
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strRoomIdentification String value for RoomIdentification.
	 */
	public void setRoomIdentification(int[] arrPosition, String strRoomIdentification)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGWaveformInformation.ROOM_IDENTIFICATION.getValue();
		String strCodeValue = EnumCV_ECGWaveformInformation.ROOM_IDENTIFICATION_121121.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

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

	/**
	 * Sets the value for Procedure DateTime.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strProcedureDateTime String value for Procedure DateTime
	 */
	public void setProcedureDateTime(int[] arrPosition, String strProcedureDateTime)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGWaveformInformation.PROCEDURE_DATETIME.getValue();
		String strCodeValue = EnumCV_ECGWaveformInformation.PROCEDURE_DATETIME_122146.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

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

	/**
	 * Sets the value for ElectrophysiologyWaveformDurations.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param arrNumericValue String array for Numeric Value.
	 * @param enumElectrophysiologyWaveformDurations Enum value for ElectrophysiologyWaveformDurations
	 */
	public void setECGControlVariablesText(int[] arrPosition,String[] arrNumericValue,EnumCM_ECGControlVariablesText enumECGControlVariablesText)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCMForUnit = EnumCM_Unit.MS.getValue();
		String strCVForUnit = EnumCV_Unit.MS.getValue();
		String strCSDForUnit = EnumCodingSchemeDesignator.UCUM.getValue();

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		if(null== this.objECGControlVariablesText_CID3691)
			this.objECGControlVariablesText_CID3691 = new ECGControlVariablesText_CID3691();
		this.objECGControlVariablesText_CID3691.setECGControlVariablesText(enumECGControlVariablesText);

		String strCodeMeaning = objECGControlVariablesText_CID3691.getCodeMeaning();
		String strCodeValue = objECGControlVariablesText_CID3691.getCodeValue();
		String strCSD = objECGControlVariablesText_CID3691.getCodingSchemeDesignator();


		ContentSequenceItem objContentSequenceItem = getSRTree().createNumNode(arrPosition,strCodeMeaning,strCodeValue,strCSD,arrNumericValue,strCVForUnit,strCSDForUnit,"",strCMForUnit,"","","","");
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for CADAlgorithmIdentification
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strCADAlgorithmIdentification String value for RoomIdentification.
	 */
	public void setCADAlgorithmIdentification(int[] arrPosition, EnumCM_ECGControlVariablesNumeric enumECGControlVariablesNumeric, String strCADAlgorithmIdentification)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		if(null== this.objECGControlVariablesNumeric_CID3690)
			this.objECGControlVariablesNumeric_CID3690 = new ECGControlVariablesNumeric_CID3690();
		this.objECGControlVariablesNumeric_CID3690.setECGControlVariablesNumeric(enumECGControlVariablesNumeric);

		String strCodeMeaning = objECGControlVariablesNumeric_CID3690.getCodeMeaning();
		String strCodeValue = objECGControlVariablesNumeric_CID3690.getCodeValue();
		String strCSD = objECGControlVariablesNumeric_CID3690.getCodingSchemeDesignator();


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