package eu.dnetlib.rmi.soap;

import java.util.List;

import javax.jws.WebParam;
import javax.jws.WebService;

import eu.dnetlib.rmi.objects.is.BlackboardMessageContainer;
import eu.dnetlib.rmi.objects.is.DnetDataStructure;
import eu.dnetlib.rmi.objects.is.DnetResourceType;
import eu.dnetlib.rmi.objects.is.DnetService;
import eu.dnetlib.rmi.objects.is.Subscription;
import eu.dnetlib.rmi.soap.exceptions.InformationServiceException;

@WebService(targetNamespace = "http://services.dnetlib.eu/")
public interface InformationService extends BaseService {

	// Resource Type
	boolean addResourceType(@WebParam(name = "type") DnetResourceType type) throws InformationServiceException;

	List<DnetResourceType> listResourceTypes(String kind) throws InformationServiceException;

	// Generic search/update methods
	String findOneSql(@WebParam(name = "sql") String sql) throws InformationServiceException;

	List<String> searchSql(@WebParam(name = "sql") String sql) throws InformationServiceException;

	int updateSql(@WebParam(name = "sql") String sql) throws InformationServiceException;

	// Services
	List<DnetService> listServices() throws InformationServiceException;

	String registerService(@WebParam(name = "service") DnetService service) throws InformationServiceException;

	DnetService getService(@WebParam(name = "id") String id) throws InformationServiceException;

	DnetService getServiceByAddress(@WebParam(name = "address") String address) throws InformationServiceException;

	boolean deleteService(@WebParam(name = "id") String id) throws InformationServiceException;

	boolean isRegisteredService(@WebParam(name = "address") String address) throws InformationServiceException;

	boolean addBlackBoardMessage(@WebParam(name = "serviceId") String serviceId, @WebParam(name = "message") BlackboardMessageContainer message)
			throws InformationServiceException;

	boolean updateBlackBoardMessage(@WebParam(name = "message") BlackboardMessageContainer message) throws InformationServiceException;

	List<BlackboardMessageContainer> listBlackboardMessages() throws InformationServiceException;

	boolean deleteBlackBoardMessage(@WebParam(name = "message") BlackboardMessageContainer message) throws InformationServiceException;

	String addSubscription(@WebParam(name = "subscription") Subscription subcription) throws InformationServiceException;

	boolean deleteSubscription(@WebParam(name = "subscriptionId") String subscriptionId) throws InformationServiceException;

	boolean deleteAllServiceSubscriptions(@WebParam(name = "serviceId") String serviceId);

	List<Subscription> listSubcriptions() throws InformationServiceException;

	// DS
	DnetDataStructure getDsById(@WebParam(name = "id") String id) throws InformationServiceException;

	DnetDataStructure getDsByCode(@WebParam(name = "code") String code, @WebParam(name = "type") String type) throws InformationServiceException;

	String registerDs(@WebParam(name = "resource") DnetDataStructure ds) throws InformationServiceException;

	boolean deleteDsById(@WebParam(name = "id") String id) throws InformationServiceException;

	boolean deleteDsByCode(@WebParam(name = "code") String code, @WebParam(name = "type") String type) throws InformationServiceException;

	boolean isRegisteredDs(@WebParam(name = "code") String code, @WebParam(name = "type") String type) throws InformationServiceException;

	List<DnetDataStructure> listDatastructures(@WebParam(name = "type") String type) throws InformationServiceException;

	// Generic resources
	boolean validateResource(@WebParam(name = "id") String id, @WebParam(name = "valid") boolean valid) throws InformationServiceException;

}
