package eu.dnetlib.espas.gui.client;

import java.util.List;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

import eu.dnetlib.espas.gui.shared.*;

@RemoteServiceRelativePath("download")
public interface DownloadService extends RemoteService {

    public List<Vocabulary> getLicences(Query query, List<RefineOption> refineOptions, DateRange selectedDateRange, boolean forData)
            throws DownloadManagerException;

    public List<Vocabulary> getLicences(String queryId, List<RefineOption> refineOptions, DateRange selectedDateRange, boolean forData)
            throws DownloadManagerException;

    public List<DownloadRequest> getRequestsByUserAndType(String userId, String type);

    public List<DataProviderStatus> getInvolvedDataProvidersStatus(Query query, List<RefineOption> refineOptions,
                                                                   DateRange selectedDateRange) throws DownloadManagerException;

    public List<DataProviderStatus> getInvolvedDataProvidersStatus(String queryId, List<RefineOption> refineOptions,
                                                                   DateRange selectedDateRange) throws DownloadManagerException;

    // Download Files

	public void download(String userId, String requestName, Query query, List<RefineOption> refineOptions, DateRange selectedDateRange,
                         List<TimePeriodElementValues> timePeriods, List<Vocabulary> agreedLicences, BrowseResults browseResults)
            throws DownloadManagerException;

    public void downloadLocationResultFiles(String userId, String requestName, Query query, List<RefineOption> refineOptions, DateRange selectedDateRange,
                         List<TimePeriodElementValues> timePeriods, List<Vocabulary> agreedLicences, BrowseResults browseResults)
            throws DownloadManagerException;

	public DownloadStatus getRequestStatus(String requestId, String userId);

    public void cancelDownload(String requestId, String userId);

    public void resubmitDownload(String requestId, String userId);

    public void deleteDownloadRequest(String requestId, String userId);
	

    // Download Data

    public List<Vocabulary> getExtractedParameters(Query query, List<RefineOption> refineOptions, DateRange selectedDateRange)
            throws DownloadManagerException;

    public List<Vocabulary> getExtractedParameters(String queryId, List<RefineOption> refineOptions, DateRange selectedDateRange)
            throws DownloadManagerException;

    public void downloadData(String userId, Query query, List<RefineOption> refineOptions, DateRange selectedDateRange, String requestName,
                             List<Vocabulary> extractedParameters, List<TimePeriodElementValues> temporalConstraints,
                             List<Vocabulary> agreedLicences, BrowseResults browseResults) throws DownloadManagerException;

    public void downloadLocationResultData(String userId, Query query, List<RefineOption> refineOptions, DateRange selectedDateRange,
                                           String requestName, List<Vocabulary> extractedParameters,
                                           List<TimePeriodElementValues> temporalConstraints, List<Vocabulary> agreedLicences,
                                           BrowseResults browseResults) throws DownloadManagerException;

    public DataDownloadStatus getDataRequestStatus(String requestId, String userId);

    public PlotData getDataForPlot(String requestId, String xsltName, String userId) throws Exception;

    public void resubmitDataDownload(String requestId, String userId);

    public void deleteDataDownloadRequest(String requestId, String userId);
}
