///
/// HybridMailMailboxSpec.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 `MailHeaderStruct` to properly resolve imports.
namespace margelo::nitro::mailengine { struct MailHeaderStruct; }
// Forward declaration of `MailFetchHeadersOptions` to properly resolve imports.
namespace margelo::nitro::mailengine { struct MailFetchHeadersOptions; }
// Forward declaration of `MailMessageStruct` to properly resolve imports.
namespace margelo::nitro::mailengine { struct MailMessageStruct; }
// Forward declaration of `MailFetchMessageOptions` to properly resolve imports.
namespace margelo::nitro::mailengine { struct MailFetchMessageOptions; }
// Forward declaration of `MailSearchCriteria` to properly resolve imports.
namespace margelo::nitro::mailengine { struct MailSearchCriteria; }
// Forward declaration of `MailNewMailEvent` to properly resolve imports.
namespace margelo::nitro::mailengine { struct MailNewMailEvent; }
// Forward declaration of `MailErrorStruct` to properly resolve imports.
namespace margelo::nitro::mailengine { struct MailErrorStruct; }

#include <string>
#include "MailHeaderStruct.hpp"
#include <vector>
#include <NitroModules/Promise.hpp>
#include "MailFetchHeadersOptions.hpp"
#include "MailMessageStruct.hpp"
#include "MailFetchMessageOptions.hpp"
#include <NitroModules/ArrayBuffer.hpp>
#include "MailSearchCriteria.hpp"
#include "MailNewMailEvent.hpp"
#include <functional>
#include "MailErrorStruct.hpp"

namespace margelo::nitro::mailengine {

  using namespace margelo::nitro;

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

      // Destructor
      ~HybridMailMailboxSpec() override = default;

    public:
      // Properties
      virtual std::string getPath() = 0;
      virtual double getExists() = 0;
      virtual double getUnseen() = 0;
      virtual double getUidNext() = 0;
      virtual double getUidValidity() = 0;

    public:
      // Methods
      virtual std::shared_ptr<Promise<std::vector<MailHeaderStruct>>> fetchHeaders(const MailFetchHeadersOptions& options) = 0;
      virtual std::shared_ptr<Promise<MailMessageStruct>> fetchMessage(double uid, const MailFetchMessageOptions& options) = 0;
      virtual std::shared_ptr<Promise<std::shared_ptr<ArrayBuffer>>> fetchAttachment(double uid, const std::string& partId) = 0;
      virtual std::shared_ptr<Promise<std::vector<double>>> search(const MailSearchCriteria& criteria) = 0;
      virtual std::shared_ptr<Promise<void>> addFlags(const std::vector<double>& uids, const std::vector<std::string>& flags) = 0;
      virtual std::shared_ptr<Promise<void>> removeFlags(const std::vector<double>& uids, const std::vector<std::string>& flags) = 0;
      virtual std::shared_ptr<Promise<void>> markSeen(const std::vector<double>& uids, bool seen) = 0;
      virtual std::shared_ptr<Promise<void>> moveMessages(const std::vector<double>& uids, const std::string& destinationPath) = 0;
      virtual std::shared_ptr<Promise<void>> copyMessages(const std::vector<double>& uids, const std::string& destinationPath) = 0;
      virtual std::shared_ptr<Promise<void>> deleteMessages(const std::vector<double>& uids, bool expunge) = 0;
      virtual std::shared_ptr<Promise<void>> startIdle(const std::function<void(const MailNewMailEvent& /* event */)>& onMail, const std::function<void(const MailErrorStruct& /* error */)>& onError) = 0;
      virtual std::shared_ptr<Promise<void>> stopIdle() = 0;
      virtual std::shared_ptr<Promise<void>> close() = 0;

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

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

} // namespace margelo::nitro::mailengine
