package be.iminds.ilabt.jfed.highlevel.jobs.parts;

import be.iminds.ilabt.jfed.experiment.ExperimentPart;
import be.iminds.ilabt.jfed.highlevel.jobs.ExperimentPartStateSlice;
import be.iminds.ilabt.jfed.highlevel.jobs.Job;
import be.iminds.ilabt.jfed.lowlevel.api.user_spec.UserSpec;

import java.time.Instant;
import java.util.Collection;

/**
 * User: twalcari
 * Date: 1/12/2016
 * Time: 15:38
 */
public interface  ExperimentPartController<EP extends ExperimentPart> {

    ExperimentPartStateSlice<EP> update(Job<?> job, EP experimentPart);
    /**
     * This method should set the InternalState of the ExperimentPart to DELETING when started,
     * and to DELETED when successfully finished.
     *
     */
    ExperimentPartStateSlice<EP> stop(Job<?> job, EP experimentPart);

    boolean supportsRenew(EP experimentPart);
    ExperimentPartStateSlice<EP> renew(Job<?>job, EP experimentPart, Instant newExpirationTime);


    boolean supportsEditSshKeys(EP experimentPart);
    ExperimentPartStateSlice<EP> editSshKeys(Job<?> job, EP experimentPart, Collection<UserSpec> userSpecs);

    boolean supportsRestore(EP experimentPart);
    ExperimentPartStateSlice<EP> restore(Job<?> job, EP experimentPart);
}
