/*******************************************************************************
 *  Copyright 2017 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.hl7282.baselibs.segments;

import cdac.medinfo.sdk.hl7282.baselibs.CQ;
import cdac.medinfo.sdk.hl7282.baselibs.CWE;
import cdac.medinfo.sdk.hl7282.baselibs.ID;
import cdac.medinfo.sdk.hl7282.baselibs.SI;
import cdac.medinfo.sdk.hl7282.commoninterface.IDataType;
import cdac.medinfo.sdk.hl7282.commoninterface.ISingleCollection;
import cdac.medinfo.sdk.hl7282.utils.EnumSegments;

/**
 * CDO - Cumulative Dosage Segment.
 * The Cumulative Dosage segment allows for the communication of cumulative dosage limits that administrations against this medication order should stay within.  
 * As part of one of the pharmacy messages, one may want to indicate one or more limits that apply, 
 * e.g., limit for the duration of the order, lifetime limit, or weekly limit.<p>
 * <p>Represents an HL7 CDO message segment. 
 * This segment has the following fields:</p><p>
 * CDO-1: Set ID - CDO (SI)<b>Optional</b><br> 
 * CDO-2: Action Code (ID)<b>Optional</b><br> 
 * CDO-3: Cumulative Dosage Limit (CQ)<b>Optional</b><br> 
 * CDO-4: Cumulative Dosage Limit Time Interval (CQ)<b>Optional</b><br> 
 * This class provides mechanism to validate message against HL7 v 2.8.2 standard.
 * The class provides accessors & mutators for the elements mentioned above.
 * The class has validate method which validates Message against HL7 v 2.8.2 standard.
 *
 * <p>User can also create Segment through {@link SegmentFactory}
 */
public class CDO extends Segment   
{
	

	/**
	 * Constructs the ABS segment.
	 */
	public CDO()
	{super(EnumSegments.HL7_SEG_CDO);
	}
	
