// This is a generated file, modify: generate/templates/templates/class_header.h

#ifndef GITINDEXREUCENTRY_H
#define GITINDEXREUCENTRY_H
#include <nan.h>
#include <string>
#include <utility>
#include <sstream>

#include "async_baton.h"
#include "async_worker.h"
#include "cleanup_handle.h"
#include "context.h"
#include "lock_master.h"
#include "nodegit_wrapper.h"
#include "promise_completion.h"
#include "reference_counter.h"

extern "C" {
#include <git2.h>
#include <git2/sys/index.h>
}

#include "../include/typedefs.h"

#include "../include/oid.h"
#include "../include/index.h"

using namespace node;
using namespace v8;

class GitIndexReucEntry;
 
struct GitIndexReucEntryTraits {
  typedef GitIndexReucEntry cppClass;
  typedef git_index_reuc_entry cType;
 
  static const bool isDuplicable = false;
  static void duplicate(git_index_reuc_entry **dest, git_index_reuc_entry *src) {
     Nan::ThrowError("duplicate called on GitIndexReucEntry which cannot be duplicated");
   }

  static std::string className() { return "GitIndexReucEntry"; };
  static const bool isSingleton = false;
  static const bool isFreeable = true;
  static void free(git_index_reuc_entry *raw) {
    unsigned long referenceCount = 0;
     if (referenceCount == 0) {
      ::free(raw); // :: to avoid calling this free recursively
    }
   }
};

class GitIndexReucEntry : public
  NodeGitWrapper<GitIndexReucEntryTraits>
{
    // grant full access to base class
    friend class NodeGitWrapper<GitIndexReucEntryTraits>;
   public:
    GitIndexReucEntry(const GitIndexReucEntry &) = delete;
    GitIndexReucEntry(GitIndexReucEntry &&) = delete;
    GitIndexReucEntry &operator=(const GitIndexReucEntry &) = delete;
    GitIndexReucEntry &operator=(GitIndexReucEntry &&) = delete;

    static void InitializeComponent (v8::Local<v8::Object> target, nodegit::Context *nodegitContext);

                                  

  private:
    GitIndexReucEntry()
      : NodeGitWrapper<GitIndexReucEntryTraits>(
           "A new GitIndexReucEntry cannot be instantiated."
       )
    {}
    GitIndexReucEntry(git_index_reuc_entry *raw, bool selfFreeing, v8::Local<v8::Object> owner = v8::Local<v8::Object>())
      : NodeGitWrapper<GitIndexReucEntryTraits>(raw, selfFreeing, owner)
    {}
    ~GitIndexReucEntry();
    static NAN_METHOD(Mode);
    static NAN_METHOD(Oid);
    static NAN_METHOD(Path);

    struct AddBaton {
      int error_code;
      const git_error* error;
      git_index * index;
      const char * path;
      int ancestor_mode;
      const git_oid * ancestor_id;
      bool ancestor_idNeedsFree;
      int our_mode;
      const git_oid * our_id;
      bool our_idNeedsFree;
      int their_mode;
      const git_oid * their_id;
      bool their_idNeedsFree;
     };
    class AddWorker : public nodegit::AsyncWorker {
      public:
        AddWorker(
            AddBaton *_baton,
            Nan::Callback *callback,
            std::map<std::string, std::shared_ptr<nodegit::CleanupHandle>> &cleanupHandles
        ) : nodegit::AsyncWorker(callback, "nodegit:AsyncWorker:GitIndexReucEntry:Add", cleanupHandles)
          , baton(_baton) {};
        AddWorker(const AddWorker &) = delete;
        AddWorker(AddWorker &&) = delete;
        AddWorker &operator=(const AddWorker &) = delete;
        AddWorker &operator=(AddWorker &&) = delete;
        ~AddWorker() {};
        void Execute();
        void HandleErrorCallback();
        void HandleOKCallback();
        nodegit::LockMaster AcquireLocks();

      private:
        AddBaton *baton;
    };

    static NAN_METHOD(Add);

    struct ClearBaton {
      int error_code;
      const git_error* error;
      git_index * index;
     };
    class ClearWorker : public nodegit::AsyncWorker {
      public:
        ClearWorker(
            ClearBaton *_baton,
            Nan::Callback *callback,
            std::map<std::string, std::shared_ptr<nodegit::CleanupHandle>> &cleanupHandles
        ) : nodegit::AsyncWorker(callback, "nodegit:AsyncWorker:GitIndexReucEntry:Clear", cleanupHandles)
          , baton(_baton) {};
        ClearWorker(const ClearWorker &) = delete;
        ClearWorker(ClearWorker &&) = delete;
        ClearWorker &operator=(const ClearWorker &) = delete;
        ClearWorker &operator=(ClearWorker &&) = delete;
        ~ClearWorker() {};
        void Execute();
        void HandleErrorCallback();
        void HandleOKCallback();
        nodegit::LockMaster AcquireLocks();

      private:
        ClearBaton *baton;
    };

    static NAN_METHOD(Clear);

    static NAN_METHOD(Entrycount);

    struct FindBaton {
      int error_code;
      const git_error* error;
      size_t * at_pos;
      git_index * index;
      const char * path;
     };
    class FindWorker : public nodegit::AsyncWorker {
      public:
        FindWorker(
            FindBaton *_baton,
            Nan::Callback *callback,
            std::map<std::string, std::shared_ptr<nodegit::CleanupHandle>> &cleanupHandles
        ) : nodegit::AsyncWorker(callback, "nodegit:AsyncWorker:GitIndexReucEntry:Find", cleanupHandles)
          , baton(_baton) {};
        FindWorker(const FindWorker &) = delete;
        FindWorker(FindWorker &&) = delete;
        FindWorker &operator=(const FindWorker &) = delete;
        FindWorker &operator=(FindWorker &&) = delete;
        ~FindWorker() {};
        void Execute();
        void HandleErrorCallback();
        void HandleOKCallback();
        nodegit::LockMaster AcquireLocks();

      private:
        FindBaton *baton;
    };

    static NAN_METHOD(Find);

    static NAN_METHOD(GetByIndex);

    static NAN_METHOD(GetByPath);

    struct RemoveBaton {
      int error_code;
      const git_error* error;
      git_index * index;
      size_t n;
     };
    class RemoveWorker : public nodegit::AsyncWorker {
      public:
        RemoveWorker(
            RemoveBaton *_baton,
            Nan::Callback *callback,
            std::map<std::string, std::shared_ptr<nodegit::CleanupHandle>> &cleanupHandles
        ) : nodegit::AsyncWorker(callback, "nodegit:AsyncWorker:GitIndexReucEntry:Remove", cleanupHandles)
          , baton(_baton) {};
        RemoveWorker(const RemoveWorker &) = delete;
        RemoveWorker(RemoveWorker &&) = delete;
        RemoveWorker &operator=(const RemoveWorker &) = delete;
        RemoveWorker &operator=(RemoveWorker &&) = delete;
        ~RemoveWorker() {};
        void Execute();
        void HandleErrorCallback();
        void HandleOKCallback();
        nodegit::LockMaster AcquireLocks();

      private:
        RemoveBaton *baton;
    };

    static NAN_METHOD(Remove);
};

#endif
