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

import NitroModules

/// See ``HybridNetDriverSpec``
public protocol HybridNetDriverSpec_protocol: HybridObject {
  // Properties
  

  // Methods
  func createSocket(id: String?) throws -> (any HybridNetSocketDriverSpec)
  func createServer() throws -> (any HybridNetServerDriverSpec)
  func createHttpParser(mode: Double) throws -> (any HybridHttpParserSpec)
  func createSecureContext(cert: String, key: String, passphrase: String?) throws -> Double
  func createEmptySecureContext() throws -> Double
  func addCACertToSecureContext(scId: Double, ca: String) throws -> Void
  func addContextToSecureContext(scId: Double, hostname: String, cert: String, key: String, passphrase: String?) throws -> Void
  func setPFXToSecureContext(scId: Double, pfx: ArrayBuffer, passphrase: String?) throws -> Void
  func setOCSPResponseToSecureContext(scId: Double, ocsp: ArrayBuffer) throws -> Void
  func getTicketKeys(scId: Double) throws -> ArrayBuffer?
  func setTicketKeys(scId: Double, keys: ArrayBuffer) throws -> Void
  func initWithConfig(config: NetConfig) throws -> Void
}

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

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

/**
 * A Swift base-protocol representing the NetDriver HybridObject.
 * Implement this protocol to create Swift-based instances of NetDriver.
 * ```swift
 * class HybridNetDriver : HybridNetDriverSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridNetDriverSpec = HybridNetDriverSpec_protocol & HybridNetDriverSpec_base
