#!/bin/sh
# ABOUTME: Switches one camera on or off; dispatches the privileged sysfs write via pkexec.
# ABOUTME: Usage: moonarch-camera-toggle <usb-id> <0|1>. Exit code is pkexec's (126 = prompt cancelled).

ID="${1:-}"
VAL="${2:-}"

# Shape check only — moonarch-camera-apply re-validates everything as the privileged side.
case "$ID" in
    ""|*[!0-9.-]*) exit 1 ;;
esac
case "$VAL" in
    0 | 1) ;;
    *) exit 1 ;;
esac

pkexec /usr/bin/moonarch-camera-apply "$ID" "$VAL"
