package tech.nevets.tvpn.wg;

import tech.nevets.tvpn.Logger;

public class WireGuardJNI {
    private static final Logger LOGGER = new Logger(WireGuardJNI.class);

    // Load the native library
    static {
        System.loadLibrary("libwireguard_wrapper");  // This will load wireguard_wrapper.dll (or .so on Linux)
        LOGGER.log("Loaded libwireguard_wrapper");
    }

    // Native method declaration
    public native int installAdapter();
    public native int removeAdapter();

    /**
     * Creates and starts the WireGuard service
     * @param tunnelName Name of the tunnel
     * @param pathToConfig Full path to the tunnel's configuration file
     * @return 0 if successful, 1 if failed
     */
    public native int installTunnel(String tunnelName, String pathToConfig);
    public native int removeTunnel(String tunnelName);

    public native String getConfig(String tunnelName);
    public native int updateConfig(String tunnelName, String newConfig);
    public native int addConfig(String tunnelName, String config);

    public native String getActiveTunnel();
    public native boolean isActive();

    public native int initializeWireGuard(String configFilePath);
    public native void cleanup();

    public native String getWGVersion();
    public native long parseConfig(WGConf conf);

    // Other methods for WireGuard interaction can be added here if needed
}
