import { NativeModules, Platform } from 'react-native';

const LINKING_ERROR =
  `The package 'rereactnativesdk' doesn't seem to be linked. Make sure: \n\n` +
  Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
  '- You rebuilt the app after installing the package\n' +
  '- You are not using Expo Go\n';

const ReReactNative = NativeModules.rereactnative
  ? NativeModules.rereactnative
  : new Proxy(
    {},
    {
      get() {
        throw new Error(LINKING_ERROR);
      },
    }
  );


export class ReSDKPlugin {

  
  static updatePushToken(token: String) {
    ReReactNative.updatePushToken(token);
  }
  static customEvent(eventName: String) {
    ReReactNative.onTrackEvent(eventName);
  }
  
  static locationUpdate(lat: Number, lang: Number) {
    ReReactNative.locationUpdate(lat, lang);
  }
  
}



