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

import NitroModules

/// See ``HybridOneFetchSpec``
public protocol HybridOneFetchSpec_protocol: HybridObject {
  // Properties
  

  // Methods
  func start(id: Double, request: FetchNativeRequest, onResponse: @escaping (_ response: FetchNativeResponse) -> Void, onChunk: @escaping (_ chunk: ArrayBuffer) -> Void, onComplete: @escaping () -> Void, onError: @escaping (_ message: String) -> Void) throws -> Void
  func cancel(id: Double) throws -> Void
  func storeBlob(bytes: ArrayBuffer) throws -> String
}

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

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

/**
 * A Swift base-protocol representing the OneFetch HybridObject.
 * Implement this protocol to create Swift-based instances of OneFetch.
 * ```swift
 * class HybridOneFetch : HybridOneFetchSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridOneFetchSpec = HybridOneFetchSpec_protocol & HybridOneFetchSpec_base
