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

import NitroModules

/**
 * Represents an instance of `NitroVerifyPurchaseWithProviderProps`, backed by a C++ struct.
 */
public typealias NitroVerifyPurchaseWithProviderProps = margelo.nitro.iap.NitroVerifyPurchaseWithProviderProps

public extension NitroVerifyPurchaseWithProviderProps {
  private typealias bridge = margelo.nitro.iap.bridge.swift

  /**
   * Create a new instance of `NitroVerifyPurchaseWithProviderProps`.
   */
  init(iapkit: Variant_NullType_NitroVerifyPurchaseWithIapkitProps?, provider: PurchaseVerificationProvider) {
    self.init({ () -> bridge.std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitProps__ in
      if let __unwrappedValue = iapkit {
        return bridge.create_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitProps__({ () -> bridge.std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitProps_ in
          switch __unwrappedValue {
            case .first(let __value):
              return bridge.create_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitProps_(margelo.nitro.NullType.null)
            case .second(let __value):
              return bridge.create_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitProps_(__value)
          }
        }().variant)
      } else {
        return .init()
      }
    }(), provider)
  }

  @inline(__always)
  var iapkit: Variant_NullType_NitroVerifyPurchaseWithIapkitProps? {
    return { () -> Variant_NullType_NitroVerifyPurchaseWithIapkitProps? in
      if bridge.has_value_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitProps__(self.__iapkit) {
        let __unwrapped = bridge.get_std__optional_std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitProps__(self.__iapkit)
        return { () -> Variant_NullType_NitroVerifyPurchaseWithIapkitProps in
          let __variant = bridge.std__variant_nitro__NullType__NitroVerifyPurchaseWithIapkitProps_(__unwrapped)
          switch __variant.index() {
            case 0:
              let __actual = __variant.get_0()
              return .first(NullType.null)
            case 1:
              let __actual = __variant.get_1()
              return .second(__actual)
            default:
              fatalError("Variant can never have index \(__variant.index())!")
          }
        }()
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var provider: PurchaseVerificationProvider {
    return self.__provider
  }
}
