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

import cdac.medinfo.sdk.dcm30_04.baselibs.ContentSequenceItem;
import cdac.medinfo.sdk.dcm30_04.srtree.SRTree;
import cdac.medinfo.sdk.dcm30_04.templates.cid.UseStatus_CID3773;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_MedicalDeviceUse;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_UseStatus;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_MedicalDeviceUse;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.Template;

/**
 * This class represents MedicalDeviceUse_TID3831
 */
public class MedicalDeviceUse_TID3831 extends Template
{
	
	/**
	 * Object of UseStatus_CID3773
	 */
	private UseStatus_CID3773 objUseStatusCID3773;
	
	/**
	 * Instantiates a new MedicalDeviceUse_TID3831 Template.
	 * @param objTree Object of SRTree.
	 */
	public MedicalDeviceUse_TID3831(SRTree objTree)
	{
		super(objTree);
	}

	/**
	 * Sets the value for Medical Device Used.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 */
	public void setMedicalDeviceUsed(int[] arrPosition)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_MedicalDeviceUse.MEDICAL_DEVICE_USED.getValue();
		String strCodeValue = EnumCV_MedicalDeviceUse.MEDICAL_DEVICE_USED_121436.getValue();
		String strCSD = 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, strCSD, "", "", "", "");
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Date Time Started.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strValue 
	 */
	public void setDateTimeStarted(int[] arrPosition, String strValue)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_MedicalDeviceUse.DATETIME_STARTED.getValue();
		String strCodeValue = EnumCV_MedicalDeviceUse.DATETIME_STARTED_111526.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, strValue);
		getSRTree().addChild(objContentSequenceItem);
	}
		
	/**
	 * Sets the value for Date Time Ended.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strValue 
	 */
	public void setDateTimeEnded(int[] arrPosition, String strValue)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_MedicalDeviceUse.DATETIME_ENDED.getValue();
		String strCodeValue = EnumCV_MedicalDeviceUse.DATETIME_ENDED_111527.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, strValue);
		getSRTree().addChild(objContentSequenceItem);
	}
	
	/**
	 * Sets the value for Status.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumUseStatus Enum value for Use Status.
	 */
	public void setStatus(int[] arrPosition, EnumCM_UseStatus enumUseStatus)
	{
		/**
		 * Sets the value for Primary Intervention Device.
		 */
		if(null== this.objUseStatusCID3773)
			this.objUseStatusCID3773 = new UseStatus_CID3773();
		this.objUseStatusCID3773.setUseStatus(enumUseStatus);

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCM = this.objUseStatusCID3773.getCodeMeaning();
		String strCV = this.objUseStatusCID3773.getCodeValue();
		String strCSD1 = this.objUseStatusCID3773.getCodingSchemeDesignator();
		String strSNOMEDCTID = objUseStatusCID3773.getSNOMEDCTID();
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_MedicalDeviceUse.STATUS.getValue();
		String strCodeValue = EnumCV_MedicalDeviceUse.STATUS_33999_4.getValue();
		String strCSD2 = EnumCodingSchemeDesignator.LN.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 Comment.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strSummary String value for Summary.
	 */
	public void setComment (int[] arrPosition)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_MedicalDeviceUse.COMMENT.getValue();
		String strCodeValue = EnumCV_MedicalDeviceUse.COMMENT_121106.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, "");
		getSRTree().addChild(objContentSequenceItem);
	}

}
