import Quickshell
import Quickshell.Io
import QtQuick

import qs.services

ShellRoot {
    // The production singleton still performs its delayed startup scan. The
    // harness turns it off before its 2200 ms deadline so each fixture drives
    // only the state transition it is asserting.
    Component.onCompleted: Health.startupScanEnabled = false

    IpcHandler {
        target: "health-test"

        function accept(text: string, generation: int): bool { return Health.consumeSnapshot(text, generation); }
        function queue(): void { Health.refresh(); Health.refresh(); }
        function status(): string { return JSON.stringify(Health.diagnostics()); }
        function repair(id: string): bool { return Health.repair(id, false); }
        function report(): string { return JSON.stringify(Health.snapshot, null, 2); }
        function copy(): bool { return Health.copyReport(); }
    }
}
