/*******************************************************************************
 *  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.PurposeOfReferenceToObject_CID3407;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_NoBCIDSpecified;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_PurposeOfReferenceToObject;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ReferencedObject;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_ReferencedObject;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.Template;

/**
 * The Referenced Object Template allows reference to measurement or report objects, such as prior
 * medical reports, laboratory results, hemodynamic measurement reports, or quantitative analysis reports.
 */
/**
 * This class represents ReferencedObject - TID3103
 */
public class ReferencedObject_TID3103 extends Template
{
	/**
	 * Object of PurposeOfReferenceToObject_CID3407
	 */
	private PurposeOfReferenceToObject_CID3407 objPurposeOfReferenceToObject_CID3407;

	/**
	 * Object of LogEntryQualifiers_TID3010
	 */

	private LogEntryQualifiers_TID3010 objLogEntryQualifiers_TID3010;

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

	/**
	 * Retrieves Log Entry Qualifiers
	 * @return objLogEntryQualifiers_TID3010 object of objLogEntryQualifiers_TID3010
	 */
	public LogEntryQualifiers_TID3010 getLogEntryQualifiers_TID3010()
	{
		if(null == objLogEntryQualifiers_TID3010)
			objLogEntryQualifiers_TID3010 = new LogEntryQualifiers_TID3010(getSRTree());
		return objLogEntryQualifiers_TID3010;
	}

	/**
	 * Sets Purpose Of Reference To Object
	 * @param arrPosition position at which the node will get added in the tree.
	 * @param enumPurposeOfReferenceToObject Enum value for Purpose Of Reference To Object
	 * @param strReferencedSOPClassUID Referenced SOP Class UID
	 * @param strReferencedSOPInstanceUID Referenced SOP Instance UID
	 */
	public void setPurposeOfReferenceToObject(int[] arrPosition, EnumCM_PurposeOfReferenceToObject enumPurposeOfReferenceToObject, String strReferencedSOPClassUID, String strReferencedSOPInstanceUID)
	{
		if(null== this.objPurposeOfReferenceToObject_CID3407)
			this.objPurposeOfReferenceToObject_CID3407 = new PurposeOfReferenceToObject_CID3407();
		objPurposeOfReferenceToObject_CID3407.setPurposeOfReferenceToObject(enumPurposeOfReferenceToObject);

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = objPurposeOfReferenceToObject_CID3407.getCodeMeaning();
		String strCodeValue = objPurposeOfReferenceToObject_CID3407.getCodeValue();
		String strCSD = objPurposeOfReferenceToObject_CID3407.getCodingSchemeDesignator();

		/**
		 * Creating a node of Value Type COMPOSITE and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createCompositeNode(arrPosition, strCodeMeaning, strCodeValue, strCSD, strReferencedSOPClassUID, strReferencedSOPInstanceUID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Document Title.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strCodingSchemeVersionForCode CodingSchemeVersion 
	 */
	public void setDocumentTitle(int [] arrPosition ,String strCodingSchemeVersionForCode)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator for Value Type CODE.
		 */
		String strCMObserverContext = EnumCM_ReferencedObject.DOCUMENT_TITLE.getValue();
		String strCVForObserverType = EnumCV_ReferencedObject.DOCUMENT_TITLE_121144.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator for Value Type CODE.
		 */
		String strCodeMeaning = EnumCM_NoBCIDSpecified.NO_VALUE.getValue();
		String strCodeValue = EnumCM_NoBCIDSpecified.NO_VALUE.getValue();
		String strCodingSchemeDesignator = EnumCodingSchemeDesignator.NO_VALUE.getValue();	

		/**
		 * Creating a node of Value Type CODE and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createCodeNode(arrPosition, strCMObserverContext,strCVForObserverType , strCSD, strCodeValue, strCodingSchemeDesignator, strCodingSchemeVersionForCode, strCodeMeaning);

		getSRTree().addChild(objContentSequenceItem);
	}
}
