/*******************************************************************************
 *  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.orderentry;

import cdac.medinfo.sdk.hl7282.baselibs.messages.AbstractQuery;
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.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_Z73 - Returns response sorted by Phone Number (Event Z73).
 * This event is use to retrieve all information about phone calls made during a defined
 * interval either in a detailed or an accumulative format. The identifier for the patient must be given.
 * <p>Represents a QBP_Z73 message structure (see chapter 4.6.2).  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: QPD (Query Parameter Definition) <b>SINGLE_COMPULSARY</b><br>
 * 3: RCP (Response Control Parameter) <b>SINGLE_COMPULSARY</b><br>
 * This class provides mechanism to validate message against HL7 v 2.5 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.5 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>QBP_Z73 objZ73 = (QBP_Z73)MessageFactory.createInstance().createSendSupportedMessage("QBP", "Z73");</p>
 */
public final class QBP_Z73 extends AbstractQuery 
{
	/**
	 * Constructs the QBP_Z73 Message.
	 */
	QBP_Z73(IMap objMessageMap)
	{
		super(objMessageMap, EnumMessageCode.QBP.getValue(), EnumTriggerEvent.Z73.getValue(), EnumMessageStructure.QBP_Z73.getValue());
	}

	/**
	 * Veifies whether message is Query.
	 * @return boolean
	 */
	public boolean isQuery()
	{
		return true;
	}

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

	/**
	 * Retrives the Query Parameter Definition(QPD) Segment present in this message
	 * @return QPD - the Query Parameter Definition Segment present in this message or null if unavailable.
	 */
	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);
	}

	/**
	 * Retrives the Response Control Parameter(RCP) Segment present in this message
	 * @return RCP - the Response Control Parameter Segment present in this message or null if unavailable.
	 */
	public RCP getResponseControlParameterSegment()
	{
		ISingleCollection<ISegment> objSingleCollection = getSegment(EnumSegments.HL7_SEG_RCP);
		if(objSingleCollection != null)
			return (RCP)objSingleCollection.elementAt(0);
		return null;
	}

	/**
	 * Set the value of Response Control Parameter Segment for this message,overwrites if already present.
	 * @param objRCP Specified Response Control Parameter Segment 
	 */
	public void setResponseControlParameterSegment(RCP objRCP)
	{
		setSegment(EnumSegments.HL7_SEG_RCP,objRCP);
	}
}