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

import java.io.IOException;

import cdac.medinfo.sdk.hl7282.baselibs.messages.MessageFactory;
import cdac.medinfo.sdk.hl7282.commoninterface.ISegmentSet;



/**
 * The IBatchProcessor interface should be implemented by any class 
 * whose instances are intended to process Batches. 
 * The class must define the processReceive and processSend 
 * methods to parse and serialize Batches.
 */
public interface IBatchProcessor 
{
	
	/**
	 * Retrieves populated HL7BatchFile through given SegmentSet.
	 * @param objMessageFactory instance of MessageFactory
	 * @param objSegmentSet instance of SegmentSet
	 * @return IHL7BatchFile - instance of HL7BatchFile 
	 * @throws IOException Signals that an I/O exception has occurred.
	 */
	IHL7BatchFile processReceive(MessageFactory objMessageFactory,ISegmentSet objSegmentSet);
	
	/**
	 * Retrieves SegmentSet generated through provided HL7BatchFile.
	 * @param objHL7BatchFile instance of HL7BatchFile
	 * @return ISegmentSet - instance of ISegmentSet
	 */
	ISegmentSet processSend(IHL7BatchFile objHL7BatchFile);
	
	/**
	 * Creates HL7BatchFile and populate it through provided SegmentSet.
	 * It processes messages which are supported for sending through provided Message factory. 
	 * @param objMessageFactory instance of Message factory
	 * @param objSegmentSet instance of SegmentSet
	 * @return IHL7BatchFile - instance of HL7BatchFile
	 */
	IHL7BatchFile createBatchFile(MessageFactory objMessageFactory,ISegmentSet objSegmentSet);
	
	/**
	 * Populates HL7BatchFile through provided SegmentSet.
	 * It processes messages which are supported for receiving through provided Message factory. 
	 * @param objMessageFactory instance of Message factory
	 * @param objSegmentSet instance of SegmentSet
	 * @return IHL7BatchFile - instance of HL7BatchFile
	 */
	IHL7BatchFile populateBatchFile(MessageFactory objMessageFactory,ISegmentSet objSegmentSet);
	
	/**
	 * Populates SegemntSet through provided HL7BatchFile.
	 * @param objHL7BatchFile instance of HL7BatchFile
	 * @return SegmentSet - instance of SegmentSet
	 */
	ISegmentSet getSegmentSet(IHL7BatchFile objHL7BatchFile);
	
	/**
	 * Populates SegemntSet through provided HL7Batch.
	 * @param objHL7Batch instance of HL7Batch
	 * @return SegmentSet - instance of SegmentSet
	 */
	ISegmentSet getSegmentSet(IHL7Batch objHL7Batch);
	
	IHL7Batch createBatch(MessageFactory objMessageFactory, ISegmentSet objSegmentSet);
	
	IHL7Batch populateBatch(MessageFactory objMessageFactory,ISegmentSet objSegmentSet);
}