#include <napi.h>

Napi::Value NotSupportedPayload(Napi::Env env) {
  Napi::Object payload = Napi::Object::New(env);
  payload.Set("ok", false);
  payload.Set("code", "FINGERPRINTING_NOT_SUPPORTED");
  payload.Set("message", "Not supported for this platform.");

  return payload;
}

Napi::Value GetDeviceInfo(const Napi::CallbackInfo &info) {
  Napi::Env env = info.Env();

  return NotSupportedPayload(env);
}

Napi::Value OpenDevice(const Napi::CallbackInfo &info) {
  Napi::Env env = info.Env();
  return NotSupportedPayload(env);
}

Napi::Value CloseDevice(const Napi::CallbackInfo &info) {
  Napi::Env env = info.Env();
  return NotSupportedPayload(env);
}

// Function to start the Auto-On thread
Napi::Value StartAutoOn(const Napi::CallbackInfo &info) {
  Napi::Env env = info.Env();
  return NotSupportedPayload(env);
}

// Function to stop Auto-On
Napi::Value StopAutoOn(const Napi::CallbackInfo &info) {
  Napi::Env env = info.Env();
  return NotSupportedPayload(env);
}

Napi::Value CompareTemplates(const Napi::CallbackInfo &info) {
  Napi::Env env = info.Env();
  return NotSupportedPayload(env);
}

Napi::Value CaptureAndCreateTemplate(const Napi::CallbackInfo &info) {
  Napi::Env env = info.Env();
  return NotSupportedPayload(env);
}

Napi::Value IsAutoOnActive(const Napi::CallbackInfo &info) {
  Napi::Env env = info.Env();
  return NotSupportedPayload(env);
}

Napi::Object Init(Napi::Env env, Napi::Object exports) {
  exports.Set(Napi::String::New(env, "openDevice"),
              Napi::Function::New(env, OpenDevice));
  exports.Set(Napi::String::New(env, "closeDevice"),
              Napi::Function::New(env, CloseDevice));
  exports.Set(Napi::String::New(env, "getDeviceInfo"),
              Napi::Function::New(env, GetDeviceInfo));
  exports.Set(Napi::String::New(env, "startAutoOn"),
              Napi::Function::New(env, StartAutoOn));
  exports.Set(Napi::String::New(env, "stopAutoOn"),
              Napi::Function::New(env, StopAutoOn));
  exports.Set(Napi::String::New(env, "captureAndCreateTemplate"),
              Napi::Function::New(env, CaptureAndCreateTemplate));
  exports.Set(Napi::String::New(env, "compareTemplates"),
              Napi::Function::New(env, CompareTemplates));
  exports.Set(Napi::String::New(env, "isAutoOnActive"),
              Napi::Function::New(env, IsAutoOnActive));

  return exports;
}

NODE_API_MODULE(secugen, Init)