package org.jabref.logic.protectedterms;

import java.util.List;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;

public class ProtectedTermsPreferences {

    private final ObservableList<String> enabledInternalTermLists;
    private final ObservableList<String> enabledExternalTermLists;
    private final ObservableList<String> disabledInternalTermLists;
    private final ObservableList<String> disabledExternalTermLists;

    private ProtectedTermsPreferences() {
        this(
                ProtectedTermsLoader.getInternalLists(), // Enabled internal term lists
                List.of(),                               // Enabled external term lists
                List.of(),                               // Disabled internal term lists
                List.of()                                // Disabled external term lists
        );
    }

    public ProtectedTermsPreferences(List<String> enabledInternalTermLists,
                                     List<String> enabledExternalTermLists,
                                     List<String> disabledInternalTermLists,
                                     List<String> disabledExternalTermLists) {
        this.enabledInternalTermLists = FXCollections.observableArrayList(enabledInternalTermLists);
        this.disabledInternalTermLists = FXCollections.observableArrayList(disabledInternalTermLists);
        this.enabledExternalTermLists = FXCollections.observableArrayList(enabledExternalTermLists);
        this.disabledExternalTermLists = FXCollections.observableArrayList(disabledExternalTermLists);
    }

    public static ProtectedTermsPreferences getDefault() {
        return new ProtectedTermsPreferences();
    }

    public ObservableList<String> getEnabledInternalTermLists() {
        return enabledInternalTermLists;
    }

    public ObservableList<String> getEnabledExternalTermLists() {
        return enabledExternalTermLists;
    }

    public ObservableList<String> getDisabledInternalTermLists() {
        return disabledInternalTermLists;
    }

    public ObservableList<String> getDisabledExternalTermLists() {
        return disabledExternalTermLists;
    }

    public void setEnabledInternalTermLists(List<String> list) {
        enabledInternalTermLists.clear();
        enabledInternalTermLists.addAll(list);
    }

    public void setEnabledExternalTermLists(List<String> list) {
        enabledExternalTermLists.clear();
        enabledExternalTermLists.addAll(list);
    }

    public void setDisabledInternalTermLists(List<String> list) {
        disabledInternalTermLists.clear();
        disabledInternalTermLists.addAll(list);
    }

    public void setDisabledExternalTermLists(List<String> list) {
        disabledExternalTermLists.clear();
        disabledExternalTermLists.addAll(list);
    }
}
