package ctbrec.recorder.download;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.time.Instant;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;

import ctbrec.Config;
import ctbrec.Model;
import ctbrec.Recording;

public interface Download extends Serializable, Callable<Download> {
    void init(Config config, Model model, Instant startTime, ExecutorService executorService) throws IOException;
    void stop();
    void finalizeDownload();
    boolean isRunning();
    Model getModel();
    Instant getStartTime();
    Instant getRescheduleTime();
    void postprocess(Recording recording);

    /**
     * Returns the path to the recording in the filesystem as file object
     * @param model
     * @return
     * @see #getPath(Model)
     */
    public File getTarget();

    /**
     * Returns the path to the recording starting from the configured recordings directory
     * @param model
     * @return
     * @see #getTarget()
     */
    public String getPath(Model model);

    /**
     * Specifies, if the final result of this recording is a single file or consists of segments + playlist
     * @return true, if the recording is only a single file
     */
    public boolean isSingleFile();

    public long getSizeInByte();
}
