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

import NitroModules

/// See ``HybridMailAccountSpec``
public protocol HybridMailAccountSpec_protocol: HybridObject {
  // Properties
  var id: String { get }
  var isConnected: Bool { get }

  // Methods
  func listMailboxes() throws -> Promise<[MailMailboxInfo]>
  func openMailbox(path: String, readOnly: Bool) throws -> Promise<(any HybridMailMailboxSpec)>
  func createMailbox(path: String) throws -> Promise<Void>
  func deleteMailbox(path: String) throws -> Promise<Void>
  func renameMailbox(path: String, newPath: String) throws -> Promise<Void>
  func send(message: MailOutgoingMessage) throws -> Promise<Void>
  func noop() throws -> Promise<Void>
  func disconnect() throws -> Promise<Void>
}

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

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

/**
 * A Swift base-protocol representing the MailAccount HybridObject.
 * Implement this protocol to create Swift-based instances of MailAccount.
 * ```swift
 * class HybridMailAccount : HybridMailAccountSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridMailAccountSpec = HybridMailAccountSpec_protocol & HybridMailAccountSpec_base
