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

import NitroModules

/// See ``HybridOneBackgroundTasksSpec``
public protocol HybridOneBackgroundTasksSpec_protocol: HybridObject {
  // Properties


  // Methods
  func submit(identifier: String, earliestBeginDateMs: Double?, requiresNetworkConnectivity: Bool?, requiresExternalPower: Bool?) throws -> Promise<Void>
  func getPending() throws -> Promise<[PendingBackgroundTask]>
  func cancel(identifier: String) throws -> Void
  func addTaskListener(onLaunch: @escaping (_ invocation: BackgroundTaskInvocation) -> Void, onExpire: @escaping (_ executionId: String) -> Void) throws -> () -> Void
  func complete(executionId: String, success: Bool) throws -> Void
}

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

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

/**
 * A Swift base-protocol representing the OneBackgroundTasks HybridObject.
 * Implement this protocol to create Swift-based instances of OneBackgroundTasks.
 * ```swift
 * class HybridOneBackgroundTasks : HybridOneBackgroundTasksSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridOneBackgroundTasksSpec = HybridOneBackgroundTasksSpec_protocol & HybridOneBackgroundTasksSpec_base
