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

#pragma once

#include "HybridOneQuickActionsSpec.hpp"

// Forward declaration of `HybridOneQuickActionsSpec_cxx` to properly resolve imports.
namespace One { class HybridOneQuickActionsSpec_cxx; }

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

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

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

namespace margelo::nitro::one {

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

  public:
    // Get the Swift part
    inline One::HybridOneQuickActionsSpec_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<HybridOneQuickActionsSpecSwift>(other)) {
        return _swiftPart.equals(otherCast->_swiftPart);
      }
      return false;
    }
    void dispose() noexcept override {
      _swiftPart.dispose();
    }
    std::string toString() override {
      return _swiftPart.toString();
    }

  public:
    // Properties


  public:
    // Methods
    inline std::shared_ptr<Promise<void>> setItems(const std::vector<QuickActionItem>& items) override {
      auto __result = _swiftPart.setItems(items);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<std::vector<QuickActionItem>>> getItems() override {
      auto __result = _swiftPart.getItems();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::optional<std::string> getInitialAction() override {
      auto __result = _swiftPart.getInitialAction();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline void clearInitialAction() override {
      auto __result = _swiftPart.clearInitialAction();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline std::function<void()> addListener(const std::function<void(const std::string& /* value */)>& listener) override {
      auto __result = _swiftPart.addListener(listener);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    One::HybridOneQuickActionsSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::one
