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

import Foundation
import NitroModules
import NitroModules

/// See ``HybridTorchSpec``
public protocol HybridTorchSpec_protocol: HybridObject {
  // Properties
  var onStateChanged: ((_ state: Bool) -> Void)? { get set }
  var onLevelChanged: ((_ level: Double?) -> Void)? { get set }

  // Methods
  func on() throws -> Promise<Void>
  func off() throws -> Promise<Void>
  func toggle() throws -> Promise<Void>
  func setLevel(level: Double) throws -> Promise<Void>
  func getMaxLevel(dynamic: Bool?) throws -> Double?
}

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

/**
 * A Swift base-protocol representing the Torch HybridObject.
 * Implement this protocol to create Swift-based instances of Torch.
 * ```swift
 * class HybridTorch : HybridTorchSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridTorchSpec = HybridTorchSpec_protocol & HybridTorchSpec_base
