package io.xpipe.app.prefs;

import io.xpipe.app.comp.BaseRegionBuilder;
import io.xpipe.app.platform.LabelGraphic;
import io.xpipe.app.platform.OptionsBuilder;

public class SecurityCategory extends AppPrefsCategory {

    @Override
    protected String getId() {
        return "security";
    }

    @Override
    protected LabelGraphic getIcon() {
        return new LabelGraphic.IconGraphic("mdi2s-security-network");
    }

    public BaseRegionBuilder<?, ?> create() {
        var prefs = AppPrefs.get();
        var builder = new OptionsBuilder();
        builder.title("security")
                .sub(new OptionsBuilder()
                        .pref(prefs.alwaysConfirmElevation)
                        .addToggle(prefs.alwaysConfirmElevation)
                        .pref(prefs.dontCachePasswords)
                        .addToggle(prefs.dontCachePasswords)
                        .pref(prefs.disableCertutilUse)
                        .addToggle(prefs.disableCertutilUse)
                        .pref(prefs.dontAcceptNewHostKeys)
                        .addToggle(prefs.dontAcceptNewHostKeys)
                        .pref(prefs.disableSshPinCaching)
                        .addToggle(prefs.disableSshPinCaching)
                        .pref(prefs.dontAutomaticallyStartVmSshServer)
                        .addToggle(prefs.dontAutomaticallyStartVmSshServer)
                        .pref(prefs.disableTerminalRemotePasswordPreparation)
                        .addToggle(prefs.disableTerminalRemotePasswordPreparation));
        return builder.buildComp();
    }
}
