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

#pragma once

#if __has_include(<NitroModules/HybridObject.hpp>)
#include <NitroModules/HybridObject.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif

// Forward declaration of `HybridMmfileSpec` to properly resolve imports.
namespace margelo::nitro::mmfile { class HybridMmfileSpec; }
// Forward declaration of `HybridEncryptedMmfileSpec` to properly resolve imports.
namespace margelo::nitro::mmfile { class HybridEncryptedMmfileSpec; }
// Forward declaration of `ReadDirItem` to properly resolve imports.
namespace margelo::nitro::mmfile { struct ReadDirItem; }

#include <string>
#include <memory>
#include "HybridMmfileSpec.hpp"
#include <optional>
#include "HybridEncryptedMmfileSpec.hpp"
#include <NitroModules/ArrayBuffer.hpp>
#include "ReadDirItem.hpp"
#include <vector>
#include <NitroModules/Promise.hpp>

namespace margelo::nitro::mmfile {

  using namespace margelo::nitro;

  /**
   * An abstract base class for `MmfilePackage`
   * Inherit this class to create instances of `HybridMmfilePackageSpec` in C++.
   * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
   * @example
   * ```cpp
   * class HybridMmfilePackage: public HybridMmfilePackageSpec {
   * public:
   *   HybridMmfilePackage(...): HybridObject(TAG) { ... }
   *   // ...
   * };
   * ```
   */
  class HybridMmfilePackageSpec: public virtual HybridObject {
    public:
      // Constructor
      explicit HybridMmfilePackageSpec(): HybridObject(TAG) { }

      // Destructor
      ~HybridMmfilePackageSpec() override = default;

    public:
      // Properties
      virtual std::string getBaseDirectory() = 0;
      virtual void setBaseDirectory(const std::string& baseDirectory) = 0;

    public:
      // Methods
      virtual std::shared_ptr<HybridMmfileSpec> openMmfile(const std::string& path, std::optional<bool> readOnly) = 0;
      virtual std::shared_ptr<HybridEncryptedMmfileSpec> openEncryptedMmfile(const std::string& path, const std::shared_ptr<ArrayBuffer>& key, std::optional<bool> readOnly) = 0;
      virtual bool fileExists(const std::string& path) = 0;
      virtual double getFileSize(const std::string& path) = 0;
      virtual double getEncryptedFileSize(const std::string& path) = 0;
      virtual std::shared_ptr<Promise<std::vector<ReadDirItem>>> readDir(const std::string& path) = 0;
      virtual std::vector<ReadDirItem> readDirSync(const std::string& path) = 0;
      virtual std::shared_ptr<Promise<void>> unlink(const std::string& path) = 0;
      virtual void unlinkSync(const std::string& path) = 0;

    protected:
      // Hybrid Setup
      void loadHybridMethods() override;

    protected:
      // Tag for logging
      static constexpr auto TAG = "MmfilePackage";
  };

} // namespace margelo::nitro::mmfile
