package eu.stork.documentservice;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;
import javax.xml.ws.soap.MTOM;

@MTOM
@WebService(name = "DocumentService", targetNamespace = "http://stork.eu")
@SOAPBinding(style = Style.DOCUMENT, use = Use.LITERAL)
/**
 * 
 * @author Advania
 *
 */
public interface DocumentService {
		
	/**
	 * Add document to DTL layer
	 * @param document the document to add
	 * @param xmlRequest the original dss xml request
	 * @param country the destination country 
	 * @param SpId the sp id
	 * @param mimeType the document mime type
	 * @param receiverCert the receiver certificate (for encryption, not implemented now)
	 * @return the document id (docId)
	 */
	@WebMethod(operationName = "addDocument")
	public String addDocument(byte[] document, String xmlRequest, String country, String SpId, String mimeType, String receiverCert);
		
	/**
	 * Get document from DTL
	 * @param documentTransferRequest the document transfer request (attribute query saml)
	 * @param dtlUrl the url of dtl
	 * @return the document found
	 */
	@WebMethod(operationName = "getDocument")
	public byte[] getDocument(String documentTransferRequest, String dtlUrl);
	
	/**
	 * Get document mime type of document
	 * @param docId the document id
	 * @param dtlUrl the url of dtl
	 * @return the document mime type
	 */
	@WebMethod(operationName = "getDocumentMime")
	public String getDocumentMime(String docId, String dtlUrl);
		
	/**
	 * Update document in dtl
	 * @param docId the id of document (docId)
	 * @param xmlResponse the dss xml response 
	 * @param document the document data
	 * @return true if successful
	 */
	@WebMethod(operationName = "updateDocument")
	public boolean updateDocument(String docId, String xmlResponse, byte[] document);
	
	/**
	 * Add document to DTL layer which SP has uploaded
	 * @param docId the document ID of document
	 * @param xmlRequest the original dss xml request
	 * @param country the destination country 
	 * @param SpId the sp id
	 * @param mimeType the document mime type
	 * @param receiverCert the receiver certificate (for encryption, not implemented now)
	 * @return the full document ID
	 */
	@WebMethod(operationName = "addSPDocument")
	public String addSPDocument(String docId, String xmlRequest, String country, String SpId, String receiverCert);
	
	/**
	 * Update document in DTL and prepare for SP
	 * @param documentTransferRequest the document transfer request (attribute query saml)
	 * @param dtlUrl the url of the dtl
	 * @param xmlResponse the xml response
	 * @return true if successful
	 */
	@WebMethod(operationName = "updateSPDocument")
	public boolean updateSPDocument(String documentTransferRequest, String dtlUrl, String xmlResponse);
}