/*******************************************************************************
 *  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.NumericValueQualifier_CID42;
import cdac.medinfo.sdk.dcm30_04.templates.cid.Sex_CID7455;
import cdac.medinfo.sdk.dcm30_04.templates.cid.Species_CID7454;
import cdac.medinfo.sdk.dcm30_04.templates.cid.UnitsOfMeasureForAge_CID7456;
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_NumericValueQualifier;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_Sex;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_Species;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_SubjectContextPatient;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_UnitsOfMeasure;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_SubjectContextPatient;

/**
 * Identifies (and optionally describes) a patient who is the subject.
 */
/**
 * This class represents SubjectContextPatient - TID1007
 */
public class SubjectContextPatient_TID1007 extends Template
{
	/**
	 * Object of Sex_CID7455. 
	 */
	private Sex_CID7455 objSex;
	
	/**
	 * Object of UnitsOfMeasureForAge_CID7456. 
	 */
	private UnitsOfMeasureForAge_CID7456 objUnitsOfMeasureForAge;
	
	/**
	 * Object of UnitsOfMeasureForAge_CID7456. 
	 */
	private NumericValueQualifier_CID42 objNumericValueQualifier;
	
	/**
	 * Object of Species_CID7454. 
	 */
	private Species_CID7454 objSpecies;
	
	/**
	 * Instantiates a new SubjectContextPatient_TID1007 Template.
	 * @param objTree Object of SRTree.
	 */
	public SubjectContextPatient_TID1007(SRTree objTree)
	{
		super(objTree);
	}
	
