/*******************************************************************************
 *  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.hl7model.messages.query;

import cdac.medinfo.sdk.hl7282.baselibs.messages.AbstractQuery;
import cdac.medinfo.sdk.hl7282.baselibs.messages.Message;
import cdac.medinfo.sdk.hl7282.baselibs.segments.DSC;
import cdac.medinfo.sdk.hl7282.baselibs.segments.DSP;
import cdac.medinfo.sdk.hl7282.baselibs.segments.SFT;
import cdac.medinfo.sdk.hl7282.baselibs.segments.UAC;
import cdac.medinfo.sdk.hl7282.commoninterface.ISegment;
import cdac.medinfo.sdk.hl7282.commoninterface.ISingleCollection;
import cdac.medinfo.sdk.hl7282.utils.EnumMessageCode;
import cdac.medinfo.sdk.hl7282.utils.EnumMessageStructure;
import cdac.medinfo.sdk.hl7282.utils.EnumSegments;
import cdac.medinfo.sdk.hl7282.utils.EnumTriggerEvent;
import cdac.medinfo.sdk.hl7282.utils.IMap;
/**
 * UDM_Q05 - Unsolicited Display Message (Event Q05).
 * <p>This structure contains the following elements: </p>
 * 0: MSH (Message Header) <b>SINGLE_COMPULSARY</b><br>
 * 1: SFT (Software Segment) <b>MULTIPLE_OPTIONAL</b><br>
 * 2: UAC (User Authentication Credential segment) <b>SINGLE_OPTIONAL</b><br> 
 * 3: URD (Results/Update Definition) <b>SINGLE_COMPULSARY</b><br>
 * 4: URS (Results/Update Selection Criteria) <b>SINGLE_OPTIONAL</b><br>
 * 5: DSP (Disply Data)<b>MULTIPLE_COMPULSARY</b><br>
 * 6: DSC (Continuation Pointer) <b>SINGLE_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.
 * These elements can be easily populated & populated values can be easily retrieved.
 * The class has validate method which validates Message against HL7 v 2.8.2 standard.
 *
 * <p>Following is the step to create message<br>
 * Before that, respective Message Source and Message Recipient to be set on Message Factory.</p>
 * <p>UDM_Q05 objQ05 = (UDM_Q05)MessageFactory.createInstance().createSendSupportedMessage("UDM", "Q05");</p>
 */
public  final class UDM_Q05 extends Message
{

	/**
	 * Constructs the UDM_Q05 message.
	 */
	UDM_Q05(IMap objMessageMap) 
	{
		super(objMessageMap, EnumMessageCode.UDM.getValue(), EnumTriggerEvent.Q05.getValue(), EnumMessageStructure.UDM_Q05.getValue());
	}
	
	
	/**
	 * Retrieves the Collection of Software Segments(SFT) present in this message.
	 * @return ISingleCollection<SFT> - Collection of Software Segments(SFT) present in this message.
	 */
	@SuppressWarnings("unchecked")
	public ISingleCollection<SFT> getSoftwareSegments()
	{
		ISingleCollection<?> objSegmentCollection = getSegment(EnumSegments.HL7_SEG_SFT);
		return (ISingleCollection<SFT>)objSegmentCollection;
	}

	/**
	 * Adds the Software Segment(SFT) to this message.
	 * @param objSFT Specified Software Segment(SFT) to be added in this messageto this message.
	 */
	public void addSoftwareSegment(SFT objSFT)
	{
		addSegment(EnumSegments.HL7_SEG_SFT, objSFT);
	}

	/**
	 * Adds the collection of Software Segment(SFT) to this message.
	 * @param objSFTSegmentCollection Collection of Software Segments to add in this message
	 */
	@SuppressWarnings("unchecked")
	public void addSoftwareSegment(ISingleCollection<SFT>  objSFTSegmentCollection)
	{
		ISingleCollection<?> objSegmentCollection =  objSFTSegmentCollection;
		addSegment(EnumSegments.HL7_SEG_SFT, (ISingleCollection<ISegment>)objSegmentCollection);
	}
	
	/**
	 * Retrieves User Authentication Credential(UAC) segment present in this message
	 * @return UAC - the User Authentication Credential Segment present in this message or null if unavailable. 
	 */
	public UAC getUserAuthenticationCredentialSegment()
	{
		ISingleCollection<ISegment> objSingleCollection = getSegment(EnumSegments.HL7_SEG_UAC);
		if(objSingleCollection != null)
			return (UAC)objSingleCollection.elementAt(0);
		return null;
	}
	
