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

#pragma once

#include "HybridViewModelInstanceSpec.hpp"

// Forward declaration of `HybridViewModelInstanceSpec_cxx` to properly resolve imports.
namespace RNRive { class HybridViewModelInstanceSpec_cxx; }

// Forward declaration of `HybridViewModelNumberPropertySpec` to properly resolve imports.
namespace margelo::nitro::rive { class HybridViewModelNumberPropertySpec; }
// Forward declaration of `HybridViewModelStringPropertySpec` to properly resolve imports.
namespace margelo::nitro::rive { class HybridViewModelStringPropertySpec; }
// Forward declaration of `HybridViewModelBooleanPropertySpec` to properly resolve imports.
namespace margelo::nitro::rive { class HybridViewModelBooleanPropertySpec; }
// Forward declaration of `HybridViewModelColorPropertySpec` to properly resolve imports.
namespace margelo::nitro::rive { class HybridViewModelColorPropertySpec; }
// Forward declaration of `HybridViewModelEnumPropertySpec` to properly resolve imports.
namespace margelo::nitro::rive { class HybridViewModelEnumPropertySpec; }
// Forward declaration of `HybridViewModelTriggerPropertySpec` to properly resolve imports.
namespace margelo::nitro::rive { class HybridViewModelTriggerPropertySpec; }
// Forward declaration of `HybridViewModelImagePropertySpec` to properly resolve imports.
namespace margelo::nitro::rive { class HybridViewModelImagePropertySpec; }
// Forward declaration of `HybridViewModelListPropertySpec` to properly resolve imports.
namespace margelo::nitro::rive { class HybridViewModelListPropertySpec; }
// Forward declaration of `HybridViewModelArtboardPropertySpec` to properly resolve imports.
namespace margelo::nitro::rive { class HybridViewModelArtboardPropertySpec; }
// Forward declaration of `HybridViewModelInstanceSpec` to properly resolve imports.
namespace margelo::nitro::rive { class HybridViewModelInstanceSpec; }

#include <string>
#include <memory>
#include "HybridViewModelNumberPropertySpec.hpp"
#include <optional>
#include "HybridViewModelStringPropertySpec.hpp"
#include "HybridViewModelBooleanPropertySpec.hpp"
#include "HybridViewModelColorPropertySpec.hpp"
#include "HybridViewModelEnumPropertySpec.hpp"
#include "HybridViewModelTriggerPropertySpec.hpp"
#include "HybridViewModelImagePropertySpec.hpp"
#include "HybridViewModelListPropertySpec.hpp"
#include "HybridViewModelArtboardPropertySpec.hpp"
#include "HybridViewModelInstanceSpec.hpp"
#include <NitroModules/Promise.hpp>

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

namespace margelo::nitro::rive {

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

  public:
    // Get the Swift part
    inline RNRive::HybridViewModelInstanceSpec_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<HybridViewModelInstanceSpecSwift>(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 getInstanceName() noexcept override {
      auto __result = _swiftPart.getInstanceName();
      return __result;
    }

  public:
    // Methods
    inline std::optional<std::shared_ptr<HybridViewModelNumberPropertySpec>> numberProperty(const std::string& path) override {
      auto __result = _swiftPart.numberProperty(path);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::optional<std::shared_ptr<HybridViewModelStringPropertySpec>> stringProperty(const std::string& path) override {
      auto __result = _swiftPart.stringProperty(path);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::optional<std::shared_ptr<HybridViewModelBooleanPropertySpec>> booleanProperty(const std::string& path) override {
      auto __result = _swiftPart.booleanProperty(path);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::optional<std::shared_ptr<HybridViewModelColorPropertySpec>> colorProperty(const std::string& path) override {
      auto __result = _swiftPart.colorProperty(path);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::optional<std::shared_ptr<HybridViewModelEnumPropertySpec>> enumProperty(const std::string& path) override {
      auto __result = _swiftPart.enumProperty(path);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::optional<std::shared_ptr<HybridViewModelTriggerPropertySpec>> triggerProperty(const std::string& path) override {
      auto __result = _swiftPart.triggerProperty(path);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::optional<std::shared_ptr<HybridViewModelImagePropertySpec>> imageProperty(const std::string& path) override {
      auto __result = _swiftPart.imageProperty(path);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::optional<std::shared_ptr<HybridViewModelListPropertySpec>> listProperty(const std::string& path) override {
      auto __result = _swiftPart.listProperty(path);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::optional<std::shared_ptr<HybridViewModelArtboardPropertySpec>> artboardProperty(const std::string& path) override {
      auto __result = _swiftPart.artboardProperty(path);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::optional<std::shared_ptr<HybridViewModelInstanceSpec>> viewModel(const std::string& path) override {
      auto __result = _swiftPart.viewModel(path);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<std::optional<std::shared_ptr<HybridViewModelInstanceSpec>>>> viewModelAsync(const std::string& path) override {
      auto __result = _swiftPart.viewModelAsync(path);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline void replaceViewModel(const std::string& path, const std::shared_ptr<HybridViewModelInstanceSpec>& instance) override {
      auto __result = _swiftPart.replaceViewModel(path, instance);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }

  private:
    RNRive::HybridViewModelInstanceSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::rive
