// Stub file to satisfy SPM target requirement
import Foundation
import Cordova
import IndigitallCordovaObjC

@objc(CDVIndigitallSwift)
public class CDVIndigitallSwift: CDVPlugin {

  @objc(initialize:)
  public func initialize(_ command: CDVInvokedUrlCommand) {
      INDIndigitallBridge.initialize(with: self, command: command)
  }
    
  @objc(getPushPermissionStatus:)
  public func getPushPermissionStatus(_ command: CDVInvokedUrlCommand) {
      INDIndigitallBridge.getPushPermissionStatus(with: self, command: command)
  }

  @objc(deviceGet:)
  public func deviceGet(_ command: CDVInvokedUrlCommand) {
      INDIndigitallBridge.deviceGet(with: self, command: command)
  }

  @objc(deviceEnable:)
  public func deviceEnable(_ command: CDVInvokedUrlCommand) {
      INDIndigitallBridge.deviceEnable(with: self, command: command)
  }

  @objc(deviceDisable:)
  public func deviceDisable(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.deviceDisable(with: self, command: command)
  }

  @objc(topicsList:)
  public func topicsList(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.topicsList(with: self, command: command)
  }

  @objc(topicsSubscribe:)
  public func topicsSubscribe(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.topicsSubscribe(with: self, command: command)
  }

  @objc(topicsUnsubscribe:)
  public func topicsUnsubscribe(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.topicsUnsubscribe(with: self, command: command)
  }

  @objc(setExternalCode:)
  public func setExternalCode(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.setExternalCode(command)
  }

  @objc(sendCustomEvent:)
  public func sendCustomEvent(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.sendCustomEvent(command)
  }

  @objc(packageName:)
  public func packageName(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.packageName(with: self, command: command)
  }

  @objc(getPush:)
  public func getPush(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.getPushWith(self, command: command)
  }

  @objc(onIndigitallGetPush:)
  public func onIndigitallGetPush(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.onIndigitallGetPush(with: self, command: command)
  }

  @objc(setDefaultViewUrl:)
  public func setDefaultViewUrl(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.setDefaultViewUrlWith(self, command: command)
  }

  @objc(clearViewUrl:)
  public func clearViewUrl(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.clearViewUrl(with: self, command: command)
  }

  @objc(logIn:)
  public func logIn(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.logIn(with: self, command: command)
  }

  @objc(logOut:)
  public func logOut(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.logOut(with: self, command: command)
  }

  @objc(requestPushPermissions:)
  public func requestPushPermissions(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.requestPushPermissions(with: self, command: command)
  }

  @objc(onMessageReceived:)
  public func onMessageReceived(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.onMessageReceived(with: self, command: command)
  }

  @objc(getToken:)
  public func getToken(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.getTokenWith(self, command: command)
  }

  @objc(isIndigitallPushNotification:)
  public func isIndigitallPushNotification(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.isIndigitallPushNotification(with: self, command: command)
  }

  @objc(isPushSecure:)
  public func isPushSecure(_ command: CDVInvokedUrlCommand) {
    INDIndigitallBridge.isPushSecure(with: self, command: command)
  }

  @objc(sendNotification:)
  public func sendNotification(_ command: CDVInvokedUrlCommand) {
      guard let userInfo = command.arguments.first as? [AnyHashable: Any] else {
          // You might want to send an error result back to Cordova here
          return
      }
      INDIndigitallBridge.sendNotification(with: self, userInfo: userInfo)
  }

  @objc(onHandleNotificationTap:)
  public func onHandleNotificationTap(_ command: CDVInvokedUrlCommand) {
      guard let userInfo = command.arguments.first as? [AnyHashable: Any] else {
          // You might want to send an error result back to Cordova here
          return
      }
      INDIndigitallBridge.onHandleNotificationTap(with: self, userInfo: userInfo)
  }

  @objc(sendToken:)
  public func sendToken(_ command: CDVInvokedUrlCommand) {
      guard let tokenString = command.arguments.first as? String,
            let token = tokenString.data(using: .utf8) else {
          // You might want to send an error result back to Cordova here
          return
      }
      // Note: If the token is a hex string from APNs, it will need to be converted to Data differently.
      INDIndigitallBridge.sendToken(with: self, token: token)
  }

}
