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

#pragma once

#include "HybridNitroInAppBrowserSpec.hpp"

// Forward declaration of `HybridNitroInAppBrowserSpec_cxx` to properly resolve imports.
namespace NitroInAppBrowser { class HybridNitroInAppBrowserSpec_cxx; }

// Forward declaration of `NitroInAppBrowserOptions` to properly resolve imports.
namespace margelo::nitro::nitroinappbrowser { struct NitroInAppBrowserOptions; }
// Forward declaration of `NitroInAppBrowserDismissButtonLabel` to properly resolve imports.
namespace margelo::nitro::nitroinappbrowser { enum class NitroInAppBrowserDismissButtonLabel; }

#include <NitroModules/Promise.hpp>
#include <string>
#include <optional>
#include "NitroInAppBrowserOptions.hpp"
#include "NitroInAppBrowserDismissButtonLabel.hpp"

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

namespace margelo::nitro::nitroinappbrowser {

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

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

  public:
    // Get memory pressure
    inline size_t getExternalMemorySize() noexcept override {
      return _swiftPart.getMemorySize();
    }

  public:
    // Properties
    

  public:
    // Methods
    inline std::shared_ptr<Promise<void>> open(const std::string& url, const std::optional<NitroInAppBrowserOptions>& options) override {
      auto __result = _swiftPart.open(url, options);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<void>> close() override {
      auto __result = _swiftPart.close();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    NitroInAppBrowser::HybridNitroInAppBrowserSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::nitroinappbrowser
