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

import NitroModules

/// See ``HybridNativeThreadSpec``
public protocol HybridNativeThreadSpec_protocol: HybridObject {
  // Properties
  var id: String { get }

  // Methods
  func runOnThread(task: @escaping () -> Void) throws -> Void
}

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

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

/**
 * A Swift base-protocol representing the NativeThread HybridObject.
 * Implement this protocol to create Swift-based instances of NativeThread.
 * ```swift
 * class HybridNativeThread : HybridNativeThreadSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridNativeThreadSpec = HybridNativeThreadSpec_protocol & HybridNativeThreadSpec_base
