// AliceHelperModule.java

package com.reactlibrary;

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.Callback;
import android.bluetooth.BluetoothAdapter;

public class AliceHelperModule extends ReactContextBaseJavaModule {

    private final ReactApplicationContext reactContext;

    public AliceHelperModule(ReactApplicationContext reactContext) {
        super(reactContext);
        this.reactContext = reactContext;
    }

    @Override
    public String getName() {
        return "AliceHelper";
    }

    @ReactMethod
    public void sampleMethod(Boolean status, Callback callback) {
        BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        if (bluetoothAdapter == null) {
            callback.invoke("Bluetooth not supported");
        } else if (status) {
            if (!bluetoothAdapter.isEnabled()) {
                bluetoothAdapter.enable();
                callback.invoke("Bluetooth on");
            } else {
                bluetoothAdapter.disable();
                callback.invoke("Bluetooth off");
            }
        }
    }
}
