package cdac.medinfo.sdk.hl7282.hl7model.messages.personnelmanagement;

import cdac.medinfo.sdk.hl7282.baselibs.messages.AbstractQuery;
import cdac.medinfo.sdk.hl7282.baselibs.segments.DSC;
import cdac.medinfo.sdk.hl7282.baselibs.segments.QPD;
import cdac.medinfo.sdk.hl7282.baselibs.segments.RCP;
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;

/**
 * QBP_Q25 - Query Information (QBP) (Events Q25)..
 *  Another application determines a need for Personnel data about a person and 
 *  sends a query to a system providing this information.  
 * <p>Represents a QBP_Q21 message structure (see chapter 3.2.56). 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) <b>SINGLE OPTIONAL</b><br/>
 * 3: QPD (Query Parameter Definition) <b>SINGLE_COMPULSARY</b><br>
 * 4: RCP (Response Control Parameter) <b>SINGLE_COMPULSARY</b><br>
 * 5: 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.
 */
public final class QBP_Q25 extends AbstractQuery
{
	/**
	 * Constructs the QBP_Q21 message.
	 */
	QBP_Q25(IMap objMessageMap)
	{
		super(objMessageMap, EnumMessageCode.QBP.getValue(), EnumTriggerEvent.Q25.getValue(), EnumMessageStructure.QBP_Q21.getValue());
	}
	
	/**
	 * Veifies whether message is Query.
	 * @return boolean
	 */
	public boolean isQuery()
	{
		return true;
	}

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


	/**
	 * Adds 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 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;
	}

	/**
	 * Retrieves User Authentication Credential(UAC) segment present in this message
	 * @return UAC - Specified UAC Segment
	 */
	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 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 Query Parameter Definition(QPD) Segment present in this message
	 * @return QPD - Query Parameter Definition Segment
	 */
	public QPD getQueryParameterDefinitionSegment()
	{
		ISingleCollection<ISegment> objSingleCollection = getSegment(EnumSegments.HL7_SEG_QPD);
		if(objSingleCollection != null)
			return (QPD)objSingleCollection.elementAt(0);
		return null;
	}
	/**
	 * Set the value of Query Parameter Definition Segment for this message,overwrites if already present.
	 * @param objQPD Specified Query Parameter Definition Segment
	 */
	public void setQueryParameterDefinitionSegment(QPD objQPD)
	{
		setSegment(EnumSegments.HL7_SEG_QPD,objQPD);
	}

	/**
	 * Retrieves the Response Control Parameters(RCP) Segment present in this message
	 * @return RCP - Response Control Parameters Segment
	 */
	public RCP getResponseControlParametersSegment()
	{
		ISingleCollection<ISegment> objSingleCollection = getSegment(EnumSegments.HL7_SEG_RCP);
		if(objSingleCollection != null)
			return (RCP)objSingleCollection.elementAt(0);
		return null;
	}
	/**
	 * Set the value of Response Control Parameters Segment for this message,overwrites if already present.
	 * @param objRCP Specified Response Control Parameters Segment
	 */
	public void setResponseControlParametersSegment(RCP objRCP)
	{
		setSegment(EnumSegments.HL7_SEG_RCP,objRCP);
	}

	/**
	 * Retrieves the Continuation Pointer(DSC) Segment present in this message
	 * @return DSC - Continuation Pointer Segment
	 */
	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);
	}
}
