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

import Foundation
import NitroModules

/// See ``HybridRnIapSpec``
public protocol HybridRnIapSpec_protocol: HybridObject {
  // Properties
  

  // Methods
  func initConnection() throws -> Promise<Bool>
  func endConnection() throws -> Promise<Bool>
  func fetchProducts(skus: [String], type: String) throws -> Promise<[NitroProduct]>
  func requestPurchase(request: NitroPurchaseRequest) throws -> Promise<Void>
  func getAvailablePurchases(options: NitroAvailablePurchasesOptions?) throws -> Promise<[NitroPurchase]>
  func finishTransaction(params: NitroFinishTransactionParams) throws -> Promise<Variant_Bool_NitroPurchaseResult>
  func addPurchaseUpdatedListener(listener: @escaping (_ purchase: NitroPurchase) -> Void) throws -> Void
  func addPurchaseErrorListener(listener: @escaping (_ error: NitroPurchaseResult) -> Void) throws -> Void
  func removePurchaseUpdatedListener(listener: @escaping (_ purchase: NitroPurchase) -> Void) throws -> Void
  func removePurchaseErrorListener(listener: @escaping (_ error: NitroPurchaseResult) -> Void) throws -> Void
  func addPromotedProductListenerIOS(listener: @escaping (_ product: NitroProduct) -> Void) throws -> Void
  func removePromotedProductListenerIOS(listener: @escaping (_ product: NitroProduct) -> Void) throws -> Void
  func getStorefrontIOS() throws -> Promise<String>
  func getAppTransactionIOS() throws -> Promise<String?>
  func requestPromotedProductIOS() throws -> Promise<NitroProduct?>
  func buyPromotedProductIOS() throws -> Promise<Void>
  func presentCodeRedemptionSheetIOS() throws -> Promise<Bool>
  func clearTransactionIOS() throws -> Promise<Void>
  func beginRefundRequestIOS(sku: String) throws -> Promise<String?>
  func subscriptionStatusIOS(sku: String) throws -> Promise<[NitroSubscriptionStatus]?>
  func currentEntitlementIOS(sku: String) throws -> Promise<NitroPurchase?>
  func latestTransactionIOS(sku: String) throws -> Promise<NitroPurchase?>
  func getPendingTransactionsIOS() throws -> Promise<[NitroPurchase]>
  func syncIOS() throws -> Promise<Bool>
  func showManageSubscriptionsIOS() throws -> Promise<[NitroPurchase]>
  func isEligibleForIntroOfferIOS(groupID: String) throws -> Promise<Bool>
  func getReceiptDataIOS() throws -> Promise<String>
  func isTransactionVerifiedIOS(sku: String) throws -> Promise<Bool>
  func getTransactionJwsIOS(sku: String) throws -> Promise<String?>
  func validateReceipt(params: NitroReceiptValidationParams) throws -> Promise<Variant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid>
  func getStorefrontAndroid() throws -> Promise<String>
  func deepLinkToSubscriptionsAndroid(options: NitroDeepLinkOptionsAndroid) throws -> Promise<Void>
}

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

/**
 * A Swift base-protocol representing the RnIap HybridObject.
 * Implement this protocol to create Swift-based instances of RnIap.
 * ```swift
 * class HybridRnIap : HybridRnIapSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridRnIapSpec = HybridRnIapSpec_protocol & HybridRnIapSpec_base
