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

#pragma once

#include "HybridScreenshotManagerSpec.hpp"

// Forward declaration of `HybridScreenshotManagerSpec_cxx` to properly resolve imports.
namespace ScreenshotManager { class HybridScreenshotManagerSpec_cxx; }



#include <functional>

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

namespace margelo::nitro::screenshotmanager {

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

  public:
    // Get the Swift part
    inline ScreenshotManager::HybridScreenshotManagerSpec_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<HybridScreenshotManagerSpecSwift>(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 void enabled(bool value) override {
      auto __result = _swiftPart.enabled(std::forward<decltype(value)>(value));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline std::function<void()> addListener(const std::function<void()>& 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:
    ScreenshotManager::HybridScreenshotManagerSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::screenshotmanager
