// Copyright (c) 2026, Salesforce, Inc.,
// All rights reserved.
// For full license text, see the LICENSE.txt file

//! # Proxy-Wasm Stub
//!
//! This crate provides a stub implementation of the Proxy-Wasm framework.
//! It allows to depend on and compile the Proxy-Wasm Rust SDK for non-`wasm32` platforms.

#[allow(unused_unsafe, clippy::too_many_arguments)]
pub mod hostcalls;
pub mod stub;
pub mod traits;
pub mod types;

/// Re-implementation of most of the function and types of <https://github.com/proxy-wasm/proxy-wasm-rust-sdk>
/// without any extern function, so that they are able to compile in Windows ((<https://github.com/rust-lang/rust/issues/86125>)
// For crate-type="cdylib".
#[cfg(not(wasi_exec_model_reactor))]
#[macro_export]
macro_rules! main {
    ($code:block) => {
        #[cfg(target_os = "wasi")]
        extern "C" {
            fn __wasm_call_ctors();
        }

        #[no_mangle]
        pub extern "C" fn _initialize() {
            #[cfg(target_os = "wasi")]
            unsafe {
                __wasm_call_ctors();
            }

            $code;
        }
    };
}

/// Sets the log level.
pub fn set_log_level(_level: types::LogLevel) {
    unimplemented!("Not implemented for current target")
}

/// Sets the root context.
pub fn set_root_context(_callback: types::NewRootContext) {
    unimplemented!("Not implemented for current target")
}

/// Sets the stream context.
pub fn set_stream_context(_callback: types::NewStreamContext) {
    unimplemented!("Not implemented for current target")
}

/// Sets the HTTP context.
pub fn set_http_context(_callback: types::NewHttpContext) {
    unimplemented!("Not implemented for current target")
}
