/*******************************************************************************
 *  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.ActionsWithConsumables_CID3408;
import cdac.medinfo.sdk.dcm30_04.templates.cid.ConsumablesParameters_CID3426;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ActionsWithConsumables;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_Consumables;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ConsumablesParameters;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_Consumables;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.Template;

/**
 * The Consumables Template allows recording of devices (e.g., catheters or stents), drugs, or contrast
 * agents accessed in a procedure. This content item is directed towards inventory control and billing. The
 * actual clinical use of the particular consumable is recorded using TID 3106 Drugs/Contrast Administered
 * or TID 3107 Device Used.
 * This template allows recording both consumable retrieval from, and return to, inventory or stock, and
 * disposal of used material. The quantity involved in each recorded transaction may be specified.
 */
/**
 * This class represents Consumables - TID3104
 */
public class Consumables_TID3104 extends Template
{
	/**
	 * Object of ActionsWithConsumables_CID3408
	 */
	private ActionsWithConsumables_CID3408 objActionsWithConsumables_CID3408;

	/**
	 * Object of ConsumablesParameters_CID3426
	 */
	private ConsumablesParameters_CID3426 objConsumablesParameters_CID3426;

	/**
	 * Object of LogEntryQualifiers_TID3010
	 */
	private LogEntryQualifiers_TID3010 objLogEntryQualifiers_TID3010;

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

	/**
	 * Retrieves Log Entry Qualifiers
	 * @return objLogEntryQualifiers_TID3010 object of objLogEntryQualifiers_TID3010
	 */
	public LogEntryQualifiers_TID3010 getLogEntryQualifiers_TID3010()
	{
		if(objLogEntryQualifiers_TID3010 == null)
			objLogEntryQualifiers_TID3010 = new LogEntryQualifiers_TID3010(getSRTree());
		return this.objLogEntryQualifiers_TID3010;
	}

	/**
	 * Sets the value for Actions With Consumables.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumActionsWithConsumables value for ActionsWithConsumables
	 * @param strCodingSchemeVersionForCode CodingSchemeVersion 
	 */
	public void setActionsWithConsumables(int[] arrPosition, EnumCM_ActionsWithConsumables enumActionsWithConsumables,String strCodingSchemeVersionForCode)
	{
		/**
		 * Sets the value for Actions With Consumables which follows the template CID3408
		 */
		if(objActionsWithConsumables_CID3408 == null)
			this.objActionsWithConsumables_CID3408 = new ActionsWithConsumables_CID3408();

		this.objActionsWithConsumables_CID3408.setActionsWithConsumables(enumActionsWithConsumables);

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

	/**
	 * Sets the value for Consumables Parameters
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumConsumablesParameters Enum value of Consumables Parameters
	 * @param strValue String value for ConsumablesParameters.
	 */
	public void setConsumablesParameters(int[] arrPosition, EnumCM_ConsumablesParameters enumConsumablesParameters, String strValue)
	{
		if(objConsumablesParameters_CID3426 == null)
			this.objConsumablesParameters_CID3426 = new ConsumablesParameters_CID3426();

		objConsumablesParameters_CID3426.setConsumablesParameters(enumConsumablesParameters);

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

		/**
		 * 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, strValue);

		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Quatity Of Material.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param arrNumericValue String array for Quatity Of Material
	 */
	public void setQuatityOfMaterial(int[] arrPosition,String[] arrNumericValue)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_Consumables.QUALITY_OF_MATERIAL.getValue();
		String strCodeValue = EnumCV_Consumables.QUALITY_OF_MATERIAL_121146.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * 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,"","","","","","","","");
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value BillingCode.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strCodingSchemeVersionForCode CodingSchemeVersion 
	 */
	public void setBillingCode(int[] arrPosition,String strCodingSchemeVersionForCode)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_Consumables.BILLING_CODE.getValue();
		String strCodeValue = EnumCV_Consumables.BILLING_CODE_121147.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, "", "", strCodingSchemeVersionForCode, "");
		getSRTree().addChild(objContentSequenceItem);
	}
}
