using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Net.Security;
using HeuristicLab.Services.Optimization.ControllerService.Model;
namespace HeuristicLab.Services.Optimization.ControllerService {
///
/// The ControllerService represents the entry point of
/// the OaaS backend. It contains all possible operations
/// of OaaS.
///
[ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
public interface IControllerService {
///
/// Retrieves all available scenarios, including all
/// their information.
///
/// All scenarios
[OperationContract]
IEnumerable GetOptimizationScenarios();
///
/// Returns the names of all scenarios. This doesn't load
/// parameters or other scenario specific data.
///
///
/// The names of the scenarios,
/// e. g. ["Benchmark Algorithm", "Genetic Algorithm - TSP"]
///
[OperationContract]
IEnumerable GetOptimizationScenarioNames();
///
/// Retrieves a scenario by a given name including all of
/// it's data.
///
///
/// The scenario to lookup, e. g. "Benchmark Algorithm"
///
///
[OperationContract]
OptimizationScenario GetOptimizationScenarioByName(string name);
///
/// Schedules a scenario for certain user.
///
/// The user which wants to execute a scenario.
/// The scenario to execute.
/// The title of the job, the number of repititions of the scenario and the group of the job.
/// true, if the scenario has been successfully scheduled.
[OperationContract]
bool ScheduleOptimizationScenario(User user, OptimizationScenario scenario, JobExecutionDetails details);
///
/// Schedules an experiment for a certain user.
///
/// The user which wants to execute a scenario.
/// The name of the experiment to schedule.
/// The title of the job, the number of repititions of the experiment and the group of the job.
///
[OperationContract]
bool ScheduleExperiment(User user, string experiment, JobExecutionDetails details);
///
/// Returns all available jobs of a user.
///
/// The user to query the jobs for.
/// All jobs for a certain user.
[OperationContract]
IEnumerable GetJobs(User user);
///
/// Retrievs a job by it's id.
///
/// The owner of the job.
/// The id of the job.
/// The job with the given user and id.
[OperationContract]
Job GetJob(User user, string id);
///
/// Deletes a job of a user.
///
/// The owner of the job.
/// The job to delete.
/// true, if the job has been deleted.
[OperationContract]
bool DeleteJob(User user, string id);
///
/// Returns the results of a job including the input parameters and result parameters.
///
/// The owner of the job.
/// The id of the job.
/// The result and input parameters of the job.
[OperationContract]
IList GetJobResults(User user, string id);
///
/// Adds a new scenario to the system. This has to include a valid scenario xml representing all necessary inputs
/// for the new scenario and a scenario mapper which is capable of converting the OaaS-scenario-model into the
/// hive specific version.
/// Note: This method might be only usable by an underlying hive data access layer.
///
/// The owner of the scenario (must have administrator privileges).
/// The new scenario to upload.
/// The converter between OaaS-model and hive model.
/// true, if the scenario has been successfully saved.
[OperationContract]
bool AddHiveScenario(User user, string scenarioXml, string scenarioMapper);
///
/// Deletes a stored scenario including its xml and mapper.
///
/// An administrator of the system.
/// The name of the scenario.
/// true, if the scenario has been deleted.
[OperationContract]
bool DeleteHiveScenario(User user, string scenarioName);
///
/// Stores an experiment which is a tree of experiments and scenarios.
/// This method will schedule the experiment, if it contains job details.
///
/// The owner of the experiment.
/// The experiment including all of it's details.
/// If scheduled it will return the job id. In every other case null will be returned.
[OperationContract]
string SaveExperiment(User user, Experiment experiment);
///
/// Returns the names of the experiments for a certain user.
///
/// The owner of the experiments.
/// A list of experiment names.
[OperationContract]
IEnumerable GetExperimentNames(User user);
///
/// Returns all experiments. If "namesOnly" is false, the experiments include all of their details.
///
/// The owner of the experiments.
/// If true, returns only a list of experiments where only the Name parameter is set.
///
[OperationContract]
IEnumerable GetExperiments(User user, bool namesOnly = false);
///
/// TODO
///
///
///
///
[OperationContract]
bool DeleteExperiment(User user, string experiment);
[OperationContract]
Job GetTasks(User u, string jobId);
[OperationContract]
Task GetTaskData(User u, string jobId, string taskId);
[OperationContract]
Experiment GetExperimentByName(User user, string scenario);
[OperationContract]
Experiment GetExperimentById(User u, string nodeId);
[OperationContract]
VisualExtension GetVisualExtension(string algorithmId);
[OperationContract]
bool AddVisualExtension(string algorithmId, string script);
[OperationContract]
bool DeleteVisualExtension(string algorithmId);
[OperationContract]
bool ExistsVisualExtension(string algorithmId);
}
}