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

#pragma once

#include "HybridFileSystemSpec.hpp"

// Forward declaration of `HybridFileSystemSpec_cxx` to properly resolve imports.
namespace FastIO { class HybridFileSystemSpec_cxx; }

// Forward declaration of `Metadata` to properly resolve imports.
namespace margelo::nitro::fastio { struct Metadata; }
// Forward declaration of `WellKnownDirectory` to properly resolve imports.
namespace margelo::nitro::fastio { enum class WellKnownDirectory; }
// Forward declaration of `NativeFilePickerOptions` to properly resolve imports.
namespace margelo::nitro::fastio { struct NativeFilePickerOptions; }

#include "Metadata.hpp"
#include <string>
#include "WellKnownDirectory.hpp"
#include <NitroModules/Promise.hpp>
#include <vector>
#include <optional>
#include "NativeFilePickerOptions.hpp"

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

namespace margelo::nitro::fastio {

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

  public:
    // Get the Swift part
    inline FastIO::HybridFileSystemSpec_cxx getSwiftPart() noexcept { return _swiftPart; }

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

  public:
    // Properties
    

  public:
    // Methods
    inline Metadata getMetadata(const std::string& path) override {
      auto __result = _swiftPart.getMetadata(path);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::string getWellKnownDirectoryPath(WellKnownDirectory directory) override {
      auto __result = _swiftPart.getWellKnownDirectoryPath(static_cast<int>(directory));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<std::vector<std::string>>> showOpenFilePicker(const std::optional<NativeFilePickerOptions>& options) override {
      auto __result = _swiftPart.showOpenFilePicker(options);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    FastIO::HybridFileSystemSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::fastio
