import QtQuick
import Quickshell
import Quickshell.Hyprland
import "./widgets"
import "../../colors"

// TODO: interact with PyWal

PanelWindow {
    id: panel

    color: "transparent"

    anchors.top: true
    anchors.left: true
    anchors.right: true

    implicitHeight: 40

    exclusiveZone: height // this is so context menus don't clip into the bar

    property HyprlandMonitor barThisMonitor: Hyprland.monitorFor(screen)

    margins {
        top: 0
        left: 0
        right: 0
    }

    Rectangle { // Bar
        id: bar
        anchors.fill: parent   
        color: Qt.alpha(Colors.background, 0.5)
        radius: 0

        Row {   // bar widgets left
            id: widgetsLeft

            anchors.verticalCenter: parent.verticalCenter
            anchors.left: parent.left
            anchors.leftMargin: 16
            spacing: 8

            MenuButton {}
            // TODO: Add functionallity (Maybe just rofi or own way)

            Workspaces { 
                thisMonitor: barThisMonitor 
                anchors.verticalCenter: parent.verticalCenter
            }
            // TODO: Maybe add current Apps in workspace

        }

        Row {  // bar widgets center
            id: widgetsCenter

            anchors.centerIn: parent

            Clock {}

            // TODO: Add a way to see Date (maybe hover or click)

        }

        Row { // bar widgets right
            id: widgetsRight

            anchors.verticalCenter: parent.verticalCenter
            anchors.right: parent.right
            anchors.rightMargin: 16
            spacing: 8

            // TODO: Add bluetooth, network, audio, power, maybe HW monitor
            Tray{}
            Network {}
            IdleButton {}
            PowerButton {}

        }
    }
}
