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

import NitroModules

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

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

  /**
   * Create a new instance of `NitroProduct`.
   */
  init(id: String, title: String, description: String, type: String, displayName: String?, displayPrice: String?, currency: String?, price: Double?, platform: IapPlatform, typeIOS: String?, isFamilyShareableIOS: Bool?, jsonRepresentationIOS: String?, discountsIOS: String?, introductoryPriceIOS: String?, introductoryPriceAsAmountIOS: Double?, introductoryPriceNumberOfPeriodsIOS: Double?, introductoryPricePaymentModeIOS: PaymentModeIOS, introductoryPriceSubscriptionPeriodIOS: String?, subscriptionPeriodNumberIOS: Double?, subscriptionPeriodUnitIOS: String?, nameAndroid: String?, originalPriceAndroid: String?, originalPriceAmountMicrosAndroid: Double?, introductoryPriceCyclesAndroid: Double?, introductoryPricePeriodAndroid: String?, introductoryPriceValueAndroid: Double?, subscriptionPeriodAndroid: String?, freeTrialPeriodAndroid: String?, subscriptionOfferDetailsAndroid: String?, oneTimePurchaseOfferDetailsAndroid: [NitroOneTimePurchaseOfferDetail]?) {
    self.init(std.string(id), std.string(title), std.string(description), std.string(type), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = displayName {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = displayPrice {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = currency {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = price {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), platform, { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = typeIOS {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_bool_ in
      if let __unwrappedValue = isFamilyShareableIOS {
        return bridge.create_std__optional_bool_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = jsonRepresentationIOS {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = discountsIOS {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = introductoryPriceIOS {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = introductoryPriceAsAmountIOS {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = introductoryPriceNumberOfPeriodsIOS {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), introductoryPricePaymentModeIOS, { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = introductoryPriceSubscriptionPeriodIOS {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = subscriptionPeriodNumberIOS {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = subscriptionPeriodUnitIOS {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = nameAndroid {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = originalPriceAndroid {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = originalPriceAmountMicrosAndroid {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = introductoryPriceCyclesAndroid {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = introductoryPricePeriodAndroid {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = introductoryPriceValueAndroid {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = subscriptionPeriodAndroid {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = freeTrialPeriodAndroid {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = subscriptionOfferDetailsAndroid {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__vector_NitroOneTimePurchaseOfferDetail__ in
      if let __unwrappedValue = oneTimePurchaseOfferDetailsAndroid {
        return bridge.create_std__optional_std__vector_NitroOneTimePurchaseOfferDetail__({ () -> bridge.std__vector_NitroOneTimePurchaseOfferDetail_ in
          var __vector = bridge.create_std__vector_NitroOneTimePurchaseOfferDetail_(__unwrappedValue.count)
          for __item in __unwrappedValue {
            __vector.push_back(__item)
          }
          return __vector
        }())
      } else {
        return .init()
      }
    }())
  }

  var id: String {
    @inline(__always)
    get {
      return String(self.__id)
    }
    @inline(__always)
    set {
      self.__id = std.string(newValue)
    }
  }
  
  var title: String {
    @inline(__always)
    get {
      return String(self.__title)
    }
    @inline(__always)
    set {
      self.__title = std.string(newValue)
    }
  }
  
  var description: String {
    @inline(__always)
    get {
      return String(self.__description)
    }
    @inline(__always)
    set {
      self.__description = std.string(newValue)
    }
  }
  
  var type: String {
    @inline(__always)
    get {
      return String(self.__type)
    }
    @inline(__always)
    set {
      self.__type = std.string(newValue)
    }
  }
  
  var displayName: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__displayName) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__displayName)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__displayName = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var displayPrice: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__displayPrice) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__displayPrice)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__displayPrice = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var currency: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__currency) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__currency)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__currency = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var price: Double? {
    @inline(__always)
    get {
      return self.__price.value
    }
    @inline(__always)
    set {
      self.__price = { () -> bridge.std__optional_double_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_double_(__unwrappedValue)
        } else {
          return .init()
        }
      }()
    }
  }
  
  var platform: IapPlatform {
    @inline(__always)
    get {
      return self.__platform
    }
    @inline(__always)
    set {
      self.__platform = newValue
    }
  }
  
  var typeIOS: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__typeIOS) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__typeIOS)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__typeIOS = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var isFamilyShareableIOS: Bool? {
    @inline(__always)
    get {
      return { () -> Bool? in
        if bridge.has_value_std__optional_bool_(self.__isFamilyShareableIOS) {
          let __unwrapped = bridge.get_std__optional_bool_(self.__isFamilyShareableIOS)
          return __unwrapped
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__isFamilyShareableIOS = { () -> bridge.std__optional_bool_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_bool_(__unwrappedValue)
        } else {
          return .init()
        }
      }()
    }
  }
  
  var jsonRepresentationIOS: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__jsonRepresentationIOS) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__jsonRepresentationIOS)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__jsonRepresentationIOS = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var discountsIOS: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__discountsIOS) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__discountsIOS)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__discountsIOS = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var introductoryPriceIOS: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__introductoryPriceIOS) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__introductoryPriceIOS)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__introductoryPriceIOS = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var introductoryPriceAsAmountIOS: Double? {
    @inline(__always)
    get {
      return self.__introductoryPriceAsAmountIOS.value
    }
    @inline(__always)
    set {
      self.__introductoryPriceAsAmountIOS = { () -> bridge.std__optional_double_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_double_(__unwrappedValue)
        } else {
          return .init()
        }
      }()
    }
  }
  
  var introductoryPriceNumberOfPeriodsIOS: Double? {
    @inline(__always)
    get {
      return self.__introductoryPriceNumberOfPeriodsIOS.value
    }
    @inline(__always)
    set {
      self.__introductoryPriceNumberOfPeriodsIOS = { () -> bridge.std__optional_double_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_double_(__unwrappedValue)
        } else {
          return .init()
        }
      }()
    }
  }
  
  var introductoryPricePaymentModeIOS: PaymentModeIOS {
    @inline(__always)
    get {
      return self.__introductoryPricePaymentModeIOS
    }
    @inline(__always)
    set {
      self.__introductoryPricePaymentModeIOS = newValue
    }
  }
  
  var introductoryPriceSubscriptionPeriodIOS: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__introductoryPriceSubscriptionPeriodIOS) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__introductoryPriceSubscriptionPeriodIOS)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__introductoryPriceSubscriptionPeriodIOS = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var subscriptionPeriodNumberIOS: Double? {
    @inline(__always)
    get {
      return self.__subscriptionPeriodNumberIOS.value
    }
    @inline(__always)
    set {
      self.__subscriptionPeriodNumberIOS = { () -> bridge.std__optional_double_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_double_(__unwrappedValue)
        } else {
          return .init()
        }
      }()
    }
  }
  
  var subscriptionPeriodUnitIOS: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__subscriptionPeriodUnitIOS) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__subscriptionPeriodUnitIOS)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__subscriptionPeriodUnitIOS = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var nameAndroid: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__nameAndroid) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__nameAndroid)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__nameAndroid = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var originalPriceAndroid: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__originalPriceAndroid) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__originalPriceAndroid)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__originalPriceAndroid = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var originalPriceAmountMicrosAndroid: Double? {
    @inline(__always)
    get {
      return self.__originalPriceAmountMicrosAndroid.value
    }
    @inline(__always)
    set {
      self.__originalPriceAmountMicrosAndroid = { () -> bridge.std__optional_double_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_double_(__unwrappedValue)
        } else {
          return .init()
        }
      }()
    }
  }
  
  var introductoryPriceCyclesAndroid: Double? {
    @inline(__always)
    get {
      return self.__introductoryPriceCyclesAndroid.value
    }
    @inline(__always)
    set {
      self.__introductoryPriceCyclesAndroid = { () -> bridge.std__optional_double_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_double_(__unwrappedValue)
        } else {
          return .init()
        }
      }()
    }
  }
  
  var introductoryPricePeriodAndroid: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__introductoryPricePeriodAndroid) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__introductoryPricePeriodAndroid)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__introductoryPricePeriodAndroid = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var introductoryPriceValueAndroid: Double? {
    @inline(__always)
    get {
      return self.__introductoryPriceValueAndroid.value
    }
    @inline(__always)
    set {
      self.__introductoryPriceValueAndroid = { () -> bridge.std__optional_double_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_double_(__unwrappedValue)
        } else {
          return .init()
        }
      }()
    }
  }
  
  var subscriptionPeriodAndroid: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__subscriptionPeriodAndroid) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__subscriptionPeriodAndroid)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__subscriptionPeriodAndroid = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var freeTrialPeriodAndroid: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__freeTrialPeriodAndroid) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__freeTrialPeriodAndroid)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__freeTrialPeriodAndroid = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var subscriptionOfferDetailsAndroid: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__subscriptionOfferDetailsAndroid) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__subscriptionOfferDetailsAndroid)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__subscriptionOfferDetailsAndroid = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var oneTimePurchaseOfferDetailsAndroid: [NitroOneTimePurchaseOfferDetail]? {
    @inline(__always)
    get {
      return { () -> [NitroOneTimePurchaseOfferDetail]? in
        if bridge.has_value_std__optional_std__vector_NitroOneTimePurchaseOfferDetail__(self.__oneTimePurchaseOfferDetailsAndroid) {
          let __unwrapped = bridge.get_std__optional_std__vector_NitroOneTimePurchaseOfferDetail__(self.__oneTimePurchaseOfferDetailsAndroid)
          return __unwrapped.map({ __item in __item })
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__oneTimePurchaseOfferDetailsAndroid = { () -> bridge.std__optional_std__vector_NitroOneTimePurchaseOfferDetail__ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__vector_NitroOneTimePurchaseOfferDetail__({ () -> bridge.std__vector_NitroOneTimePurchaseOfferDetail_ in
            var __vector = bridge.create_std__vector_NitroOneTimePurchaseOfferDetail_(__unwrappedValue.count)
            for __item in __unwrappedValue {
              __vector.push_back(__item)
            }
            return __vector
          }())
        } else {
          return .init()
        }
      }()
    }
  }
}
