///
/// HybridNativeBleNitroSpec.swift
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///

import NitroModules

/// See ``HybridNativeBleNitroSpec``
public protocol HybridNativeBleNitroSpec_protocol: HybridObject {
  // Properties
  var restoreStateIdentifier: String? { get set }

  // Methods
  func setRestoreStateCallback(callback: @escaping (_ restoredPeripherals: [BLEDevice]) -> Void) throws -> Void
  func iosLazyInit() throws -> Void
  func startScan(filter: ScanFilter, callback: @escaping (_ device: Variant_NullType_BLEDevice?, _ error: Variant_NullType_String?) -> Void) throws -> Void
  func stopScan() throws -> Bool
  func isScanning() throws -> Bool
  func getConnectedDevices(services: [String]) throws -> [BLEDevice]
  func connect(deviceId: String, callback: @escaping (_ success: Bool, _ deviceId: String, _ error: String) -> Void, disconnectCallback: ((_ deviceId: String, _ interrupted: Bool, _ error: String) -> Void)?, autoConnectAndroid: Bool?) throws -> Void
  func disconnect(deviceId: String, callback: @escaping (_ success: Bool, _ error: String) -> Void) throws -> Void
  func isConnected(deviceId: String) throws -> Bool
  func requestMTU(deviceId: String, mtu: Double) throws -> Double
  func requestConnectionPriority(deviceId: String, androidConnectionPriority: AndroidConnectionPriority) throws -> Bool
  func readRSSI(deviceId: String, callback: @escaping (_ success: Bool, _ rssi: Double, _ error: String) -> Void) throws -> Void
  func discoverServices(deviceId: String, callback: @escaping (_ success: Bool, _ error: String) -> Void) throws -> Void
  func discoverServicesWithCharacteristics(deviceId: String, callback: @escaping (_ success: Bool, _ error: String) -> Void) throws -> Void
  func getServices(deviceId: String) throws -> [String]
  func getCharacteristics(deviceId: String, serviceId: String) throws -> [String]
  func readCharacteristic(deviceId: String, serviceId: String, characteristicId: String, callback: @escaping (_ success: Bool, _ data: ArrayBuffer, _ error: String) -> Void) throws -> Void
  func writeCharacteristic(deviceId: String, serviceId: String, characteristicId: String, data: ArrayBuffer, withResponse: Bool, callback: @escaping (_ success: Bool, _ responseData: ArrayBuffer, _ error: String) -> Void) throws -> Void
  func subscribeToCharacteristic(deviceId: String, serviceId: String, characteristicId: String, updateCallback: @escaping (_ characteristicId: String, _ data: ArrayBuffer) -> Void, completionCallback: @escaping (_ success: Bool, _ error: String) -> Void) throws -> Void
  func unsubscribeFromCharacteristic(deviceId: String, serviceId: String, characteristicId: String, callback: @escaping (_ success: Bool, _ error: String) -> Void) throws -> Void
  func isSubscribedToCharacteristic(deviceId: String, serviceId: String, characteristicId: String) throws -> Bool
  func requestBluetoothEnable(callback: @escaping (_ success: Bool, _ error: String) -> Void) throws -> Void
  func state() throws -> BLEState
  func subscribeToStateChange(stateCallback: @escaping (_ state: BLEState) -> Void) throws -> OperationResult
  func unsubscribeFromStateChange() throws -> OperationResult
  func openSettings() throws -> Promise<Void>
}

public extension HybridNativeBleNitroSpec_protocol {
  /// Default implementation of ``HybridObject.toString``
  func toString() -> String {
    return "[HybridObject NativeBleNitro]"
  }
}

/// See ``HybridNativeBleNitroSpec``
open class HybridNativeBleNitroSpec_base {
  private weak var cxxWrapper: HybridNativeBleNitroSpec_cxx? = nil
  public init() { }
  public func getCxxWrapper() -> HybridNativeBleNitroSpec_cxx {
  #if DEBUG
    guard self is any HybridNativeBleNitroSpec else {
      fatalError("`self` is not a `HybridNativeBleNitroSpec`! Did you accidentally inherit from `HybridNativeBleNitroSpec_base` instead of `HybridNativeBleNitroSpec`?")
    }
  #endif
    if let cxxWrapper = self.cxxWrapper {
      return cxxWrapper
    } else {
      let cxxWrapper = HybridNativeBleNitroSpec_cxx(self as! any HybridNativeBleNitroSpec)
      self.cxxWrapper = cxxWrapper
      return cxxWrapper
    }
  }
}

/**
 * A Swift base-protocol representing the NativeBleNitro HybridObject.
 * Implement this protocol to create Swift-based instances of NativeBleNitro.
 * ```swift
 * class HybridNativeBleNitro : HybridNativeBleNitroSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridNativeBleNitroSpec = HybridNativeBleNitroSpec_protocol & HybridNativeBleNitroSpec_base
