package cdac.medinfo.sdk.hl7282.hl7net.commons;

import cdac.medinfo.sdk.hl7282.commoninterface.ISegmentSet;
import cdac.medinfo.sdk.hl7282.exceptions.InvalidMessageException;


/**
 * The ISequenceAgent interface should be implemented by any class 
 * whose instances are intended to process HL7 Messages with Sequence Number Protocol.
 */
public interface ISequenceAgent
{
	/**
	 * Sets Queue length.
	 * @param length length of Queue.
	 */
	void setQueueLength(int length);
	
	/**
	 * Sets the initial value in Queue.
	 * @param value initial value of Queue.
	 */
	void setInitialQueueValue(int value);
	
	/**
	 * Start the Sequence numbering
	 * @param flag - boolean true or false.
	 */
	void setStartSequencing(boolean flag);
	
	/**
	 * End the Sequence numbering
	 * @param flag - boolean true or false.
	 */
	void setEndSequencing(boolean flag);
	
	/**
	 * Invoked when system wants to send message.
	 * @param objSegmentSet - Segment set filled with Sequence Number.
	 * @throws InvalidMessageException - Thrown When Message Populated is Invalid.
	 */
	void processSend(ISegmentSet objSegmentSet) throws InvalidMessageException;
	
	/**
	 * Invoked when system receive message.
	 * @param objSegmentSet - Segment set filled with Sequence Number.
	 * @throws InvalidMessageException - Thrown When Message Populated is Invalid.
	 */
	void processReceive(ISegmentSet objSegmentSet) throws InvalidMessageException;
}
