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

#pragma once

#include "HybridModelManagerSpec.hpp"

// Forward declaration of `HybridModelManagerSpec_cxx` to properly resolve imports.
namespace MLXReactNative { class HybridModelManagerSpec_cxx; }



#include <string>
#include <NitroModules/Promise.hpp>
#include <functional>
#include <vector>

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

namespace margelo::nitro::mlxreactnative {

  /**
   * The C++ part of HybridModelManagerSpec_cxx.swift.
   *
   * HybridModelManagerSpecSwift (C++) accesses HybridModelManagerSpec_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, HybridModelManagerSpec_cxx can directly inherit from the C++ class HybridModelManagerSpec
   * to simplify the whole structure and memory management.
   */
  class HybridModelManagerSpecSwift: public virtual HybridModelManagerSpec {
  public:
    // Constructor from a Swift instance
    explicit HybridModelManagerSpecSwift(const MLXReactNative::HybridModelManagerSpec_cxx& swiftPart):
      HybridObject(HybridModelManagerSpec::TAG),
      _swiftPart(swiftPart) { }

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

  public:
    inline size_t getExternalMemorySize() noexcept override {
      return _swiftPart.getMemorySize();
    }
    void dispose() noexcept override {
      _swiftPart.dispose();
    }
    std::string toString() override {
      return _swiftPart.toString();
    }

  public:
    // Properties
    inline bool getDebug() noexcept override {
      return _swiftPart.getDebug();
    }
    inline void setDebug(bool debug) noexcept override {
      _swiftPart.setDebug(std::forward<decltype(debug)>(debug));
    }

  public:
    // Methods
    inline std::shared_ptr<Promise<std::string>> download(const std::string& modelId, const std::function<void(double /* progress */)>& progressCallback) override {
      auto __result = _swiftPart.download(modelId, progressCallback);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<bool>> isDownloaded(const std::string& modelId) override {
      auto __result = _swiftPart.isDownloaded(modelId);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<std::vector<std::string>>> getDownloadedModels() override {
      auto __result = _swiftPart.getDownloadedModels();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<void>> deleteModel(const std::string& modelId) override {
      auto __result = _swiftPart.deleteModel(modelId);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<std::string>> getModelPath(const std::string& modelId) override {
      auto __result = _swiftPart.getModelPath(modelId);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    MLXReactNative::HybridModelManagerSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::mlxreactnative
