/*******************************************************************************
 *  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.EnumContinuityOfContent;
import cdac.medinfo.sdk.dcm30_04.srtree.SRTree;
import cdac.medinfo.sdk.dcm30_04.templates.cid.HemodynamicPatientState_CID3602;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_HemodynamicClinicalContext;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_HemodynamicPatientState;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_HemodynamicClinicalContext;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.Template;

/**
 * This class represents HemodynamicClinicalContext - TID3520
 */
public class HemodynamicClinicalContext_TID3520 extends Template
{
	/**
	 * Object of HemodynamicPatientState_CID3602
	 */
	private HemodynamicPatientState_CID3602 objHemodynamicPatientStateCID3602;

	/**
	 * Object of RelativeTime_TID3521
	 */
	private RelativeTime_TID3521 objRelativeTimeTID3521;

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

	/**
	 * Retrieves Relative Time 
	 * @return objRelativeTimeTID3521 Object of RelativeTime_TID3521 
	 */
	public RelativeTime_TID3521 getRelativeTime() 
	{
		if(null == this.objRelativeTimeTID3521)
			this.objRelativeTimeTID3521 = new RelativeTime_TID3521(getSRTree());
		return this.objRelativeTimeTID3521;
	}

	/**
	 * Sets the value for Clinical Context
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumContinuityOfContent Enumerated Value for ContinuityOfContent.
	 */
	public void setClinicalContext(int[] arrPosition, EnumContinuityOfContent enumContinuityOfContent)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_HemodynamicClinicalContext.CLINICAL_CONTEXT.getValue();
		String strCodeValue = EnumCV_HemodynamicClinicalContext.CLINICAL_CONTEXT_122127.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 Patient State.
	 * @param arrPosition  arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumHemodynamicPatientState Enum value for Hemodynamic Patient State
	 */
	public void setPatientState(int[] arrPosition, EnumCM_HemodynamicPatientState enumHemodynamicPatientState)
	{
		/**
		 * Sets the value for ProcedureIntent.
		 */
		if(null== this.objHemodynamicPatientStateCID3602)
			this.objHemodynamicPatientStateCID3602 = new HemodynamicPatientState_CID3602();
		this.objHemodynamicPatientStateCID3602.setHemodynamicPatientState(enumHemodynamicPatientState);

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

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_HemodynamicClinicalContext.PATIENT_STATE.getValue();
		String strCodeValue = EnumCV_HemodynamicClinicalContext.PATIENT_STATE_109054.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,strSNOMEDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Patient State
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strPatientState String value for Patient State.
	 */
	public void setPatientState(int[] arrPosition, String strPatientState)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_HemodynamicClinicalContext.PATIENT_STATE.getValue();
		String strCodeValue = EnumCV_HemodynamicClinicalContext.PATIENT_STATE_109054.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, strPatientState);
		getSRTree().addChild(objContentSequenceItem);
	}
}
