//
//  APIS.swift
//  example_code_react_native
//
//  Created by Akhmad Al Qindi Irsyam on 27/06/23.
//

import Foundation
import NexilisLite

@objc(CallNative)
class CallNative: NSObject, ConnectDelegate {
  func onSuccess(userId: String) {
    print("SUCCESS HMM \(userId)")
  }
  
  func onFailed(error: String) {
    print("FAILED HMM")
  }
  
  @objc func connect() {
    print("CONNECTSKUTT")
    APIS.connect(apiKey: "***REPLACE***WITH***YOUR***ACCOUNT***", delegate: self, showButton: false)
  }
  
  @objc func openContactCenter() {
    print("openContactCenter")
    DispatchQueue.main.async {
      APIS.openContactCenter()
    }
  }
  @objc func openChat() {
    print("openChat")
    DispatchQueue.main.async {
      APIS.openChat()
    }
  }
  @objc func openCall() {
    print("openCall")
    DispatchQueue.main.async {
      APIS.openCall()
    }
  }
  @objc func openStreaming() {
    print("openStreaming")
    DispatchQueue.main.async {
      APIS.openStreaming()
    }
  }
  @objc func openSetting() {
    print("openSetting")
    DispatchQueue.main.async {
      APIS.openSetting()
    }
  }
  @objc func openWhiteboard() {
    print("openWhiteboard")
    DispatchQueue.main.async {
      APIS.openWhiteboard()
    }
  }
  @objc func openNotificationCenter() {
    print("openNotificationCenter")
    DispatchQueue.main.async {
      APIS.openNotificationCenter()
    }
  }
  @objc(openContactCenterChat:)
  func openContactCenterChat(category: Int) {
    print("openContactCenterChat \(category)")
    DispatchQueue.main.async {
      APIS.openContactCenter(media: 0, category: category)
    }
  }
  @objc(openContactCenterAudioCall:)
  func openContactCenterAudioCall(category: Int) {
    print("openContactCenterAudioCall")
    DispatchQueue.main.async {
      APIS.openContactCenter(media: 1, category: category)
    }
  }
  @objc(openContactCenterVideoCall:)
  func openContactCenterVideoCall(category: Int) {
    print("openContactCenterVideoCall")
    DispatchQueue.main.async {
      APIS.openContactCenter(media: 2, category: category)
    }
  }
  @objc(signInAdmin:)
  func signInAdmin(pwd: String) {
    print("signInAdmin")
    DispatchQueue.main.async {
      APIS.signInAdmin(password: pwd)
    }
  }
  @objc func openSetOfficer() {
    print("openSetOfficer")
    DispatchQueue.main.async {
      APIS.openSetAsOfficerForm()
    }
  }
  @objc func openProfile() {
    print("openProfile")
    DispatchQueue.main.async {
      APIS.openProfile()
    }
  }
}
