package in.cdac.medinfo.csnotk.csnolib.disb.api;

import java.io.Serializable;

import in.cdac.medinfo.csnotk.csnolib.disb.model.GenericDrug;
import in.cdac.medinfo.csnotk.csnolib.disb.model.MedicineDetail;
import in.cdac.medinfo.csnotk.csnolib.disb.model.SubstanceDetail;


/**
 * Library interface for application. It provides the basic methods to 
 * query the DISB for retrieving JSON for known concept identifiers.
 * 
 * @see SubstanceDetail
 * @see MedicineDetail
 * @see GenericDrug
 */
public interface IDISBAgent extends Serializable{

	/**
	 * Retrives data from DISB
	 * @param conceptId SNOMED CT concept identifier for Substance
	 * @return JSON string of {@link SubstanceDetail} model
	 * @throws IllegalArgumentException if invalid concept id is  passed
	 */
	public String getSubstanceDetail(String conceptId)throws IllegalArgumentException;
	
	/**
	 * Retrives data from DISB
	 * @param conceptId SNOMED CT concept identifier for Substance
	 * @return {@link SubstanceDetail} model
	 * @throws IllegalArgumentException if invalid concept id is  passed
	 */
	public SubstanceDetail getSubstanceDetailObj(String conceptId)throws IllegalArgumentException;
	
	/**
	 * Retrives data from DISB
	 * @param conceptId SNOMED CT concept identifier for Substance
	 * @return JSON string of {@link MedicineDetail} model
	 * @throws IllegalArgumentException if invalid concept id is  passed
	 */
	public String getMedicineDetail(String conceptId)throws IllegalArgumentException;
	
	/**
	 * Retrives data from DISB
	 * @param conceptId SNOMED CT concept identifier for Medicine
	 * @return {@link MedicineDetail} model
	 * @throws IllegalArgumentException if invalid concept id is  passed
	 */
	public MedicineDetail getMedicineDetailObj(String conceptId)throws IllegalArgumentException;
	
	/**
	 * Retrives data from DISB
	 * @param conceptId SNOMED CT concept identifier for Generic
	 * @return JSON string of {@link GenericDrug} model
	 * @throws IllegalArgumentException if invalid concept id is  passed
	 */
	public String getGenericDetail(String conceptId)throws IllegalArgumentException;
	
	/**
	 * Retrives data from DISB
	 * @param conceptId SNOMED CT concept identifier for Generic
	 * @return {@link GenericDrug} model
	 * @throws IllegalArgumentException if invalid concept id is  passed
	 */
	public GenericDrug getGenericDetailObj(String conceptId)throws IllegalArgumentException;
	
	/**
	 * The method will configure the properties to default values.<br>
	 * Protocol for sending request to DISB (default protocol: http).<br> 
	 * Hostname for remote application DISB (default hostname: localhost).<br>
	 * Port for accessing on port to DISB (default port: 9090).<br>
	 * Context for requesting to DISB (default context: dis).<br>
	 * Location for logs. (default errorLogDir: user directory).<br>
	 * */	
	public void init();
	
	/**
	 * The method will configure properties by values provided in parameters
	 * @param protocol for sending request to DISB (default: http) 
	 * @param hostname for remote application DISB (default: localhost)
	 * @param port for accessing on port to DISB (default: 9090)
	 * @param context for requesting to DISB (default: dis)
	 * @param errorLogDir location for logs.
	 */
	public void init(String protocol, String hostname, Integer port ,String context,String errorLogDir);
	
	/**
	 * For testing connnection with DISB on entered init properties.
	 * If init() is being used then it will use default properties for DISB.
	 * @throws IllegalArgumentException
	 */
	public void testDISBConnection()throws IllegalArgumentException;
		
	
}
