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

import cdac.medinfo.sdk.dcm30_04.baselibs.ContentSequenceItem;
import cdac.medinfo.sdk.dcm30_04.srtree.SRTree;
import cdac.medinfo.sdk.dcm30_04.templates.cid.AnatomicPathologySpecimenTypes_CID8103;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_AnatomicPathologySpecimenTypes;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_SubjectContextSpecimen;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_SubjectContextSpecimen;

/**
 * This class represents SubjectContextSpecimen - TID1009
 */
public class SubjectContextSpecimen_TID1009 extends Template
{
	/**
	 * Object of AnatomicPathologySpecimenTypes_CID8103
	 */
	private AnatomicPathologySpecimenTypes_CID8103 objAnatomicPathologySpecimenTypes_CID8103 ;
	/**
	 * Object of SubjectContextPatient_TID1007 Template.
	 */
	 
	private SubjectContextPatient_TID1007 objSubjectContextPatient_TID1007 = null;
	
	/**
	 * Instantiates a new SubjectContextSpecimen_TID1009 Template.
	 * @param objTree Object of SRTree.
	 */
	public SubjectContextSpecimen_TID1009(SRTree objTree)
	{
		super(objTree);
	}
	
	/**
	 * Retrieves the object of SubjectContextPatient_TID1007 which provides the methods for setting different
	 * attributes of PAtient Subject Context.
	 */
	public void getPatientSubjectContext()
	{
		if(null== this.objSubjectContextPatient_TID1007)
	this.objSubjectContextPatient_TID1007 = new SubjectContextPatient_TID1007(getSRTree());
	}
	
	/**
	 * Sets the value for Specimen UID
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strSpecimenUID String value for SpecimenUID.
	 */
	public void setSpecimenUID(int[] arrPosition, String strSpecimenUID)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_SubjectContextSpecimen.SPECIMEN_UID.getValue();
		String strCodeValue = EnumCV_SubjectContextSpecimen.SPECIMEN_UID_121039.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().createUIDREFNode(arrPosition, strCodeMeaning, strCodeValue, strCSD, strSpecimenUID);
		getSRTree().addChild(objContentSequenceItem);
	}
	

	/**
	 * Sets the value for Specimen Identifier.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strSpecimenIdentifier String value for Specimen Identifier
	 */
	public void setSpecimenIdentifier(int[] arrPosition, String strSpecimenIdentifier)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_SubjectContextSpecimen.SPECIMEN_IDENTIFIER.getValue();
		String strCodeValue = EnumCV_SubjectContextSpecimen.SPECIMEN_IDENTIFIER_121041.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, strSpecimenIdentifier);
		getSRTree().addChild(objContentSequenceItem);
	}
	
	/**
	 * Sets the value for Specimen Type.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strCodingSchemeVersionForCode CodingSchemeVersion 
	 */
	public void setSpecimenType(int [] arrPosition ,String strCodingSchemeVersionForCode,EnumCM_AnatomicPathologySpecimenTypes enumAnatomicPathologySpecimenTypes)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator for Value Type CODE.
		 */
		if(null== this.objAnatomicPathologySpecimenTypes_CID8103)
			this.objAnatomicPathologySpecimenTypes_CID8103 = new AnatomicPathologySpecimenTypes_CID8103();
		this.objAnatomicPathologySpecimenTypes_CID8103.setAnatomicPathologySpecimenTypes(enumAnatomicPathologySpecimenTypes);
		String strCodeMeaning = objAnatomicPathologySpecimenTypes_CID8103.getCodeMeaning();
		 String strCodeValue = objAnatomicPathologySpecimenTypes_CID8103.getCodeValue();
		 String strCodingSchemeDesignator = objAnatomicPathologySpecimenTypes_CID8103.getCodingSchemeDesignator();
		 String strSNMDCTID = objAnatomicPathologySpecimenTypes_CID8103.getSNOMEDCTID();
		
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator for ObserverContext.
		 */
		String strCMObserverContext = EnumCM_SubjectContextSpecimen.SPECIMEN_TYPE.getValue();
		String strCVForObserverType = EnumCV_SubjectContextSpecimen.SPECIMEN_TYPE_R00254.getValue();
		String strCSD = 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, strCMObserverContext,strCVForObserverType , strCSD, strCodeValue, strCodingSchemeDesignator, strCodingSchemeVersionForCode, strCodeMeaning,strSNMDCTID);
		
		getSRTree().addChild(objContentSequenceItem);
	}
	
	/**
	 * Sets the value for Specimen Identifier.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strSpecimenIdentifier String value for Specimen Identifier
	 */
	public void setSpecimenContainerIdentifier(int[] arrPosition, String strSpecimenIdentifier)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_SubjectContextSpecimen.SPECIMEN_CONTAINER_IDENTIFIER.getValue();
		String strCodeValue = EnumCV_SubjectContextSpecimen.SPECIMEN_CONTAINER_IDENTIFIER_111700.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, strSpecimenIdentifier);
		getSRTree().addChild(objContentSequenceItem);
	}	
	
}
