//! Fixture proving that ambient WASI clock imports are denied by the sandbox.
//!
//! Calling `std::time::Instant::now` causes this Component to import WASI
//! monotonic-clock directly. Wasmeld only links explicitly approved capability
//! packages, so registration or startup must reject this fixture.

mod bindings {
    // The declared service WIT contains no WASI clock capability; the direct
    // standard-library use below deliberately creates an undeclared import.
    wit_bindgen::generate!({
        path: "wit",
        world: "wasi-clock-probe-component",
    });
}

struct WasiClockProbe;

impl bindings::Guest for WasiClockProbe {
    fn init(_config: Vec<u8>) -> Result<(), bindings::ServiceError> {
        Ok(())
    }

    fn invoke(input: Vec<u8>) -> Result<Vec<u8>, bindings::ServiceError> {
        let _ = std::time::Instant::now();
        Ok(input)
    }
}

bindings::export!(WasiClockProbe with_types_in bindings);
