import Quickshell
import Quickshell.Io
import QtQuick

import qs.services

// Drives services/Vpn.qml for tests/quickshell/vpn-contract. The contract
// stands a stub nmcli on PATH, so everything the service believes comes from
// fixtures and everything it does is recorded — no real tunnel is touched.

ShellRoot {
    IpcHandler {
        target: "vpn-test"

        function status(): string {
            return JSON.stringify({
                scanned: Vpn.scanned,
                available: Vpn.available,
                anyActive: Vpn.anyActive,
                activeSummary: Vpn.activeSummary,
                busy: Vpn.busy,
                lastError: Vpn.lastError,
                connections: Vpn.connections
            });
        }
        function refresh(): void { Vpn.refresh(); }
        function toggle(): void { Vpn.toggle(); }
        function setActive(uuid: string, on: bool): void { Vpn.setActive(uuid, on); }
    }
}
