import Quickshell
import Quickshell.Io
import QtQuick

import qs.config
import qs.services

ShellRoot {
    IpcHandler {
        target: "theme-profiles-test"

        function status(): string {
            return JSON.stringify({
                active: ThemeProfiles.activeProfile,
                profiles: ThemeProfiles.profiles,
                stored: DesktopPreferences.get("themeProfiles")
            });
        }

        function select(id: string): bool {
            return ThemeProfiles.selectProfile(id);
        }

        function scheme(value: string): bool {
            return SystemSettings.commitPreference("colorScheme", value);
        }

        function edit(accent: string, secondary: string): bool {
            return ThemeProfiles.setAccentPair(accent, secondary);
        }

        function save(name: string): bool {
            return ThemeProfiles.saveProfile(name);
        }

        function remove(id: string): bool {
            return ThemeProfiles.deleteProfile(id);
        }
    }
}
