/*******************************************************************************
 *  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.ArterialLesionLocations_CID3604;
import cdac.medinfo.sdk.dcm30_04.templates.cid.CardiovascularAnatomicLocationModifiers_CID3019;
import cdac.medinfo.sdk.dcm30_04.templates.cid.DiagnosticImagingReportPurposesOfReference_CID7003;
import cdac.medinfo.sdk.dcm30_04.templates.cid.InterventionActionsAndStatus_CID3412;
import cdac.medinfo.sdk.dcm30_04.templates.cid.InterventionParameters_CID3425;
import cdac.medinfo.sdk.dcm30_04.templates.cid.IntracoronaryDevices_CID3411;
import cdac.medinfo.sdk.dcm30_04.templates.cid.YesNo_CID230;
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_DiagnosticImagingReportPurposesOfReference;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_Intervention;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_InterventionActionsAndStatus;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_InterventionParameters;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_IntracoronaryDevices;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_YesNo;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_Intervention;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.Template;

/**
 * The Intervention Template allows recording of interventions, including atherectomy, angioplasty, stent
 * placement, brachytherapy, etc. The record may include reference to an image that documents the
 * intervention.
 */
/**
 * This class represents Intervention - TID3108
 */
public class Intervention_TID3108 extends Template
{
	/**
	 * Object of InterventionActionsAndStatus_CID3412
	 */
	private InterventionActionsAndStatus_CID3412 objInterventionActionsAndStatus_CID3412;

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

	/**
	 * Object of CardiovascularAnatomicLocationModifiers_CID3019
	 */
	private CardiovascularAnatomicLocationModifiers_CID3019 objCardiovascularAnatomicLocationModifiers_CID3019;

	/**
	 * Object of IntracoronaryDevices_CID3411
	 */
	private IntracoronaryDevices_CID3411 objIntracoronaryDevices_CID3411;

	/**
	 * Object of YesNo_CID230
	 */
	private YesNo_CID230 objYesNo_CID230;

	/**
	 * Object of InterventionParameters_CID3425
	 */
	private InterventionParameters_CID3425 objInterventionParameters_CID3425;

	/**
	 * Object of DiagnosticImagingReportPurposesOfReference_CID7003
	 */
	private DiagnosticImagingReportPurposesOfReference_CID7003 objDiagnosticImagingReportPurposesOfReference_CID7003;

	/**
	 * Object of LogEntryQualifiers_TID3010
	 */
	private LogEntryQualifiers_TID3010 objLogEntryQualifiers;


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

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

