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

import NitroModules

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

  // Methods
  func initConnection(config: Variant_NullType_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<Variant_NullType_String>
  func requestPromotedProductIOS() throws -> Promise<Variant_NullType_NitroProduct>
  func getPromotedProductIOS() throws -> Promise<Variant_NullType_NitroProduct>
  func buyPromotedProductIOS() throws -> Promise<Void>
  func presentCodeRedemptionSheetIOS() throws -> Promise<Bool>
  func clearTransactionIOS() throws -> Promise<Void>
  func beginRefundRequestIOS(sku: String) throws -> Promise<Variant_NullType_String>
  func subscriptionStatusIOS(sku: String) throws -> Promise<Variant_NullType__NitroSubscriptionStatus_>
  func currentEntitlementIOS(sku: String) throws -> Promise<Variant_NullType_NitroPurchase>
  func latestTransactionIOS(sku: String) throws -> Promise<Variant_NullType_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<Variant_NullType_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: Variant_NullType_String?) throws -> Promise<Variant_NullType_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>
  func isEligibleForExternalPurchaseCustomLinkIOS() throws -> Promise<Bool>
  func getExternalPurchaseCustomLinkTokenIOS(tokenType: ExternalPurchaseCustomLinkTokenTypeIOS) throws -> Promise<ExternalPurchaseCustomLinkTokenResultIOS>
  func showExternalPurchaseCustomLinkNoticeIOS(noticeType: ExternalPurchaseCustomLinkNoticeTypeIOS) throws -> Promise<ExternalPurchaseCustomLinkNoticeResultIOS>
}

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

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