package be.iminds.ilabt.jfed.preferences;

import be.iminds.ilabt.jfed.lowlevel.RetrySettings;
import be.iminds.ilabt.jfed.util.OSDetector;

import javax.annotation.Nonnull;
import java.io.File;
import java.util.List;

/**
 * JFedPreferences
 */
public interface JFedPreferences {
    /**
     * Increment nr to force new "FirstRun" for new version.
     * Default nr is 0. Will be set to this nr on firstrun handling.
     */
    int CURRENT_FIRSTRUN_VERSION = 1;

    void fillinBlanks();

    boolean containsPreference(PreferenceKey key);

    boolean hasKey(PreferenceKey key);

    String getString(PreferenceKey key);
    @Nonnull
    List<String> getStringList(PreferenceKey key);

    void setString(PreferenceKey key, String value);
    void setStringList(PreferenceKey key, @Nonnull List<String> value);

    Integer getInt(PreferenceKey key);

    void setInt(PreferenceKey key, Integer value);

    Boolean getBoolean(PreferenceKey key);

    boolean getBoolean(PreferenceKey key, boolean defaultValue);

    void setBoolean(PreferenceKey key, Boolean value);

    File getFile(PreferenceKey key);

    void setFile(PreferenceKey key, File value);

    void clear(PreferenceKey key);

    File getPropertiesFile();

    void addPreferenceChangeListener(PreferenceKey prefDebugCpu, PreferenceChangeListener preferenceChangeListener);


    void setRetrySettings(RetrySettings retrySettings);

    @Nonnull
    RetrySettings getRetrySettings();

    /**
     * Preference
     */
    interface PreferenceKey {
        @Override
        String toString();

        String getKey();

        boolean isOSSpecific();

        OSDetector.OSFilter getOSFilter();
    }
}