	/**
	 * Sets value of User Authentication Credential(UAC) segment  for this message, overwrites if already present.
	 * @param objUAC Specified UAC Segment
	 */
	public void setUserAuthenticationCredentialSegment(UAC objUAC)
	{
		setSegment(EnumSegments.HL7_SEG_UAC,objUAC);
	}
	
//	/**
//	 * Retrieves the Results/Update Definition (URD)Segment present in this message
//	 * @return URD - the Results/Update Definition Segment present in this message or null if unavailable.
//	 */
//	public URD getResultsUpdateDefinitionSegment()
//	{
//		ISingleCollection<ISegment> objSingleCollection = getSegment(EnumSegments.HL7_SEG_URD);
//		if(objSingleCollection != null)
//			return (URD)objSingleCollection.elementAt(0);
//		return null;
//	}
//
//	/**
//	 * Set the value of Results/Update Definition (URD)Segment for this message,overwrites if already present.
//	 * @param objURD Specified  Results/Update Definition Segment 
//	 */
//	public void setResultsUpdateDefinitionSegment(URD objURD)
//	{
//		setSegment(EnumSegments.HL7_SEG_URD,objURD);
//	}
//	/**
//	 * Retrieves the Results/Update Selection Criteria(URS) Segment present in this message
//	 * @return URS - the Continuation Pointer Segment present in this message or null if unavailable.
//	 */
//	public URS getResultsUpdateSelectionCriteriaSegment()
//	{
//		ISingleCollection<ISegment> objSingleCollection = getSegment(EnumSegments.HL7_SEG_URS);
//		if(objSingleCollection != null)
//			return (URS)objSingleCollection.elementAt(0);
//		return null;
//	}
//
//	/**
//	 * Set the value of Results/Update Selection Criteria(URS)Segment for this message,overwrites if already present.
//	 * @param objURS Specified  Virtual Table Query Definition Segment 
//	 */
//	public void setResultsUpdateSelectionCriteriaSegment(URS objURS)
//	{
//		setSegment(EnumSegments.HL7_SEG_URS,objURS);
//	}
	/**
	 * Retrieves the Display Data(DSP) Segment present in this message
	 * @return DSP - the Disaplay Data Segment present in this message or null if unavailable.
	 */
	public DSP getDisplayDataSegment()
	{
		ISingleCollection<ISegment> objSingleCollection = getSegment(EnumSegments.HL7_SEG_DSP);
		if(objSingleCollection != null)
			return (DSP)objSingleCollection.elementAt(0);
		return null;
	}

	/**
	 * Adds the Display Data(DSP) to this message.
	 * @param objDSP Specified Display Data Segment(DSP)to this message. 
	 */
	public void addDisplayDataSegment(DSP objDSP)
	{
		addSegment(EnumSegments.HL7_SEG_DSP, objDSP);
	}

	/**
	 * Adds the collection of Display Data Segment(DSP) to this message.
	 * @param objDSPSegmentCollection Collection of Display Data Segments to add in this message
	 */
	@SuppressWarnings("unchecked")
	public void addDisplayDataSegments(ISingleCollection<DSP>  objDSPSegmentCollection)
	{
		ISingleCollection<?> objSegmentCollection =  objDSPSegmentCollection;
		addSegment(EnumSegments.HL7_SEG_DSP, (ISingleCollection<ISegment>)objSegmentCollection);
	}
	/**
	 * Retrieves the Continuation Pointer(DSC) Segment present in this message
	 * @return DSC - the Continuation Pointer Segment present in this message or null if unavailable.
	 */
	public DSC getContinuationPointerSegment()
	{
		ISingleCollection<ISegment> objSingleCollection = getSegment(EnumSegments.HL7_SEG_DSC);
		if(objSingleCollection != null)
			return (DSC)objSingleCollection.elementAt(0);
		return null;
	}

	/**
	 * Set the value of Continuation Pointer Segment for this message,overwrites if already present.
	 * @param objDSC Specified Continuation Pointer Segment 
	 */
	public void setContinuationPointerSegment(DSC objDSC)
	{
		setSegment(EnumSegments.HL7_SEG_DSC,objDSC);
	}
}

