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

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.ArterialLesionLocations_CID3604;
import cdac.medinfo.sdk.dcm30_04.templates.cid.CardiovascularAnatomicLocationModifiers_CID3019;
import cdac.medinfo.sdk.dcm30_04.templates.cid.SubSegmentMethods_CID3456;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_CardiovascularAnatomicLocationModifiers;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_SubSegmentMethods;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_SubSegmentalDataTemplate;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_SubSegmentalDataTemplate;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.Template;

/**
 * This class represents SubSegmentalDataTemplate - TID3217
 */
public class SubSegmentalDataTemplate_TID3217 extends Template
{
	/**
	 * Object of CardiovascularAnatomicLocationModifiers_CID3019
	 */
	private CardiovascularAnatomicLocationModifiers_CID3019 objAnatomicLocationModifiersCID3019;

	/**
	 * Object of ArterialLesionLocations_CID3604
	 */
	private ArterialLesionLocations_CID3604 objArterialLesionLocations_CID3604;

	/**
	 * object of SubSegmentMethods_CID3456
	 */
	private SubSegmentMethods_CID3456 objSubSegmentMethodsCID3456;

	/**
	 * Object of PositionInArterialSegment_TID3218
	 */

	private PositionInArterialSegment_TID3218 objPositionInArterialSegmentTID3218;

	/**
	 * Object of SegmentValues_TID3219
	 */
	private SegmentValues_TID3219 objSegmentValuesTID3219;
	
	/**
	 * Instantiates SubSegmentalDataTemplate_TID3217 Template.
	 * @param objTree Object of SRTree.
	 */
	public SubSegmentalDataTemplate_TID3217(SRTree objTree)
	{
		super(objTree);
	}
	/**
	 * Retrieves SegmentValues
	 * @return objSegmentValuesTID3219 Object of SegmentValues_TID3219 
	 */
	public SegmentValues_TID3219 getSegmentValues() 
	{
		if(null == this.objSegmentValuesTID3219)
			this.objSegmentValuesTID3219 = new SegmentValues_TID3219(getSRTree());
		return this.objSegmentValuesTID3219;
	}
	/**
	 * Retrieves PositionInArterialSegment 
	 * @return objObserverContext Object of PositionInArterialSegment_TID3218 
	 */
	public PositionInArterialSegment_TID3218 getPositionInArterialSegment() 
	{
		if(null == this.objPositionInArterialSegmentTID3218)
			this.objPositionInArterialSegmentTID3218 = new PositionInArterialSegment_TID3218(getSRTree());
		return this.objPositionInArterialSegmentTID3218;
	}

	/**
	 * Sets value for Finding Site.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumValue This value can be one of the three Enum - EnumCM_ArterialSourceLocations, EnumCM_CoronaryArteries
	 * or EnumCM_CoronaryArterySegments.
	 */
	public void setFindingSite(int[] arrPosition, Enum enumValue)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_SubSegmentalDataTemplate.FINDING_SITE.getValue();
		String strCodeValue = EnumCV_SubSegmentalDataTemplate.FINDING_SITE_G_C0E3.getValue();
		String strCSDesg = EnumCodingSchemeDesignator.SRT.getValue();

		/**
		 * Setting value for Arterial Lesion Location
		 */
		if(null== this.objArterialLesionLocations_CID3604)
			this.objArterialLesionLocations_CID3604 = new ArterialLesionLocations_CID3604();
		this.objArterialLesionLocations_CID3604.setArterialLesionLocation(enumValue);

		String strCM = objArterialLesionLocations_CID3604.getCodeMeaning();
		String strCV = objArterialLesionLocations_CID3604.getCodeValue();
		String strCSD = objArterialLesionLocations_CID3604.getCodingSchemeDesignator();
		String strCSV = objArterialLesionLocations_CID3604.getCodingSchemeVersion();

		/**
		 * 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, strCSDesg, strCV, strCSD, strCSV, strCM);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Findings
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumContinuityOfContent Enumerated Value for ContinuityOfContent.
	 */
	public void setFindings(int[] arrPosition, EnumContinuityOfContent enumContinuityOfContent)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_SubSegmentalDataTemplate.FINDINGS.getValue();
		String strCodeValue = EnumCV_SubSegmentalDataTemplate.FINDINGS_121070.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 value for Topographical modifier.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumCardiovascularAnatomicLocationModifiers Enumerated value for Topographical modifier.
	 */
	public void setTopographicalModifier(int[] arrPosition, EnumCM_CardiovascularAnatomicLocationModifiers enumCardiovascularAnatomicLocationModifiers)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_SubSegmentalDataTemplate.TOPOGRAPHICAL_MODIFIER.getValue();
		String strCodeValue = EnumCV_SubSegmentalDataTemplate.TOPOGRAPHICAL_MODIFIER_G_A1F8.getValue();
		String strCSDesg = EnumCodingSchemeDesignator.SRT.getValue();

		/**
		 * Setting value for Topographical modifier
		 */
		if(null== this.objAnatomicLocationModifiersCID3019)
			this.objAnatomicLocationModifiersCID3019 = new CardiovascularAnatomicLocationModifiers_CID3019();
		this.objAnatomicLocationModifiersCID3019.setCardiovascularAnatomicLocationModifiers(enumCardiovascularAnatomicLocationModifiers);

		String strCM = objAnatomicLocationModifiersCID3019.getCodeMeaning();
		String strCV = objAnatomicLocationModifiersCID3019.getCodeValue();
		String strCSD = objAnatomicLocationModifiersCID3019.getCodingSchemeDesignator();
		String strSNOMEDCTID = objAnatomicLocationModifiersCID3019.getSNOMEDCTID();

		/**
		 * 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, strCSDesg, strCV, strCSD, "", strCM,strSNOMEDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets value for Segmentation Method.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumSubSegmentMethods Enumerated value for Segmentation Method.
	 */
	public void setSegmentationMethod(int[] arrPosition, EnumCM_SubSegmentMethods enumSubSegmentMethods)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_SubSegmentalDataTemplate.SEGMENTATION_METHOD.getValue();
		String strCodeValue = EnumCV_SubSegmentalDataTemplate.SEGMENTATION_METHOD_122554.getValue();
		String strCSDesg = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Setting value for Segmentation Method
		 */
		if(null== this.objSubSegmentMethodsCID3456)
			this.objSubSegmentMethodsCID3456 = new SubSegmentMethods_CID3456();
		this.objSubSegmentMethodsCID3456.setSubSegmentMethods(enumSubSegmentMethods);

		String strCM = objSubSegmentMethodsCID3456.getCodeMeaning();
		String strCV = objSubSegmentMethodsCID3456.getCodeValue();
		String strCSD = objSubSegmentMethodsCID3456.getCodingSchemeDesignator();

		/**
		 * 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, strCSDesg, strCV, strCSD, "", strCM);
		getSRTree().addChild(objContentSequenceItem);
	}
}
