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

import cdac.medinfo.sdk.dcm30_04.baselibs.ContentSequenceItem;
import cdac.medinfo.sdk.dcm30_04.srtree.SRTree;
import cdac.medinfo.sdk.dcm30_04.templates.cid.CirculatorySupportActions_CID3550;
import cdac.medinfo.sdk.dcm30_04.templates.cid.CirculatorySupport_CID3553;
import cdac.medinfo.sdk.dcm30_04.templates.cid.OxygenAdministrationActions_CID3530;
import cdac.medinfo.sdk.dcm30_04.templates.cid.OxygenAdministration_CID3531;
import cdac.medinfo.sdk.dcm30_04.templates.cid.PacingActions_CID3552;
import cdac.medinfo.sdk.dcm30_04.templates.cid.Pacing_CID3555;
import cdac.medinfo.sdk.dcm30_04.templates.cid.VentilationActions_CID3551;
import cdac.medinfo.sdk.dcm30_04.templates.cid.Ventilation_CID3554;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_CirculatorySupport;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_CirculatorySupportActions;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_OxygenAdministration;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_OxygenAdministrationActions;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_Pacing;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_PacingActions;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_PatientSupport;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_Unit;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_Ventilation;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_VentilationActions;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_PatientSupport;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_Unit;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.Template;

/**
 * The Patient Support Template allows recording of the use of various support technologies, including
 * oxygen, ventilation, pacing, etc.
 */
/**
 * This class represents PatientSupport - TID3113
 */
public class PatientSupport_TID3113 extends Template
{
	/**
	 * Object of LogEntryQualifiers_TID3010
	 */

	private LogEntryQualifiers_TID3010 objLogEntryQualifiers;

	/**
	 * Object of OxygenAdministrationActions_CID3530
	 */
	private OxygenAdministrationActions_CID3530 objOxygenAdministrationActions_CID3530;

	/**
	 * Object of OxygenAdministration_CID3531
	 */
	private OxygenAdministration_CID3531 objOxygenAdministration_CID3531;

	/**
	 * Object of CirculatorySupportActions_CID3550
	 */
	private CirculatorySupportActions_CID3550 objCirculatorySupportActions_CID3550;

	/**
	 * Object of CirculatorySupport_CID3553
	 */
	private CirculatorySupport_CID3553 objCirculatorySupport_CID3553;

	/**
	 * Object of VentilationActions_CID3551
	 */
	private VentilationActions_CID3551 objVentilationActions_CID3551;

	/**
	 * Object of Ventilation_CID3554
	 */
	private Ventilation_CID3554 objVentilation_CID3554;

	/**
	 * Object of PacingActions_CID3552
	 */
	private PacingActions_CID3552 objPacingActions_CID3552;

	/**
	 * Object of Pacing_CID3555
	 */
	private Pacing_CID3555 objPacing_CID3555;

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

	/**
	 * Retrieves LogEntryQualifiers
	 * @return objLogEntryQualifiers Object of LogEntryQualifiers_TID3010
	 */
	public LogEntryQualifiers_TID3010 getLogEntryQualifiers() 
	{
		if(null == this.objLogEntryQualifiers)
			this.objLogEntryQualifiers = new LogEntryQualifiers_TID3010(getSRTree());
		return this.objLogEntryQualifiers;
	}

