// Read-only contract harness for the Sound page. It instantiates every device
// row against the real PipeWire graph but exposes no mutating IPC methods.

import Quickshell
import Quickshell.Io
import Quickshell.Services.Pipewire
import QtQuick
import qs.services
import qs.modules.settings

ShellRoot {
    SoundPage {
        width: 760
        height: 900
    }

    PwObjectTracker {
        objects: AudioDevices.outputs.concat(AudioDevices.inputs)
    }

    IpcHandler {
        target: "sound-page-test"

        function status(): string {
            return JSON.stringify({
                ready: Pipewire.ready,
                outputs: AudioDevices.outputs.length,
                inputs: AudioDevices.inputs.length,
                defaultOutput: AudioDevices.label(AudioDevices.current(true)),
                defaultInput: AudioDevices.label(AudioDevices.current(false))
            });
        }
    }
}
