import Quickshell
import Quickshell.Io
import QtQuick

import qs.config

ShellRoot {
    IpcHandler {
        target: "settings-pref-test"

        function applyFixture(): void {
            DesktopPreferences.set("use24Hour", true);
            DesktopPreferences.set("showSeconds", false);
            DesktopPreferences.set("dockAutohide", false);
            DesktopPreferences.set("focusDurationMinutes", 70);
            DesktopPreferences.set("autoHdr", false);
            DesktopPreferences.set("vrrPolicy", 0);
            DesktopPreferences.set("directScanoutPolicy", 0);
            DesktopPreferences.set("nightLightEnabled", true);
            DesktopPreferences.set("nightLightAutomatic", true);
            DesktopPreferences.set("nightLightTemperature", 4100);
            DesktopPreferences.set("lastPage", "desktop");
        }

        function status(): string {
            return JSON.stringify({
                use24Hour: DesktopPreferences.get("use24Hour"),
                showSeconds: DesktopPreferences.get("showSeconds"),
                dockAutohide: DesktopPreferences.get("dockAutohide"),
                focusDurationMinutes: DesktopPreferences.get("focusDurationMinutes"),
                autoHdr: DesktopPreferences.get("autoHdr"),
                vrrPolicy: DesktopPreferences.get("vrrPolicy"),
                directScanoutPolicy: DesktopPreferences.get("directScanoutPolicy"),
                nightLightEnabled: DesktopPreferences.get("nightLightEnabled"),
                nightLightAutomatic: DesktopPreferences.get("nightLightAutomatic"),
                nightLightTemperature: DesktopPreferences.get("nightLightTemperature"),
                lastPage: DesktopPreferences.get("lastPage"),
                stateDir: Quickshell.stateDir
            });
        }
    }
}
