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

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.PersonRoles_CID7450;
import cdac.medinfo.sdk.dcm30_04.templates.cid.RelativeFrequencyOfEventValues_CID6091;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_IndicatedProblem;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_RelativeFrequencyOfEventValues;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_IndicatedProblem;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.Template;

/**
 * This class represents IndicatedProblem - TID9004
 */
public class IndicatedProblem_TID9004 extends Template
{
	/**
	 * Object of PersonRoles_CID7450
	 */
	private PersonRoles_CID7450 objPersonRolesCID7450;

	/**
	 * Object of RelativeFrequencyOfEventValues_CID6091
	 */
	private RelativeFrequencyOfEventValues_CID6091 objRelativeFrequencyOfEventValuesCID6091;

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

	/**
	 * Sets the value for Indicated Problem.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree..
	 */
	public void setIndicatedProblem(int[] arrPosition)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_IndicatedProblem.INDICATED_PROBLEM.getValue();
		String strCodeValue = EnumCV_IndicatedProblem.INDICATED_PROBLEM_111533.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 Laterality.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 */
	public void setLaterality(int[] arrPosition)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_IndicatedProblem.LATERALITY.getValue();
		String strCodeValue = EnumCV_IndicatedProblem.LATERALITY_G_C171.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, strCodeMeaning, strCodeValue, strCSD, "", "", "", "");
		getSRTree().addChild(objContentSequenceItem);
	}
	
	/**
	 * Sets the value for Finding site.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 */
	public void setFindingSite(int[] arrPosition)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_IndicatedProblem.FINDING_SITE.getValue();
		String strCodeValue = EnumCV_IndicatedProblem.FINDING_SITE_G_C0E3.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, strCodeMeaning, strCodeValue, strCSD, "", "", "", "");
		getSRTree().addChild(objContentSequenceItem);
	}
	
	/**
	 * Sets the value for Problem List.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumContinuityOfContent Enumerated Value for ContinuityOfContent.
	 */
	public void setProblemList(int[] arrPosition, EnumContinuityOfContent enumContinuityOfContent)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_IndicatedProblem.PROBLEM_LIST.getValue();
		String strCodeValue = EnumCV_IndicatedProblem.PROBLEM_LIST_11450_4.getValue();
		String strCSD = EnumCodingSchemeDesignator.LN.getValue();

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

	/**
	 * Sets the value for Role of person reporting.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumValue This Enum value can be one of the following enums - EnumFamilyMember, EnumCM_PersonRoles,
	 * or EnumCM_OrganizationalRoles.
	 */
	public void setRoleOfPersonReporting(int[] arrPosition, Enum enumValue)
	{
		/**
		 * Sets the value for InterventionActionsAndStatus.
		 */
		if(null== this.objPersonRolesCID7450)
			this.objPersonRolesCID7450 = new PersonRoles_CID7450();
		this.objPersonRolesCID7450.setPersonRoles(enumValue);

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCM = this.objPersonRolesCID7450.getCodeMeaning();
		String strCV = this.objPersonRolesCID7450.getCodeValue();
		String strCSD1 = this.objPersonRolesCID7450.getCodingSchemeDesignator();
		String strSNOMEDCTID = objPersonRolesCID7450.getSNOMEDCTID();

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_IndicatedProblem.ROLE_OF_PERSON_REPORTING.getValue();
		String strCodeValue = EnumCV_IndicatedProblem.ROLE_OF_PERSON_REPORTING_111534.getValue();
		String strCSD2 = 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 , strCSD2, strCV, strCSD1, "", strCM,strSNOMEDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Datetime problem observed
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strDatetimeProblemObserved String value for DateTime of Intervention
	 */
	public void setDatetimeProblemObserved(int[] arrPosition, String strDatetimeProblemObserved)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_IndicatedProblem.DATETIME_PROBLEM_OBSERVED.getValue();
		String strCodeValue = EnumCV_IndicatedProblem.DATETIME_PROBLEM_OBSERVED_111535.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, strDatetimeProblemObserved);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Frequency.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumRelativeFrequencyOfEventValues Enumerated value for RelativeFrequencyOfEventValues.
	 */
	public void setFrequency(int[] arrPosition, EnumCM_RelativeFrequencyOfEventValues enumRelativeFrequencyOfEventValues)
	{
		/**
		 * Sets the value for InterventionActionsAndStatus.
		 */
		if(null== this.objRelativeFrequencyOfEventValuesCID6091)
			this.objRelativeFrequencyOfEventValuesCID6091 = new RelativeFrequencyOfEventValues_CID6091();
		this.objRelativeFrequencyOfEventValuesCID6091.setRelativeFrequencyOfEventValues(enumRelativeFrequencyOfEventValues);

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCM = this.objRelativeFrequencyOfEventValuesCID6091.getCodeMeaning();
		String strCV = this.objRelativeFrequencyOfEventValuesCID6091.getCodeValue();
		String strCSD1 = this.objRelativeFrequencyOfEventValuesCID6091.getCodingSchemeDesignator();
		String strSNOMEDCTID = objRelativeFrequencyOfEventValuesCID6091.getSNOMEDCTID();

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_IndicatedProblem.FREQUENCY.getValue();
		String strCodeValue = EnumCV_IndicatedProblem.FREQUENCY_R_407E7.getValue();
		String strCSD2 = 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 , strCSD2, strCV, strCSD1, "", strCM,strSNOMEDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Datetime of last evaluation
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strDatetimeOfLastEvaluation String value for DateTime of Intervention
	 */
	public void setDatetimeOfLastEvaluation(int[] arrPosition, String strDatetimeOfLastEvaluation)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_IndicatedProblem.DATETIME_OF_LAST_EVALUATION.getValue();
		String strCodeValue = EnumCV_IndicatedProblem.DATETIME_OF_LAST_EVALUATION_111536.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, strDatetimeOfLastEvaluation);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Comment.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strComment String value for Comment
	 */
	public void setComment(int[] arrPosition, String strComment)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_IndicatedProblem.COMMENT.getValue();
		String strCodeValue = EnumCV_IndicatedProblem.COMMENT_122106.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, strComment);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Duration of Intervention.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param arrNumericValue String array for Numeric Value.
	 */
	public void setDurationOfIntervention(int[] arrPosition,String[] arrNumericValue)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_IndicatedProblem.DURATION.getValue();
		String strCodeValue = EnumCV_IndicatedProblem.DURATION_G_7290.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		ContentSequenceItem objContentSequenceItem = getSRTree().createNumNode(arrPosition,strCodeMeaning,strCodeValue,strCSD,arrNumericValue,"","","","","","","","");
		getSRTree().addChild(objContentSequenceItem);
	}
}
