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

import NitroModules

/// See ``HybridCoreModuleSpec``
public protocol HybridCoreModuleSpec_protocol: HybridObject {
  // Properties
  

  // Methods
  func enableBackgroundDelivery(typeIdentifier: ObjectTypeIdentifier, updateFrequency: UpdateFrequency) throws -> Promise<Bool>
  func disableBackgroundDelivery(typeIdentifier: ObjectTypeIdentifier) throws -> Promise<Bool>
  func disableAllBackgroundDelivery() throws -> Promise<Bool>
  func configureBackgroundTypes(typeIdentifiers: [String], updateFrequency: UpdateFrequency) throws -> Promise<Bool>
  func clearBackgroundTypes() throws -> Promise<Bool>
  func isHealthDataAvailable() throws -> Bool
  func isHealthDataAvailableAsync() throws -> Promise<Bool>
  func isProtectedDataAvailable() throws -> Bool
  func isProtectedDataAvailableAsync() throws -> Promise<Bool>
  func currentAppSource() throws -> (any HybridSourceProxySpec)
  func getPreferredUnits(identifiers: [QuantityTypeIdentifier], forceUpdate: Bool?) throws -> Promise<[IdentifierWithUnit]>
  func querySources(identifier: SampleTypeIdentifier, filter: FilterForSamples?) throws -> Promise<[(any HybridSourceProxySpec)]>
  func subscribeToObserverQuery(typeIdentifier: SampleTypeIdentifier, callback: @escaping (_ args: OnChangeCallbackArgs) -> Void) throws -> String
  func unsubscribeQuery(queryId: String) throws -> Bool
  func unsubscribeQueryAsync(queryId: String) throws -> Promise<Bool>
  func unsubscribeQueries(queryIds: [String]) throws -> Double
  func unsubscribeQueriesAsync(queryIds: [String]) throws -> Promise<Double>
  func authorizationStatusFor(type: ObjectTypeIdentifier) throws -> AuthorizationStatus
  func getRequestStatusForAuthorization(toCheck: AuthDataTypes) throws -> Promise<AuthorizationRequestStatus>
  func requestAuthorization(toRequest: AuthDataTypes) throws -> Promise<Bool>
  func requestPerObjectReadAuthorization(typeIdentifier: PerObjectTypeIdentifier) throws -> Promise<Void>
  func deleteObjects(objectTypeIdentifier: SampleTypeIdentifierWriteable, filter: FilterForSamples) throws -> Promise<Double>
  func isObjectTypeAvailable(objectTypeIdentifier: ObjectTypeIdentifier) throws -> Bool
  func areObjectTypesAvailable(objectTypeIdentifiers: [ObjectTypeIdentifier]) throws -> Dictionary<String, Bool>
  func areObjectTypesAvailableAsync(objectTypeIdentifiers: [ObjectTypeIdentifier]) throws -> Promise<Dictionary<String, Bool>>
  func isObjectTypeAvailableAsync(objectTypeIdentifier: ObjectTypeIdentifier) throws -> Promise<Bool>
}

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

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

/**
 * A Swift base-protocol representing the CoreModule HybridObject.
 * Implement this protocol to create Swift-based instances of CoreModule.
 * ```swift
 * class HybridCoreModule : HybridCoreModuleSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridCoreModuleSpec = HybridCoreModuleSpec_protocol & HybridCoreModuleSpec_base
