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

#pragma once

#include "HybridSourceProxySpec.hpp"

// Forward declaration of `HybridSourceProxySpec_cxx` to properly resolve imports.
namespace ReactNativeHealthkit { class HybridSourceProxySpec_cxx; }

// Forward declaration of `Source` to properly resolve imports.
namespace margelo::nitro::healthkit { struct Source; }

#include <string>
#include "Source.hpp"
#include <optional>

#include "ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp"

namespace margelo::nitro::healthkit {

  /**
   * The C++ part of HybridSourceProxySpec_cxx.swift.
   *
   * HybridSourceProxySpecSwift (C++) accesses HybridSourceProxySpec_cxx (Swift), and might
   * contain some additional bridging code for C++ <> Swift interop.
   *
   * Since this obviously introduces an overhead, I hope at some point in
   * the future, HybridSourceProxySpec_cxx can directly inherit from the C++ class HybridSourceProxySpec
   * to simplify the whole structure and memory management.
   */
  class HybridSourceProxySpecSwift: public virtual HybridSourceProxySpec {
  public:
    // Constructor from a Swift instance
    explicit HybridSourceProxySpecSwift(const ReactNativeHealthkit::HybridSourceProxySpec_cxx& swiftPart):
      HybridObject(HybridSourceProxySpec::TAG),
      _swiftPart(swiftPart) { }

  public:
    // Get the Swift part
    inline ReactNativeHealthkit::HybridSourceProxySpec_cxx& getSwiftPart() noexcept {
      return _swiftPart;
    }

  public:
    inline size_t getExternalMemorySize() noexcept override {
      return _swiftPart.getMemorySize();
    }
    bool equals(const std::shared_ptr<HybridObject>& other) override {
      if (auto otherCast = std::dynamic_pointer_cast<HybridSourceProxySpecSwift>(other)) {
        return _swiftPart.equals(otherCast->_swiftPart);
      }
      return false;
    }
    void dispose() noexcept override {
      _swiftPart.dispose();
    }
    std::string toString() override {
      return _swiftPart.toString();
    }

  public:
    // Properties
    inline std::string getBundleIdentifier() noexcept override {
      auto __result = _swiftPart.getBundleIdentifier();
      return __result;
    }

  public:
    // Methods
    inline Source toJSON(const std::optional<std::string>& key) override {
      auto __result = _swiftPart.toJSON(key);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    ReactNativeHealthkit::HybridSourceProxySpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::healthkit
