/*******************************************************************************
 *  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.srtree.SRTree;
import cdac.medinfo.sdk.dcm30_04.templates.cid.RelativeTimes_CID3600;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_RelativeTime;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_RelativeTimes;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_RelativeTime;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.Template;

/**
 * This class represents RelativeTime - TID3521
 */
public class RelativeTime_TID3521 extends Template
{
	/**
	 * Object of RelativeTimes_CID3600
	 */
	private RelativeTimes_CID3600 objRelativeTimesCID3600;

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

	/**
	 * Sets the value for Relative time.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumRelativeTimes Enumerated value for Relative time
	 */
	public void setRelativeTime(int[] arrPosition, EnumCM_RelativeTimes enumRelativeTimes)
	{
		/**
		 * Sets the value for Subject Sex which follows the template CID7455
		 */
		if(null== this.objRelativeTimesCID3600)
			this.objRelativeTimesCID3600 = new RelativeTimes_CID3600();
		this.objRelativeTimesCID3600.setRelativeTimes(enumRelativeTimes);

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

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_RelativeTime.RELATIVE_TIME.getValue();
		String strCodeValue = EnumCV_RelativeTime.RELATIVE_TIME_G_D709.getValue();
		String strCSD2 = 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 , strCSD2, strCV, strCSD1, "", strCM,strSNOMEDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}
}
