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

public extension SourceRevision {
  private typealias bridge = margelo.nitro.healthkit.bridge.swift

  /**
   * Create a new instance of `SourceRevision`.
   */
  init(source: (any HybridSourceProxySpec), version: String?, operatingSystemVersion: String, productType: String?) {
    self.init({ () -> bridge.std__shared_ptr_HybridSourceProxySpec_ in
      let __cxxWrapped = source.getCxxWrapper()
      return __cxxWrapped.getCxxPart()
    }(), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = version {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }(), std.string(operatingSystemVersion), { () -> bridge.std__optional_std__string_ in
      if let __unwrappedValue = productType {
        return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
      } else {
        return .init()
      }
    }())
  }

  @inline(__always)
  var source: (any HybridSourceProxySpec) {
    return { () -> any HybridSourceProxySpec in
      let __unsafePointer = bridge.get_std__shared_ptr_HybridSourceProxySpec_(self.__source)
      let __instance = HybridSourceProxySpec_cxx.fromUnsafe(__unsafePointer)
      return __instance.getHybridSourceProxySpec()
    }()
  }
  
  @inline(__always)
  var version: String? {
    return { () -> String? in
      if bridge.has_value_std__optional_std__string_(self.__version) {
        let __unwrapped = bridge.get_std__optional_std__string_(self.__version)
        return String(__unwrapped)
      } else {
        return nil
      }
    }()
  }
  
  @inline(__always)
  var operatingSystemVersion: String {
    return String(self.__operatingSystemVersion)
  }
  
  @inline(__always)
  var productType: String? {
    return { () -> String? in
      if bridge.has_value_std__optional_std__string_(self.__productType) {
        let __unwrapped = bridge.get_std__optional_std__string_(self.__productType)
        return String(__unwrapped)
      } else {
        return nil
      }
    }()
  }
}
