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

import NitroModules

/// See ``HybridOneBatterySpec``
public protocol HybridOneBatterySpec_protocol: HybridObject {
  // Properties
  

  // Methods
  func getLevel() throws -> Promise<Double>
  func getState() throws -> Promise<BatteryState>
  func getPowerState() throws -> Promise<BatteryPowerState>
  func isLowPowerModeEnabled() throws -> Promise<Bool>
  func isAvailable() throws -> Bool
  func addLevelListener(listener: @escaping (_ event: BatteryLevelEvent) -> Void) throws -> () -> Void
  func addStateListener(listener: @escaping (_ event: BatteryStateEvent) -> Void) throws -> () -> Void
  func addLowPowerModeListener(listener: @escaping (_ event: BatteryPowerModeEvent) -> Void) throws -> () -> Void
}

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

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

/**
 * A Swift base-protocol representing the OneBattery HybridObject.
 * Implement this protocol to create Swift-based instances of OneBattery.
 * ```swift
 * class HybridOneBattery : HybridOneBatterySpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridOneBatterySpec = HybridOneBatterySpec_protocol & HybridOneBatterySpec_base
