/*******************************************************************************
 *  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.dicommodel.modules.SRDocumentContentModule;
import cdac.medinfo.sdk.dcm30_04.enums.EnumContinuityOfContent;
import cdac.medinfo.sdk.dcm30_04.srtree.SRTree;
import cdac.medinfo.sdk.dcm30_04.templates.cid.ECGProcedureTypes_CID3670;
import cdac.medinfo.sdk.dcm30_04.templates.cid.ReasonForECGExam_CID3671;
import cdac.medinfo.sdk.dcm30_04.templates.cid.ReasonForECGExam_CID3671;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ECGProcedureTypes;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ECGReport;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_OrganDoseTemplates;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_RadiosensitiveOrgans;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ReasonForECGExam;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_ECGReport;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_OrganDoseTemplates;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.LanguageOfContentItemAndDescendants_TID1204;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.ObserverContext_TID1002;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.Template;

/**
 * This class represents ECGReport - TID3700
 */
public class ECGReport_TID3700 extends Template
{
	/**
	 * Object of ObserverContext_TID1002. 
	 */

	private ObserverContext_TID1002 objObserverContext_TID1002 = null;

	/**
	 * Object of ReasonForECGExam_CID3671. 
	 */

	private ReasonForECGExam_CID3671 objReasonForECGExam_CID3671 = null;
	/**
	 * Object of LanguageOfContentItemAndDescendants_TID1204. 
	 */

	private LanguageOfContentItemAndDescendants_TID1204 objLanguageOfContentItemAndDescendants_TID1204= null;
	/**
	 * Object of ECGProcedureTypes_CID3670
	 */
	private ECGProcedureTypes_CID3670 objEcgProcedureTypesCID3670;

	/**
	 * Object of ClinicalContextECG_TID3701. 
	 */

	private ClinicalContextECG_TID3701 objClinicalContextECGTID3701 = null;

	/**
	 * Object of PriorECGExam_TID3702. 
	 */

	private PriorECGExam_TID3702 objPriorECGExamTID3702 = null;

	/**
	 * Object of ECGWaveformInformation_TID3708. 
	 */

	private ECGWaveformInformation_TID3708 objEcgWaveformInformationTID3708 = null;


	/**
	 * Object of ECGGlobalMeasurements_TID3713. 
	 */

	private ECGGlobalMeasurements_TID3713 objEcgGlobalMeasurementsTID3713 = null;

	/**
	 * Object of ECGLeadMeasurements_TID3714. 
	 */

	private ECGLeadMeasurements_TID3714 objEcgLeadMeasurementsTID3714 = null;

	/**
	 * Object of ECGQualitativeAnalysis_TID3717. 
	 */

	private ECGQualitativeAnalysis_TID3717 objEcgQualitativeAnalysisTID3717 = null;

	/**
	 * Object of SummaryECG_TID3719. 
	 */

	private SummaryECG_TID3719 objSummaryECGTID3719 = null;

	/**
	 * Instantiates a new ECGReport_TID3700 Template.
	 * @param objTree Object of SRTree.
	 */
	public ECGReport_TID3700(SRTree objTree)
	{
		super(objTree);
	}
	/**
	 * Retrieves the object of LanguageOfContentItemAndDescendants_TID1204 which provides the methods for setting different
	 * @return objLanguageOfContentItemAndDescendants_TID1204 Object of LanguageOfContentItemAndDescendants_TID1204
	 */
	public LanguageOfContentItemAndDescendants_TID1204 getLanguageOfContentItemAndDescendants() 
	{
		if(null == this.objLanguageOfContentItemAndDescendants_TID1204)
			this.objLanguageOfContentItemAndDescendants_TID1204 = new LanguageOfContentItemAndDescendants_TID1204(getSRTree());
		return this.objLanguageOfContentItemAndDescendants_TID1204;
	}

