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

#pragma once

#include "HybridOneClipboardSpec.hpp"

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

// Forward declaration of `ClipboardGetStringOptions` to properly resolve imports.
namespace margelo::nitro::one { struct ClipboardGetStringOptions; }
// Forward declaration of `ClipboardSetStringOptions` to properly resolve imports.
namespace margelo::nitro::one { struct ClipboardSetStringOptions; }
// Forward declaration of `ClipboardImageResult` to properly resolve imports.
namespace margelo::nitro::one { struct ClipboardImageResult; }
// Forward declaration of `ClipboardGetImageOptions` to properly resolve imports.
namespace margelo::nitro::one { struct ClipboardGetImageOptions; }

#include <string>
#include <NitroModules/Promise.hpp>
#include "ClipboardGetStringOptions.hpp"
#include <optional>
#include "ClipboardSetStringOptions.hpp"
#include "ClipboardImageResult.hpp"
#include "ClipboardGetImageOptions.hpp"
#include <vector>
#include <functional>

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

namespace margelo::nitro::one {

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

  public:
    // Get the Swift part
    inline One::HybridOneClipboardSpec_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<HybridOneClipboardSpecSwift>(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<std::string>> getString(const ClipboardGetStringOptions& options) override {
      auto __result = _swiftPart.getString(std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<bool>> setString(const std::string& text, const ClipboardSetStringOptions& options) override {
      auto __result = _swiftPart.setString(text, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<bool>> hasString() override {
      auto __result = _swiftPart.hasString();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<std::optional<ClipboardImageResult>>> getImage(const ClipboardGetImageOptions& options) override {
      auto __result = _swiftPart.getImage(std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<void>> setImage(const std::string& base64Image) override {
      auto __result = _swiftPart.setImage(base64Image);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<bool>> hasImage() override {
      auto __result = _swiftPart.hasImage();
      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::string>>> getUrl() override {
      auto __result = _swiftPart.getUrl();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<void>> setUrl(const std::string& url) override {
      auto __result = _swiftPart.setUrl(url);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<bool>> hasUrl() override {
      auto __result = _swiftPart.hasUrl();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline void setClipboardListener(const std::function<void(const std::vector<std::string>& /* contentTypes */)>& listener) override {
      auto __result = _swiftPart.setClipboardListener(listener);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void clearClipboardListener() override {
      auto __result = _swiftPart.clearClipboardListener();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }

  private:
    One::HybridOneClipboardSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::one