	/**
	 * Sets the value for Oxygen Administration Actions.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumOxygenAdministrationActions Enum value for Oxygen Administration Actions
	 * @param enumOxygenAdministration Enum value for Oxygen Administration
	 */
	public void setOxygenAdministrationActions(int[] arrPosition, EnumCM_OxygenAdministrationActions enumOxygenAdministrationActions, EnumCM_OxygenAdministration enumOxygenAdministration)
	{
		/**
		 * Sets the value for OrganizationalRoles which follows the template CID7452
		 */
		if(null== this.objOxygenAdministrationActions_CID3530)
			this.objOxygenAdministrationActions_CID3530 = new OxygenAdministrationActions_CID3530();
		this.objOxygenAdministrationActions_CID3530.setOxygenAdministrationActions(enumOxygenAdministrationActions);

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

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		if(null== this.objOxygenAdministration_CID3531)
			this.objOxygenAdministration_CID3531 = new OxygenAdministration_CID3531();
		this.objOxygenAdministration_CID3531.setOxygenAdministration(enumOxygenAdministration);

		String strCodeMeaning = objOxygenAdministration_CID3531.getCodeMeaning();
		String strCodeValue = objOxygenAdministration_CID3531.getCodeValue();
		String strCSD2 = objOxygenAdministration_CID3531.getCodingSchemeDesignator();
		String strSNMDCTID = objOxygenAdministration_CID3531.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 , strCSD2, strCV, strCSD1, "", strCM,strSNMDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Oxygen Administration Rate.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param arrNumericValue String array for Numeric Value.
	 */
	public void setOxygenAdministrationRate(int[] arrPosition,String[] arrNumericValue)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator For Unit for No of Fetus.
		 */
		String strCMForUnit = EnumCM_Unit.DT.getValue();
		String strCVForUnit = EnumCV_Unit.DT.getValue();
		String strCSDForUnit = EnumCodingSchemeDesignator.UCUM.getValue();

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_PatientSupport.OXYGEN_ADMINISTRATION_RATE.getValue();
		String strCodeValue = EnumCV_PatientSupport.OXYGEN_ADMINISTRATION_RATE_121160.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

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

	/**
	 * Sets the value for Circulatory Support Actions.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumCirculatorySupportActions Enum value for Circulatory Support Actions
	 * @param enumCirculatorySupport Enum value for Circulatory Support
	 */
	public void setCirculatorySupportActions(int[] arrPosition, EnumCM_CirculatorySupportActions enumCirculatorySupportActions, EnumCM_CirculatorySupport enumCirculatorySupport)
	{
		/**
		 * Sets the value for OrganizationalRoles which follows the template CID7452
		 */
		if(null== this.objCirculatorySupportActions_CID3550)
			this.objCirculatorySupportActions_CID3550 = new CirculatorySupportActions_CID3550();
		this.objCirculatorySupportActions_CID3550.setCirculatorySupportActions(enumCirculatorySupportActions);

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

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		if(null== this.objCirculatorySupport_CID3553)
			this.objCirculatorySupport_CID3553 = new CirculatorySupport_CID3553();
		this.objCirculatorySupport_CID3553.setCirculatorySupport(enumCirculatorySupport);

		String strCodeMeaning = objCirculatorySupport_CID3553.getCodeMeaning();
		String strCodeValue = objCirculatorySupport_CID3553.getCodeValue();
		String strCSD2 = objCirculatorySupport_CID3553.getCodingSchemeDesignator();
		String strSNMDCTID = objCirculatorySupport_CID3553.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 , strCSD2, strCV, strCSD1, "", strCM,strSNMDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Ventilation Actions.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumVentilationActions Enum value for Ventilation Actions
	 * @param enumVentilation Enum value for Ventilation
	 */
	public void setVentilationActions(int[] arrPosition, EnumCM_VentilationActions enumVentilationActions, EnumCM_Ventilation enumVentilation)
	{
		/**
		 * Sets the value for OrganizationalRoles which follows the template CID7452
		 */
		if(null== this.objVentilationActions_CID3551)
			this.objVentilationActions_CID3551 = new VentilationActions_CID3551();
		this.objVentilationActions_CID3551.setVentilationActions(enumVentilationActions);

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

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		if(null== this.objVentilation_CID3554)
			this.objVentilation_CID3554 = new Ventilation_CID3554();
		this.objVentilation_CID3554.setVentilation(enumVentilation);

		String strCodeMeaning = objVentilation_CID3554.getCodeMeaning();
		String strCodeValue = objVentilation_CID3554.getCodeValue();
		String strCSD2 = objVentilation_CID3554.getCodingSchemeDesignator();
		String strSNMDCTID = objVentilation_CID3554.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 , strCSD2, strCV, strCSD1, "", strCM,strSNMDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Pacing Actions.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumPacingActions Enum value for Pacing Actions
	 * @param enumPacing Enum value for Pacing
	 */
	public void setPacingActions(int[] arrPosition, EnumCM_PacingActions enumPacingActions, EnumCM_Pacing enumPacing)
	{
		/**
		 * Sets the value for OrganizationalRoles which follows the template CID7452
		 */
		if(null== this.objPacingActions_CID3552)
			this.objPacingActions_CID3552 = new PacingActions_CID3552();
		this.objPacingActions_CID3552.setPacingActions(enumPacingActions);

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

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		if(null== this.objPacing_CID3555)
			this.objPacing_CID3555 = new Pacing_CID3555();
		this.objPacing_CID3555.setPacing(enumPacing);

		String strCodeMeaning = objPacing_CID3555.getCodeMeaning();
		String strCodeValue = objPacing_CID3555.getCodeValue();
		String strCSD2 = objPacing_CID3555.getCodingSchemeDesignator();
		String strSNMDCTID = objPacing_CID3555.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 , strCSD2, strCV, strCSD1, "", strCM,strSNMDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}
}