	/**
	 * Retrieves the object of ObserverContext_TID1002 which provides the methods for setting different
	 * attributes of Observer Context.
	 * @return objObserverContext_TID1002 Object of ObserverContext_TID1002
	 */
	public ObserverContext_TID1002 getObserverContext_TID1002() 
	{
		if(null == this.objObserverContext_TID1002)
			this.objObserverContext_TID1002 = new ObserverContext_TID1002(getSRTree());
		return this.objObserverContext_TID1002;
	}

	/**
	 * Retrieves the object of ClinicalContextECG_TID3701
	 * @return objClinicalContextECGTID3701 Object of ClinicalContextECGTID3701 
	 */
	public ClinicalContextECG_TID3701 getClinicalContextECG() 
	{
		if(null == this.objClinicalContextECGTID3701)
			this.objClinicalContextECGTID3701 = new ClinicalContextECG_TID3701(getSRTree());
		return this.objClinicalContextECGTID3701;
	}

	/**
	 * Retrieves the object of PriorECGExam_TID3702 
	 * @return objPriorECGExam_TID3702 Object of PriorECGExam_TID3702 
	 */
	public PriorECGExam_TID3702 getPriorECGExam() 
	{
		if(null == this.objPriorECGExamTID3702)
			this.objPriorECGExamTID3702 = new PriorECGExam_TID3702(getSRTree());
		return this.objPriorECGExamTID3702;
	}

	/**
	 * Retrieves the object of ECGWaveformInformation_TID3708 
	 * @return objEcgWaveformInformationTID3708 Object of ECGWaveformInformation_TID3708 
	 */
	public ECGWaveformInformation_TID3708 getECGWaveformInformation() 
	{
		if(null == this.objEcgWaveformInformationTID3708)
			this.objEcgWaveformInformationTID3708 = new ECGWaveformInformation_TID3708(getSRTree());
		return this.objEcgWaveformInformationTID3708;
	}

	/**
	 * Retrieves the object of ECGGlobalMeasurements_TID3713 
	 * @return objEcgWaveformInformationTID3708 Object of ECGGlobalMeasurements_TID3713 
	 */
	public ECGGlobalMeasurements_TID3713 getECGGlobalMeasurements() 
	{
		if(null == this.objEcgGlobalMeasurementsTID3713)
			this.objEcgGlobalMeasurementsTID3713 = new ECGGlobalMeasurements_TID3713(getSRTree());
		return this.objEcgGlobalMeasurementsTID3713;
	}

	/**
	 * Retrieves the object of ECGLeadMeasurements_TID3714 
	 * @return objEcgLeadMeasurementsTID3714 Object of ECGLeadMeasurements_TID3714
	 */
	public ECGLeadMeasurements_TID3714 getECGLeadMeasurements() 
	{
		if(null == this.objEcgLeadMeasurementsTID3714)
			this.objEcgLeadMeasurementsTID3714 = new ECGLeadMeasurements_TID3714(getSRTree());
		return this.objEcgLeadMeasurementsTID3714;
	}

	/**
	 * Retrieves the object of ECGQualitativeAnalysis_TID3717 
	 * @return objEcgQualitativeAnalysisTID3717 Object of ECGQualitativeAnalysis_TID3717
	 */
	public ECGQualitativeAnalysis_TID3717 getECGQualitativeAnalysis() 
	{
		if(null == this.objEcgQualitativeAnalysisTID3717)
			this.objEcgQualitativeAnalysisTID3717 = new ECGQualitativeAnalysis_TID3717(getSRTree());
		return this.objEcgQualitativeAnalysisTID3717;
	}

	/**
	 * Retrieves the object of SummaryECG_TID3719 
	 * @return objSummaryECGTID3719 Object of SummaryECG_TID3719
	 */
	public SummaryECG_TID3719 getSummaryECG() 
	{
		if(null == this.objSummaryECGTID3719)
			this.objSummaryECGTID3719 = new SummaryECG_TID3719(getSRTree());
		return this.objSummaryECGTID3719;
	}

