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

import NitroModules

/// See ``HybridMailMailboxSpec``
public protocol HybridMailMailboxSpec_protocol: HybridObject {
  // Properties
  var path: String { get }
  var exists: Double { get }
  var unseen: Double { get }
  var uidNext: Double { get }
  var uidValidity: Double { get }

  // Methods
  func fetchHeaders(options: MailFetchHeadersOptions) throws -> Promise<[MailHeaderStruct]>
  func fetchMessage(uid: Double, options: MailFetchMessageOptions) throws -> Promise<MailMessageStruct>
  func fetchAttachment(uid: Double, partId: String) throws -> Promise<ArrayBuffer>
  func search(criteria: MailSearchCriteria) throws -> Promise<[Double]>
  func addFlags(uids: [Double], flags: [String]) throws -> Promise<Void>
  func removeFlags(uids: [Double], flags: [String]) throws -> Promise<Void>
  func markSeen(uids: [Double], seen: Bool) throws -> Promise<Void>
  func moveMessages(uids: [Double], destinationPath: String) throws -> Promise<Void>
  func copyMessages(uids: [Double], destinationPath: String) throws -> Promise<Void>
  func deleteMessages(uids: [Double], expunge: Bool) throws -> Promise<Void>
  func startIdle(onMail: @escaping (_ event: MailNewMailEvent) -> Void, onError: @escaping (_ error: MailErrorStruct) -> Void) throws -> Promise<Void>
  func stopIdle() throws -> Promise<Void>
  func close() throws -> Promise<Void>
}

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

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

/**
 * A Swift base-protocol representing the MailMailbox HybridObject.
 * Implement this protocol to create Swift-based instances of MailMailbox.
 * ```swift
 * class HybridMailMailbox : HybridMailMailboxSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridMailMailboxSpec = HybridMailMailboxSpec_protocol & HybridMailMailboxSpec_base
