// System installation contract for safe server/client deployment scripts.
//
// Scope: verify install scripts keep idempotent runtime defaults and explicit
// operator gates around disruptive system changes.
// Targets: `scripts/install/server.sh` and `scripts/install/client.sh`.
// Why: Lesavka runs across multiple machines; install scripts must configure
// the system repeatably without surprising gadget resets or missing media deps.

const SERVER_INSTALL: &str = include_str!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/scripts/install/server.sh"
));
const CLIENT_INSTALL: &str = include_str!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/scripts/install/client.sh"
));

#[test]
fn system_installers_keep_disruptive_changes_opt_in_and_media_defaults_explicit() {
    for marker in [
        "LESAVKA_INSTALL_CAM_OUTPUT",
        "LESAVKA_INSTALL_UVC_CODEC",
        "LESAVKA_FORCE_GADGET_REBUILD",
        "LESAVKA_ALLOW_GADGET_RESET",
        "Preserving the attached gadget to avoid wedging the Pi USB controller",
        "LESAVKA_KERNEL_UPDATE:-0",
        "gst-plugins-bad",
        "gst-libav",
    ] {
        assert!(
            SERVER_INSTALL.contains(marker),
            "server installer should preserve marker {marker}"
        );
    }

    for marker in [
        "LESAVKA_CLIENT_PKI_BUNDLE",
        "desktop-file-utils",
        "gst-plugin-pipewire",
        "LESAVKA_REF",
        "Installing launchable client binaries",
    ] {
        assert!(
            CLIENT_INSTALL.contains(marker),
            "client installer should preserve marker {marker}"
        );
    }
}