	/**
	 * Sets the value for ECG Report
	 * @param enumContinuityOfContent Enumerated Value for ContinuityOfContent.
	 */
	public void setECGReport(EnumContinuityOfContent enumContinuityOfContent)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGReport.ECG_REPORT.getValue();
		String strCodeValue = EnumCV_ECGReport.ECG_REPORT_28010_7.getValue();
		String strCSD = EnumCodingSchemeDesignator.LN.getValue();

		/**
		 * Creating a node of Value Type CONTAINER and adding this node as root of a tree.
		 */
		SRDocumentContentModule objDocumentContentModule = getSRTree().getSRDocumentContentModule();
		getSRTree().createRoot(objDocumentContentModule,strCodeMeaning,strCodeValue , strCSD, enumContinuityOfContent);
	}

	/**
	 * Sets the value for Procedure reported.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumECGProcedureTypes Enumerated value for value for Procedure reported
	 */
	public void setProcedureReported(int[] arrPosition, EnumCM_ECGProcedureTypes enumECGProcedureTypes)
	{
		/**
		 * Sets the value for Subject Sex which follows the template CID7455
		 */
		if(null== this.objEcgProcedureTypesCID3670)
			this.objEcgProcedureTypesCID3670 = new ECGProcedureTypes_CID3670();
		this.objEcgProcedureTypesCID3670.setECGProcedureTypes(enumECGProcedureTypes);

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

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGReport.PROCEDURE_REPORTED.getValue();
		String strCodeValue = EnumCV_ECGReport.PROCEDURE_REPORTED_121058.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, "", strCM,strSNMDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Quantitative Analysis
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumContinuityOfContent Enumerated Value for ContinuityOfContent.
	 */
	public void setQuantitativeAnalysis(int[] arrPosition, EnumContinuityOfContent enumContinuityOfContent)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGReport.QUANTITATIVE_ANALYSIS.getValue();
		String strCodeValue = EnumCV_ECGReport.QUANTITATIVE_ANALYSIS_122144.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Creating a node of Value Type UIDREF and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createContainer(arrPosition, strCodeMeaning, strCodeValue, strCSD, enumContinuityOfContent);
		getSRTree().addChild(objContentSequenceItem);
	}
	/**
	 * Sets the value for IndicationsForProcedure
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumContinuityOfContent Enumerated Value for ContinuityOfContent.
	 */
	public void setIndicationsForProcedure(int[] arrPosition, EnumContinuityOfContent enumContinuityOfContent)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGReport.INDICATIONS_FOR_PROCEDURE.getValue();
		String strCodeValue = EnumCV_ECGReport.INDICATIONS_FOR_PROCEDURE_18785_6.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Creating a node of Value Type UIDREF and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createContainer(arrPosition, strCodeMeaning, strCodeValue, strCSD, enumContinuityOfContent);
		getSRTree().addChild(objContentSequenceItem);
	}
	public void setFinding(int[] arrPosition,EnumCM_ReasonForECGExam enumReasonForECGExam)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGReport.FINDING.getValue();
		String strCodeValue = EnumCV_ECGReport.FINDING_121071.getValue();
		String strCSDesg = EnumCodingSchemeDesignator.SRT.getValue();
		String strCM,strCV,strCSD,strSNMDCTID;
		if(null== this.objReasonForECGExam_CID3671)
			this.objReasonForECGExam_CID3671 = new ReasonForECGExam_CID3671();
		this.objReasonForECGExam_CID3671.setReasonForECGExam(enumReasonForECGExam);
		
		 strCM = objReasonForECGExam_CID3671.getCodeMeaning();
		 strCV = objReasonForECGExam_CID3671.getCodeValue();
		 strCSD = objReasonForECGExam_CID3671.getCodingSchemeDesignator();
		 strSNMDCTID = objReasonForECGExam_CID3671.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,strSNMDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}
	/**
	 * Sets the value for Finding
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strFinding String value for Comment.
	 */
	public void setFinding(int[] arrPosition, String strFinding)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ECGReport.FINDING.getValue();
		String strCodeValue = EnumCV_ECGReport.FINDING_121071.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, strFinding);
		getSRTree().addChild(objContentSequenceItem);
	}
}
