///
/// NitroSubscriptionRenewalInfo.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 `NitroSubscriptionRenewalInfo`, backed by a C++ struct.
 */
public typealias NitroSubscriptionRenewalInfo = margelo.nitro.iap.NitroSubscriptionRenewalInfo

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

  /**
   * Create a new instance of `NitroSubscriptionRenewalInfo`.
   */
  init(autoRenewStatus: Bool, autoRenewPreference: String?, expirationReason: Double?, gracePeriodExpirationDate: Double?, currentProductID: String?, platform: String) {
    self.init(autoRenewStatus, { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = autoRenewPreference {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = expirationReason {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_double_ in
      if let __unwrappedValue = gracePeriodExpirationDate {
        return bridge.create_std__optional_double_(__unwrappedValue)
      } else {
        return .init()
      }
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = currentProductID {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), std.string(platform))
  }

  var autoRenewStatus: Bool {
    @inline(__always)
    get {
      return self.__autoRenewStatus
    }
    @inline(__always)
    set {
      self.__autoRenewStatus = newValue
    }
  }
  
  var autoRenewPreference: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__autoRenewPreference) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__autoRenewPreference)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__autoRenewPreference = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var expirationReason: Double? {
    @inline(__always)
    get {
      return self.__expirationReason.value
    }
    @inline(__always)
    set {
      self.__expirationReason = { () -> bridge.std__optional_double_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_double_(__unwrappedValue)
        } else {
          return .init()
        }
      }()
    }
  }
  
  var gracePeriodExpirationDate: Double? {
    @inline(__always)
    get {
      return self.__gracePeriodExpirationDate.value
    }
    @inline(__always)
    set {
      self.__gracePeriodExpirationDate = { () -> bridge.std__optional_double_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_double_(__unwrappedValue)
        } else {
          return .init()
        }
      }()
    }
  }
  
  var currentProductID: String? {
    @inline(__always)
    get {
      return { () -> String? in
        if bridge.has_value_std__optional_std__string_(self.__currentProductID) {
          let __unwrapped = bridge.get_std__optional_std__string_(self.__currentProductID)
          return String(__unwrapped)
        } else {
          return nil
        }
      }()
    }
    @inline(__always)
    set {
      self.__currentProductID = { () -> bridge.std__optional_std__string_ in
        if let __unwrappedValue = newValue {
          return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
        } else {
          return .init()
        }
      }()
    }
  }
  
  var platform: String {
    @inline(__always)
    get {
      return String(self.__platform)
    }
    @inline(__always)
    set {
      self.__platform = std.string(newValue)
    }
  }
}
