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

import java.io.IOException;

import cdac.medinfo.sdk.hl7282.commoninterface.IHL7Stream;
import cdac.medinfo.sdk.hl7282.exceptions.BatchException;
import cdac.medinfo.sdk.hl7282.exceptions.ParseException;
import cdac.medinfo.sdk.hl7282.exceptions.SerializeException;


/**
 * The implementor of this interface should provide Parse, Validate and Serialize method.<br> 
 * This interface should be implemented by classes whose instances should be processed as Batch or Batch file.
 */
public interface IBatch 
{
	/**
	 * Parses HL7 Batch  Strings from any Stream into HL7 Batch objects.
	 * @param objIHL7Stream 
	 * @return the int - Success/Failure
	 * @throws ParseException the parse exception
	 * @throws IOException Signals that an I/O exception has occurred.
	 */
	public int parse(IHL7Stream objIHL7Stream) throws ParseException, IOException;
	
	/**
	 * Validates HL7 Batch objects.
	 * @return true - if successful
	 * 		   false - otherwise
	 * @throws BatchException Thrown when Batch validation fails.
	 */
	public boolean validate()throws BatchException ;// should throw InvalidBatchException Actually

	/**
	 * Serializes HL7 Batch objects.
	 * @param objIHL7Stream Specified IHL7Stream to be serialized
	 * @return the int - Success/Failure
	 * @throws SerializeException the serialize exception
	 * @throws IOException Signals that an I/O exception has occurred.
	 */
	public int serialize(IHL7Stream objIHL7Stream) throws SerializeException,IOException;
}