	/**
	 * Sets the value for Intervention Action.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumInterventionActionsAndStatus value for InterventionActionsAndStatus
	 */
	public void setInterventionAction(int[] arrPosition, EnumCM_InterventionActionsAndStatus enumInterventionActionsAndStatus)
	{
		/**
		 * Sets the value for InterventionActionsAndStatus.
		 */
		if(objInterventionActionsAndStatus_CID3412 == null)
			this.objInterventionActionsAndStatus_CID3412 = new InterventionActionsAndStatus_CID3412();
		this.objInterventionActionsAndStatus_CID3412.setInterventionActionsAndStatus(enumInterventionActionsAndStatus);

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

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_Intervention.INTERVENTION_ACTION.getValue();
		String strCodeValue = EnumCV_Intervention.INTERVENTION_ACTION_122090.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);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Procedure site.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumValue value for one of the enums - EnumCM_ArterialSourceLocations, EnumCM_CoronaryArteries
	 * or EnumCM_CoronaryArterySegments
	 */
	public void setProcedureSite(int[] arrPosition, Enum enumValue)
	{
		/**
		 * Setting value for Arterial Lesion Location
		 */
		if(objArterialLesionLocations_CID3604 == null)
			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();
		String strSNOMEDCTID = objArterialLesionLocations_CID3604.getSNOMEDCTID();

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_Intervention.PRICEDURE_SITE.getValue();
		String strCodeValue = EnumCV_Intervention.PRICEDURE_SITE_G_C0E9.getValue();
		String strCSDesg = 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, strCSDesg, strCV, strCSD, strCSV, strCM,strSNOMEDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets value for Topographical modifier.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumCardiovascularAnatomicLocationModifiers Enum of EnumCM_CardiovascularAnatomicLocationModifiers
	 */
	public void setTopographicalModifier(int[] arrPosition, EnumCM_CardiovascularAnatomicLocationModifiers enumCardiovascularAnatomicLocationModifiers)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_Intervention.TOPOGRAPHICAL_MODIFIER.getValue();
		String strCodeValue = EnumCV_Intervention.TOPOGRAPHICAL_MODIFIERS_G_A1F8.getValue();
		String strCSDesg = EnumCodingSchemeDesignator.SRT.getValue();

		/**
		 * Setting value for Cardiovascular Anatomic Location Modifiers
		 */
		if(objCardiovascularAnatomicLocationModifiers_CID3019 == null)
			objCardiovascularAnatomicLocationModifiers_CID3019 = new CardiovascularAnatomicLocationModifiers_CID3019();
		objCardiovascularAnatomicLocationModifiers_CID3019.setCardiovascularAnatomicLocationModifiers(enumCardiovascularAnatomicLocationModifiers);

		String strCM = objCardiovascularAnatomicLocationModifiers_CID3019.getCodeMeaning();
		String strCV = objCardiovascularAnatomicLocationModifiers_CID3019.getCodeValue();
		String strCSD = objCardiovascularAnatomicLocationModifiers_CID3019.getCodingSchemeDesignator();
		String strSNOMEDCTID = objCardiovascularAnatomicLocationModifiers_CID3019.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 the value for Intervention attempt identifier
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strInterventionAttemptIdentifier String value for Intervention attempt identifier.
	 */
	public void setInterventionAttemptIdentifier(int[] arrPosition, String strInterventionAttemptIdentifier)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_Intervention.INTERVENTION_ATTEMPT_IDENTIFIER.getValue();
		String strCodeValue = EnumCV_Intervention.INTERVENTION_ATTEMPT_IDENTIFIER_121154.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, strInterventionAttemptIdentifier);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Uses Equipment.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumIntracoronaryDevices value for IntracoronaryDevices
	 */
	public void setUsesEquipment(int[] arrPosition, EnumCM_IntracoronaryDevices enumIntracoronaryDevices)
	{
		/**
		 * Sets the value for InterventionActionsAndStatus.
		 */
		if(objIntracoronaryDevices_CID3411 == null)
			this.objIntracoronaryDevices_CID3411 = new IntracoronaryDevices_CID3411();
		this.objIntracoronaryDevices_CID3411.setIntracoronaryDevices(enumIntracoronaryDevices);

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

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

	/**
	 * Sets the value for Primary Intervention Device.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumIntracoronaryDevices value for IntracoronaryDevices
	 */
	public void setPrimaryInterventionDevice(int[] arrPosition, EnumCM_YesNo enumYesNo)
	{
		/**
		 * Sets the value for InterventionActionsAndStatus.
		 */
		if(objYesNo_CID230 == null)
			this.objYesNo_CID230 = new YesNo_CID230();
		this.objYesNo_CID230.setYesNo(enumYesNo);

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

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_Intervention.PRIMARY_INTERVENTION_DEVICE.getValue();
		String strCodeValue = EnumCV_Intervention.PRIMARY_INTERVENTION_DEVICE_122111.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 Intervention Parameters.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumInterventionParameters Value for EnumCM_InterventionParameters
	 * @param arrNumericValue String array for Quatity Of Material
	 */
	public void setInterventionParameters(int[] arrPosition,EnumCM_InterventionParameters enumInterventionParameters, String[] arrNumericValue)
	{
		if(objInterventionParameters_CID3425 == null)
			this.objInterventionParameters_CID3425 = new InterventionParameters_CID3425();
		this.objInterventionParameters_CID3425.setInterventionParameters(enumInterventionParameters);

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = objInterventionParameters_CID3425.getCodeMeaning();
		String strCodeValue = objInterventionParameters_CID3425.getCodeValue();
		String strCSD = objInterventionParameters_CID3425.getCodingSchemeDesignator();
		String strSNOMEDCTID = objInterventionParameters_CID3425.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,"","","","","","","","",strSNOMEDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets value for Diagnostic Imaging Report Purposes of Reference
	 * @param arrPosition dentifier which shows the position of the node in the SR Tree.
	 * @param enumDiagnosticImagingReportPurposesOfReference Enum value for DiagnosticImagingReportPurposesOfReference
	 *@param strRefSOPClassUIDForCORefMacro Reference SOP Class UID for Composite Object Reference Macro.
	 * @param strRefSOPInstanceUIDForCORefMacro Reference SOP Instance UID for Composite Object Reference Macro.
	 * @param arrStrReferencedFrameNumber String Array of Referenced Frame Number.
	 * @param strRefSOPClassUID Referenced SOP Class UID.
	 * @param strRefSOPInstanceUID Referenced SOP Instance UID.
	 */
	public void setDiagnosticImagingReportPurposesOfReference(int[] arrPosition, EnumCM_DiagnosticImagingReportPurposesOfReference enumDiagnosticImagingReportPurposesOfReference, String strRefSOPClassUIDForCORefMacro, String strRefSOPInstanceUIDForCORefMacro, String[] arrStrReferencedFrameNumber, String strRefSOPClassUID, String strRefSOPInstanceUID)
	{
		if(objDiagnosticImagingReportPurposesOfReference_CID7003 == null)
			this.objDiagnosticImagingReportPurposesOfReference_CID7003 = new DiagnosticImagingReportPurposesOfReference_CID7003();
		this.objDiagnosticImagingReportPurposesOfReference_CID7003.setDiagnosticImagingReportPurposesOfReference(enumDiagnosticImagingReportPurposesOfReference);

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

		/**
		 * Creating a node of Value Type UIDREF and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createImageNode(arrPosition, strCodeMeaning, strCodeValue, strCSD, strRefSOPClassUIDForCORefMacro, strRefSOPInstanceUIDForCORefMacro, arrStrReferencedFrameNumber, strRefSOPClassUID, strRefSOPInstanceUID);
		getSRTree().addChild(objContentSequenceItem);
	}
}
