import Quickshell
import Quickshell.Wayland
import Quickshell.Io
import "DialogBox"

PanelWindow {
    id: baseDialog
    anchors {
        bottom: true
    }
    property bool isOpen: false
    property string text: "(The power of Hyprland\nshines within you.)"

    WlrLayershell.layer: WlrLayer.Overlay
    WlrLayershell.focusable: false
    WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
    WlrLayershell.namespace: "deltarune-quickshell-dialogbox"

    visible: isOpen
    exclusionMode: ExclusionMode.Ignore
    aboveWindows: true
    focusable: false

    mask: Region {}

    implicitHeight: 378
    implicitWidth: 1332
    color: '#000000ff'

    DialogBox {
        text: baseDialog.text
    }

    IpcHandler {
        target: "deltarune.dialog"
        enabled: true
        function open(): void {
            baseDialog.isOpen = true;
        }
        function close(): void {
            baseDialog.isOpen = false;
        }
        function setText(text: string): void {
            baseDialog.text = text.replace("\\n", "\n");
        }
    }
}