	/**
	 * Retrieves the Set ID CDO.
	 * For the first cumulative dose specification transmitted, the sequence number shall be 1; for the second cumulative dose, 
	 * it shall be 2; and so on.
	 * @return String - setID_CDO
	 */
	public SI getSetID_CDO() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3430);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SI)objDataCollection.elementAt(0);
		else
			return null;
	}
	/**`
	 * Set the Set ID CDO.
	 * For the first cumulative dose specification transmitted, the sequence number shall be 1; for the second cumulative dose, 
	 * it shall be 2; and so on.
	 * @param strSetID_CDO This field contains the number that identifies CDO transaction. 
	 */	
	public void setSetID_CDO(String strSetID_CDO)
	{
		SI setID_CDO  = (SI)getDataElement(3430);
		setID_CDO.setValue(strSetID_CDO); 
		setSetID_CDO(setID_CDO);
	}

	/**
	 * Set the Set ID CDO.
	 * For the first cumulative dose specification transmitted, the sequence number shall be 1; for the second cumulative dose, 
	 * it shall be 2; and so on.
	 * @param objSetID_CDO Object of Set ID CDO.
	 */
	public void setSetID_CDO(SI objSetID_CDO)
	{
		setDataType(3430,objSetID_CDO);
	}
	
	/**
	 * Retrieves the Action Code.
	 * The Action Code indicates whether the cumulative dosage segment is intended to be added, deleted, updated, or did not change.      
	 * @return ID - ActionCode indicates whether the cumulative dosage segment is intended to be added, deleted, updated, or did not change. 
	 */
	public ID getActionCode() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(816);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Action Code.
	 * The Action Code indicates whether the cumulative dosage segment is intended to be added, deleted, updated, or did not change.      
	 * @param strActionCode This field identifies indicates whether the cumulative dosage segment is intended to be added, deleted, updated, or did not change. 
	 * 
	 */ 
	public void setActionCode (String strActionCode) 
	{
		ID ActionCode  = (ID)getDataElement(816);
		ActionCode.setValue(strActionCode); 
		setActionCode(ActionCode);

	}
	
	/** Set the Action Code.
	 * The Action Code indicates whether the cumulative dosage segment is intended to be added, deleted, updated, or did not change.      
	 * @param objActionCode This field indicates whether the cumulative dosage segment is intended to be added, deleted, updated, or did not change.
	 * 
	 */ 
	public void setActionCode(ID objActionCode)
	{
		setDataType(816,objActionCode);
	}
	
	/**
	 * Retrieves the Cumulative Dosage Limit.
	 * The Cumulative Dosage indicates the total dosage that may be administered within the scope of this order 
	 * or within the interval indicated in CDO-4 Cumulative Dosage Time Interval, if supplied
	 * @return CQ - Cumulative Dosage Limit
	 */
	public CQ getCumulativeDosageLimit() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3397);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CQ)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Cumulative Dosage Limit.
	 * The Cumulative Dosage indicates the total dosage that may be administered within the scope of this order 
	 * or within the interval indicated in CDO-4 Cumulative Dosage Time Interval, if supplied
	 * @param strQuantity Specifies the numeric quantity or amount of an entity.
	 * @param objUnits Specifies the units in which the quantity is expressed. 
	 */ 
	public void setCumulativeDosageLimit (String strQuantity,CWE objUnits) 
	{
		CQ CumulativeDosageLimit  = (CQ)getDataElement(3397);
		CumulativeDosageLimit.setQuantity(strQuantity);
		CumulativeDosageLimit.setUnits(objUnits); 
		setCumulativeDosageLimit(CumulativeDosageLimit);

	} 

	/** 
	 * Set the Cumulative Dosage Limit.
	 * The Cumulative Dosage indicates the total dosage that may be administered within the scope of this order 
	 * or within the interval indicated in CDO-4 Cumulative Dosage Time Interval, if supplied
	 * @param objCumulativeDosageLimit Object of Cumulative Dosage Limit.  
	 */ 
	public void setCumulativeDosageLimit(CQ objCumulativeDosageLimit)
	{
		setDataType(3397,objCumulativeDosageLimit);
	}

	/**
	 * Retrieves the Cumulative Dosage Limit Time Interval.
	 * The Cumulative Dosage Time Interval indicates the interval over which the cumulative dosage in CDO-3 
	 * Cumulative Dosage Limit is measured.  If this field is not valued, the Cumulative Dosage Limit applies to 
	 * the scope of the order.
	 * @return CQ - Cumulative Dosage Limit Time Interval
	 */
	public CQ getCumulativeDosageLimitTimeInterval() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3398);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CQ)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Cumulative Dosage Limit Time Interval.
	 * The Cumulative Dosage Time Interval indicates the interval over which the cumulative dosage in CDO-3 
	 * Cumulative Dosage Limit is measured.  If this field is not valued, the Cumulative Dosage Limit applies to 
	 * the scope of the order.
	 * @param strQuantity Specifies the numeric quantity or amount of an entity.
	 * @param objUnits Specifies the units in which the quantity is expressed. 
	 */ 
	public void setCumulativeDosageLimitTimeInterval (String strQuantity,CWE objUnits) 
	{
		CQ CumulativeDosageLimitTimeInterval  = (CQ)getDataElement(3398);
		CumulativeDosageLimitTimeInterval.setQuantity(strQuantity);
		CumulativeDosageLimitTimeInterval.setUnits(objUnits); 
		setCumulativeDosageLimitTimeInterval(CumulativeDosageLimitTimeInterval);

	} 

	/** 
	 * Set the Cumulative Dosage Limit Time Interval.
	 * The Cumulative Dosage Time Interval indicates the interval over which the cumulative dosage in CDO-3 
	 * Cumulative Dosage Limit is measured.  If this field is not valued, the Cumulative Dosage Limit applies to 
	 * the scope of the order.
	 * @param objCumulativeDosageLimitTimeInterval Object of Cumulative Dosage Limit Time Interval.  
	 */ 
	public void setCumulativeDosageLimitTimeInterval(CQ objCumulativeDosageLimitTimeInterval)
	{
		setDataType(3398,objCumulativeDosageLimitTimeInterval);

	}
}
