{{- $tags := .chezmoi.config.data.tags -}}
{{- $monitors := .chezmoi.config.data.monitors -}}
{{- $isLaptop := index $tags "laptop" -}}
{{- $isDesktop := not (index $tags "laptop") -}}
pragma Singleton

import Quickshell
import QtQuick

Singleton {
    readonly property string home: Quickshell.env("HOME")

    // Appearance
    // apexFlavor: "neon" (dark) or "aeon" (light) — synced from chezmoi data.theme
    readonly property string apexFlavor: "{{ trimPrefix "apex-" .chezmoi.config.data.theme }}"
    readonly property bool transparency: true            // semi-transparent backgrounds (needs Hyprland blur layerrule)

    // Monitor — which monitor the bar lives on
{{- if $isDesktop }}
    readonly property string monitor: "DP-2"
{{- else }}
    readonly property string monitor: "{{ (index $monitors 0).name }}"
{{- end }}

    // Workspaces — show all 10; Hyprland IPC tracks per-monitor active workspace
    readonly property int workspaceCount: 10

    // Weather
    readonly property string weatherLocation: "Nospelt"
    readonly property bool useCelsius: true
    readonly property string tempUnit: useCelsius ? "°C" : "°F"
    readonly property string windUnit: useCelsius ? "km/h" : "mph"
    readonly property int forecastDays: 5
    readonly property int weatherRefreshMs: 1800000

    // Disk mounts to monitor
    readonly property string diskMount1: "/"
    readonly property string diskMount1Label: "/"
{{- if $isDesktop }}
    readonly property string diskMount2: home + "/data"
    readonly property string diskMount2Label: "/data"
{{- else }}
    readonly property string diskMount2: home
    readonly property string diskMount2Label: "~"
{{- end }}

    // Hardware capabilities
    readonly property bool hasDiscreteGpu: {{ if $isDesktop }}true{{ else }}false{{ end }}
    readonly property bool hasBattery: {{ if $isLaptop }}true{{ else }}false{{ end }}
    readonly property bool hasPowerProfiles: {{ if $isLaptop }}true{{ else }}false{{ end }}
    readonly property bool hasBluetooth: {{ if (index $tags "bluetooth") }}true{{ else }}false{{ end }}

    // Scripts
    readonly property string scriptsDir: home + "/.config/quickshell/scripts"
    readonly property string gpuScript: scriptsDir + "/gpu.sh"

    // Kubernetes
    readonly property bool kubeEnabled: true
    readonly property string kubeNamespace: "tenant-5"
    readonly property int kubeStatusRefreshMs: 120000  // pill cadence while popout closed
    readonly property int kubeRefreshOpenMs: 3000       // fast status+metrics cadence while popout open

    // Idle daemon
    readonly property string idleProcess: "hypridle"
    readonly property string lockCommand: "hyprlock"

    // Power commands
    readonly property var powerActions: [
        { command: ["hyprlock"] },
        { command: ["hyprshutdown"] },
        { command: ["hyprshutdown", "-t", "Restarting...", "--post-cmd", "systemctl reboot"] },
        { command: ["hyprshutdown", "-t", "Powering off...", "--post-cmd", "systemctl poweroff"] }
    ]

    // Network filter (interfaces to exclude from IP display)
    readonly property string netExcludePattern: "127.0.0\\|docker\\|br-\\|veth"

    // DateTime / Calendar
    readonly property bool use24h: true
    readonly property string clockFormat: use24h ? "HH:mm" : "hh:mm A"
    readonly property string clockSecondsFormat: use24h ? "HH:mm:ss" : "hh:mm:ss A"
    readonly property string dateFormat: "dddd, d MMMM yyyy"
    readonly property string pillDateFormat: "ddd\nd"
    readonly property string pillTimeFormat: use24h ? "HH\nmm" : "hh\nmm"
    readonly property bool weekStartsMonday: true
    readonly property var dayHeaders: weekStartsMonday ? ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"] : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
}
