/*******************************************************************************
 *  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.LevelOfSignificance_CID220;
import cdac.medinfo.sdk.dcm30_04.templates.cid.MeasurementUncertaintyConcepts_CID225;
import cdac.medinfo.sdk.dcm30_04.templates.cid.NormalityCodes_CID222;
import cdac.medinfo.sdk.dcm30_04.templates.cid.SelectionMethod_CID224;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_LevelOfSignificance;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_MeasurementProperties;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_MeasurementUncertaintyConcepts;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_NormalityCodes;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_SelectionMethod;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_MeasurementProperties;

/**
 * This Template provides the properties of a numeric measurement, including evaluations of its normality
 * and/or significance, its relationship to a reference population, and an indication of its selection from a set
 * of measurements.
 */
/**
 * This class represents MeasurementProperties - TID310
 */
public class MeasurementProperties_TID310 extends Template
{
	/**
	 * Object of NormalityCodes_CID222
	 */
	private NormalityCodes_CID222 objNormalityCodes_CID222;

	/**
	 * Object of MeasurementStatisticalProperties_TID311
	 */

	private MeasurementStatisticalProperties_TID311 objMeasurementStatisticalProperties_TID311;

	/**
	 * Object of NormalRangeProperties_TID312
	 */

	private NormalRangeProperties_TID312 objNormalRangeProperties_TID312;

	/**
	 * Object of LevelOfSignificance_CID220
	 */
	private LevelOfSignificance_CID220 objLevelOfSignificance_CID220;

	/**
	 * Object of MeasurementUncertaintyConcepts_CID225
	 */
	private MeasurementUncertaintyConcepts_CID225 objMeasurementUncertaintyConcepts_CID225;

	/**
	 * Object of SelectionMethod_CID224
	 */
	private SelectionMethod_CID224 objSelectionMethod_CID224;

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

	/**
	 * Retrieves the object of MeasurementStatisticalProperties_TID311
	 * @return objMeasurementStatisticalProperties_TID311 object of MeasurementStatisticalProperties_TID311
	 */
	public MeasurementStatisticalProperties_TID311 getMeasurementStatisticalProperties()
	{
		if(null == objMeasurementStatisticalProperties_TID311)
			objMeasurementStatisticalProperties_TID311 = new MeasurementStatisticalProperties_TID311(getSRTree());
		return objMeasurementStatisticalProperties_TID311;
	}

	/**
	 * Retrieves the object of NormalRangeProperties_TID312
	 * @return objNormalRangeProperties_TID312 object of NormalRangeProperties_TID312
	 */
	public NormalRangeProperties_TID312 getNormalRangeProperties_TID312()
	{
		if(null == objNormalRangeProperties_TID312)
			objNormalRangeProperties_TID312 = new NormalRangeProperties_TID312(getSRTree());
		return objNormalRangeProperties_TID312;
	}

	/**
	 * Sets value for Normality.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumNormalityCodes Enumvalue for Normality Codes.
	 */
	public void setNormality(int[] arrPosition, EnumCM_NormalityCodes enumNormalityCodes)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_MeasurementProperties.NORMALITY.getValue();
		String strCodeValue = EnumCV_MeasurementProperties.NORMALITY_121402.getValue();
		String strCSDesg = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Setting value for Normality Codes
		 */
		if(null== this.objNormalityCodes_CID222)
			this.objNormalityCodes_CID222 = new NormalityCodes_CID222();
		this.objNormalityCodes_CID222.setNormalityCodes(enumNormalityCodes);

		String strCM = objNormalityCodes_CID222.getCodeMeaning();
		String strCV = objNormalityCodes_CID222.getCodeValue();
		String strCSD = objNormalityCodes_CID222.getCodingSchemeDesignator();
		String strSNMDCTID = objNormalityCodes_CID222.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,strSNMDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets value for Level of Significance.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumLevelOfSignificance Enumvalue for Level of Significance.
	 */
	public void setLevelOfSignificance(int[] arrPosition, EnumCM_LevelOfSignificance enumLevelOfSignificance)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_MeasurementProperties.LEVEL_OF_SIGNIFICANCE.getValue();
		String strCodeValue = EnumCV_MeasurementProperties.LEVEL_OF_SIGNIFICANCE_121403.getValue();
		String strCSDesg = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Setting value for Normality Codes
		 */
		if(null== this.objLevelOfSignificance_CID220)
			this.objLevelOfSignificance_CID220 = new LevelOfSignificance_CID220();
		this.objLevelOfSignificance_CID220.setLevelOfSignificance(enumLevelOfSignificance);

		String strCM = objLevelOfSignificance_CID220.getCodeMeaning();
		String strCV = objLevelOfSignificance_CID220.getCodeValue();
		String strCSD = objLevelOfSignificance_CID220.getCodingSchemeDesignator();
		String strSNMDCTID = objLevelOfSignificance_CID220.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,strSNMDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Measurement Uncertainty Concepts.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumValue Enumerated value for one of the following enums - EnumPopulationStatisticalDescriptors or 
	 * EnumSampleStatisticalDescriptors.
	 * @param arrNumericValue String array for Measurement Uncertainty Concepts
	 */
	public void setMeasurementUncertaintyConcepts(int[] arrPosition,EnumCM_MeasurementUncertaintyConcepts enumMeasurementUncertaintyConcepts, String[] arrNumericValue)
	{
		if(null== this.objMeasurementUncertaintyConcepts_CID225)
			this.objMeasurementUncertaintyConcepts_CID225 = new MeasurementUncertaintyConcepts_CID225();
		this.objMeasurementUncertaintyConcepts_CID225.setMeasurementUncertaintyConcepts(enumMeasurementUncertaintyConcepts);

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

		/**
		 * Creating a node of Value Type NUM and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createNumNode(arrPosition,strCodeMeaning,strCodeValue,strCSD,arrNumericValue,"","","","","","","","",strSNMDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets value for Selection Status.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumSelectionMethod Enumvalue for Selection Status.
	 */
	public void setSelectionStatus(int[] arrPosition, EnumCM_SelectionMethod enumSelectionMethod)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_MeasurementProperties.SELECTION_STATUS.getValue();
		String strCodeValue = EnumCV_MeasurementProperties.SELECTION_STATUS_121404.getValue();
		String strCSDesg = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Setting value for Normality Codes
		 */
		if(null== this.objSelectionMethod_CID224)
			this.objSelectionMethod_CID224 = new SelectionMethod_CID224();
		this.objSelectionMethod_CID224.setSelectionMethod(enumSelectionMethod);

		String strCM = objSelectionMethod_CID224.getCodeMeaning();
		String strCV = objSelectionMethod_CID224.getCodeValue();
		String strCSD = objSelectionMethod_CID224.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);
	}
}
