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

import Foundation
import NitroModules
import NitroModules

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

  // Methods
  func initConnection(config: InitConnectionConfig?) throws -> Promise<Bool>
  func endConnection() throws -> Promise<Bool>
  func fetchProducts(skus: [String], type: String) throws -> Promise<[NitroProduct]>
  func requestPurchase(request: NitroPurchaseRequest) throws -> Promise<RequestPurchaseResult?>
  func getAvailablePurchases(options: NitroAvailablePurchasesOptions?) throws -> Promise<[NitroPurchase]>
  func getActiveSubscriptions(subscriptionIds: [String]?) throws -> Promise<[NitroActiveSubscription]>
  func hasActiveSubscriptions(subscriptionIds: [String]?) throws -> Promise<Bool>
  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 getPromotedProductIOS() 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 deepLinkToSubscriptionsIOS() throws -> Promise<Bool>
  func isEligibleForIntroOfferIOS(groupID: String) throws -> Promise<Bool>
  func getReceiptDataIOS() throws -> Promise<String>
  func getReceiptIOS() throws -> Promise<String>
  func requestReceiptRefreshIOS() 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 verifyPurchaseWithProvider(params: NitroVerifyPurchaseWithProviderProps) throws -> Promise<NitroVerifyPurchaseWithProviderResult>
  func getStorefront() throws -> Promise<String>
  func deepLinkToSubscriptionsAndroid(options: NitroDeepLinkOptionsAndroid) throws -> Promise<Void>
  func checkAlternativeBillingAvailabilityAndroid() throws -> Promise<Bool>
  func showAlternativeBillingDialogAndroid() throws -> Promise<Bool>
  func createAlternativeBillingTokenAndroid(sku: String?) throws -> Promise<String?>
  func addUserChoiceBillingListenerAndroid(listener: @escaping (_ details: UserChoiceBillingDetails) -> Void) throws -> Void
  func removeUserChoiceBillingListenerAndroid(listener: @escaping (_ details: UserChoiceBillingDetails) -> Void) throws -> Void
  func addDeveloperProvidedBillingListenerAndroid(listener: @escaping (_ details: DeveloperProvidedBillingDetailsAndroid) -> Void) throws -> Void
  func removeDeveloperProvidedBillingListenerAndroid(listener: @escaping (_ details: DeveloperProvidedBillingDetailsAndroid) -> Void) throws -> Void
  func enableBillingProgramAndroid(program: BillingProgramAndroid) throws -> Void
  func isBillingProgramAvailableAndroid(program: BillingProgramAndroid) throws -> Promise<NitroBillingProgramAvailabilityResultAndroid>
  func createBillingProgramReportingDetailsAndroid(program: BillingProgramAndroid) throws -> Promise<NitroBillingProgramReportingDetailsAndroid>
  func launchExternalLinkAndroid(params: NitroLaunchExternalLinkParamsAndroid) throws -> Promise<Bool>
  func canPresentExternalPurchaseNoticeIOS() throws -> Promise<Bool>
  func presentExternalPurchaseNoticeSheetIOS() throws -> Promise<ExternalPurchaseNoticeResultIOS>
  func presentExternalPurchaseLinkIOS(url: String) throws -> Promise<ExternalPurchaseLinkResultIOS>
}

/// 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
