import Quickshell
import Quickshell.Io
import QtQuick

import qs.modules.settings

ShellRoot {
    id: root

    readonly property string fixtureWallpaper: `${Quickshell.env("HOME")}/Pictures/Wallpapers/faroe_islands.jpg`

    LockScreenPreview {
        id: screenshotPreview
        width: 620
        backgroundMode: "screenshot"
        blurLevel: 4
        showClock: true
        showDate: true
        showUser: true
        fadeOnEmpty: false
        wallpaperPath: root.fixtureWallpaper
    }

    LockScreenPreview {
        id: wallpaperPreview
        width: 620
        backgroundMode: "wallpaper"
        blurLevel: 2
        showClock: false
        showDate: true
        showUser: false
        fadeOnEmpty: true
        wallpaperPath: root.fixtureWallpaper
    }

    LockScreenPreview {
        id: solidPreview
        width: 620
        backgroundMode: "solid"
        blurLevel: 0
        showClock: true
        showDate: false
        showUser: true
        fadeOnEmpty: false
        wallpaperPath: root.fixtureWallpaper
    }

    IpcHandler {
        target: "lock-screen-settings-test"

        function status(): string {
            return JSON.stringify({
                screenshot: {
                    mode: screenshotPreview.previewMode,
                    wallpaperVisible: screenshotPreview.wallpaperVisible,
                    blurStrength: screenshotPreview.blurStrength,
                    clockVisible: screenshotPreview.clockVisible,
                    dateVisible: screenshotPreview.dateVisible,
                    userVisible: screenshotPreview.userVisible,
                    passwordVisible: screenshotPreview.passwordVisible
                },
                wallpaper: {
                    mode: wallpaperPreview.previewMode,
                    wallpaperVisible: wallpaperPreview.wallpaperVisible,
                    blurStrength: wallpaperPreview.blurStrength,
                    clockVisible: wallpaperPreview.clockVisible,
                    dateVisible: wallpaperPreview.dateVisible,
                    userVisible: wallpaperPreview.userVisible,
                    passwordVisible: wallpaperPreview.passwordVisible
                },
                solid: {
                    mode: solidPreview.previewMode,
                    wallpaperVisible: solidPreview.wallpaperVisible,
                    blurStrength: solidPreview.blurStrength,
                    clockVisible: solidPreview.clockVisible,
                    dateVisible: solidPreview.dateVisible,
                    userVisible: solidPreview.userVisible,
                    passwordVisible: solidPreview.passwordVisible
                }
            });
        }
    }
}