	/**
	 * Sets the value for Subject UID
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strSubjectUID String value for SubjectUID.
	 */
	public void setSubjectUID(int[] arrPosition, String strSubjectUID)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_SubjectContextPatient.SUBJECT_UID.getValue();
		String strCodeValue = EnumCV_SubjectContextPatient.SUBJECT_UID_121028.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, strSubjectUID);
		getSRTree().addChild(objContentSequenceItem);
	}
	
	/**
	 * Sets the value for Subject Name.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strSubjectName String value for SubjectName
	 */
	public void setSubjectName(int[] arrPosition, String strSubjectName)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_SubjectContextPatient.SUBJECT_NAME.getValue();
		String strCodeValue = EnumCV_SubjectContextPatient.SUBJECT_NAME_121029.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();
		
		/**
		 * Creating a node of Value Type PNAME and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createPnameNode(arrPosition, strCodeMeaning, strCodeValue, strCSD, strSubjectName);
		getSRTree().addChild(objContentSequenceItem);
	}
	
	/**
	 * Sets the value for SubjectID.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strCodingSchemeVersionForCode CodingSchemeVersion 
	 */
	public void setSubjectID(int [] arrPosition ,String strCodingSchemeVersionForCode)
	{
		/**
		 * 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();
		
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator for ObserverContext.
		 */
		String strCMObserverContext = EnumCM_SubjectContextPatient.SUBJECT_ID.getValue();
		String strCVForObserverType = EnumCV_SubjectContextPatient.SUBJECT_ID_121030.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, strCMObserverContext,strCVForObserverType , strCSD, strCodeValue, strCodingSchemeDesignator, strCodingSchemeVersionForCode, strCodeMeaning);
		
		getSRTree().addChild(objContentSequenceItem);
	}
	
	
	/**
	 * Sets the value for Subject Birth Date.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strSubjectBirthDate String value for Subject Birth Date
	 */
	public void setSubjectBirthDate(int[] arrPosition, String strSubjectBirthDate)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_SubjectContextPatient.SUBJECT_BIRTH_DATE.getValue();
		String strCodeValue = EnumCV_SubjectContextPatient.SUBJECT_BIRTH_DATE_121031.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();
		
		/**
		 * Creating a node of Value Type DATE and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createDateNode(arrPosition, strCodeMeaning, strCodeValue, strCSD, strSubjectBirthDate);
		getSRTree().addChild(objContentSequenceItem);
	}
	
	/**
	 * Sets the value for Subject Sex.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumSex value for Sex
	 * @param strCodingSchemeVersionForCode CodingSchemeVersion 
	 */
	public void setSubjectSex(int[] arrPosition, EnumCM_Sex enumSex,String strCodingSchemeVersionForCode)
	{
		/**
		 * Sets the value for Subject Sex which follows the template CID7455
		 */
		this.objSex.setSex(enumSex);
		
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCM = objSex.getCodeMeaning();
		String strCV = objSex.getCodeValue();
		String strCSD1 = objSex.getCodingSchemeDesignator();
		
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_SubjectContextPatient.SUBJECT_SEX.getValue();
		String strCodeValue = EnumCV_SubjectContextPatient.SUBJECT_SEX_121032.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, strCodingSchemeVersionForCode, strCM);
		getSRTree().addChild(objContentSequenceItem);
	}
	
	/**
	 * Sets the value for Subject Age.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumUnitsOfMeasureForAge Object of EnumUnitsOfMeasureForAge
	 * @param arrNumericValue String array for Numeric Value.
	 * @param enumNumericValueQualifier Object of EnumCM_NumericValueQualifier
	 * @param strCSVersioForUnit Coding Scheme Version for UnitsOfMeasureForAge.
	 * @param strCSVersioForQualifier Coding Scheme Version for NumericValueQualifier
	 */
	public void setSubjectAge(int[] arrPosition,EnumCM_UnitsOfMeasure enumUnitsOfMeasureForAge, String[] arrNumericValue, EnumCM_NumericValueQualifier enumNumericValueQualifier, String strCSVersioForQualifier)
	{
		/**
		 * Sets the value for Units Of Measure For Age which follows the template CID7456 
		 */
		this.objUnitsOfMeasureForAge.setUnitsOfMeasureForAge(enumUnitsOfMeasureForAge);
		
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator For Unit of Age.
		 */
		String strCMForUnit = objUnitsOfMeasureForAge.getCodeMeaning();
		String strCVForUnit = objUnitsOfMeasureForAge.getCodeValue();
		String strCSDForUnit = objUnitsOfMeasureForAge.getCodingSchemeDesignator();
		String strCSVForUnit = objUnitsOfMeasureForAge.getCodingSchemeVersion();
		
		/**
		 * Sets the value for NumericValueQualifier which follows the template DCIT42 
		 */
		this.objNumericValueQualifier.setNumericValueQualifier(enumNumericValueQualifier);
		
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator For NumericValueQualifier.
		 */
		String strCMForQualifier = objNumericValueQualifier.getCodeMeaning();
		String strCVForQualifier = objNumericValueQualifier.getCodeValue();
		String strCSDForQualifier = objNumericValueQualifier.getCodingSchemeDesignator();

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_SubjectContextPatient.SUBJECT_AGE.getValue();
		String strCodeValue = EnumCV_SubjectContextPatient.SUBJECT_AGE_121033.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();
		
		ContentSequenceItem objContentSequenceItem = getSRTree().createNumNode(arrPosition,strCodeMeaning,strCodeValue,strCSD,arrNumericValue,strCVForUnit,strCSDForUnit,strCSVForUnit,strCMForUnit,strCMForQualifier,strCVForQualifier,strCSDForQualifier,strCSVersioForQualifier);
		getSRTree().addChild(objContentSequenceItem);
	}
	
	/**
	 * Sets the value for Subject Species.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumSpecies value for Species
	 * @param strCodingSchemeVersionForCode CodingSchemeVersion 
	 */
	public void setSubjectSpecies(int[] arrPosition, EnumCM_Species enumSpecies ,String strCodingSchemeVersionForCode)
	{
		/**
		 * Sets the value for Subject Species which follows the template CID7454
		 */
		this.objSpecies.setSpecimen(enumSpecies);
		
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCM = objSpecies.getCodeMeaning();
		String strCV = objSpecies.getCodeValue();
		String strCSD1 = objSpecies.getCodingSchemeDesignator();
		String strSNOMEDCTID = objSpecies.getSNOMEDCTID();
		
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_SubjectContextPatient.SUBJECT_SPECIES.getValue();
		String strCodeValue = EnumCV_SubjectContextPatient.SUBJECT_SPECIES_121034.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, strCodingSchemeVersionForCode, strCM,strSNOMEDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}
}
