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

import cdac.medinfo.sdk.dcm30_04.baselibs.ContentSequenceItem;
import cdac.medinfo.sdk.dcm30_04.srtree.SRTree;
import cdac.medinfo.sdk.dcm30_04.templates.cid.ECGLeads_CID3001;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_DefinedTerms;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ECGLeads;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ECGSTAssessment;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_Unit;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_DefinedTerms;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_ECGSTAssessment;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_Unit;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.Template;

/**
 * The ECG ST Assessment Template allows recording of the assessment of changes in the patient ECG
 * relative to baseline.
 */
/**
 * This class represents ECGSTAssessment - TID3115
 */
public class ECGSTAssessment_TID3115 extends Template
{
	/**
	 * Object of ECGLeads_CID3001
	 */
	private ECGLeads_CID3001 objLeads_CID3001;

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

	/**
	 * Sets value for Patient Status or Event. It has already defined value as Deployment.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 */
	public void setPatientStatusOrEvent(int[] arrPosition)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGSTAssessment.PATIENT_STATUS_OR_EVENT.getValue();
		String strCodeValue = EnumCV_ECGSTAssessment.PATIENT_STATUS_OR_EVENT_121123.getValue();
		String strCSDesg = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Setting value for Cardiovascular Anatomic Locations
		 */
		String strCM = EnumCM_DefinedTerms.ANALYSIS.getValue();
		String strCV = EnumCV_DefinedTerms.ANALYSIS_R_41D8B.getValue();
		String strCSD = EnumCodingSchemeDesignator.SRT.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, strCSDesg, strCV, strCSD, "", strCM);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets value for ST change from baseline. It has already defined value as Deployment.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 */
	public void setSTChangeFromBaseline(int[] arrPosition)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGSTAssessment.ST_CHANGE_FROM_BASELINE.getValue();
		String strCodeValue = EnumCV_ECGSTAssessment.ST_CHANGE_FROM_BASELINE_122099.getValue();
		String strCSDesg = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Setting value for Cardiovascular Anatomic Locations
		 */
		String strCM = EnumCM_Unit.uV.getValue();
		String strCV = EnumCV_Unit.uV.getValue();
		String strCSD = EnumCodingSchemeDesignator.UCUM.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, strCSDesg, strCV, strCSD, "", strCM);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Lead ID.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumECGLeads Enum value for ECG Leads
	 */
	public void setLeadID(int[] arrPosition, EnumCM_ECGLeads enumECGLeads)
	{
		/**
		 * Sets the value for InterventionActionsAndStatus.
		 */
		if(objLeads_CID3001 == null)
			this.objLeads_CID3001 = new ECGLeads_CID3001();
		this.objLeads_CID3001.setECGLeads(enumECGLeads);

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

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGSTAssessment.LEAD_ID.getValue();
		String strCodeValue = EnumCV_ECGSTAssessment.LEAD_ID_122148.getValue();
		String strCSD2 = EnumCodingSchemeDesignator.DCM.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);
	}
}
