#ifndef GITCHERRY_H
#define GITCHERRY_H
// generated from class_header.h
#include <nan.h>
#include <string>

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

#include "../include/repository.h"
#include "../include/commit.h"
#include "../include/cherry_pick_options.h"
#include "../include/index.h"
#include "../include/merge_options.h"

using namespace node;
using namespace v8;

class GitCherry : public ObjectWrap {
  public:

    static Persistent<Function> constructor_template;
    static void InitializeComponent (Handle<v8::Object> target);

    bool selfFreeing;

  private:

    static NAN_METHOD(JSNewFunction);


    static NAN_METHOD(Pick);

    struct PickCommitBaton {
      int error_code;
      const git_error* error;
      git_index * out;
      git_repository * repo;
      git_commit * cherry_pick_commit;
      git_commit * our_commit;
      unsigned int mainline;
      const git_merge_options * merge_options;
    };
    class PickCommitWorker : public NanAsyncWorker {
      public:
        PickCommitWorker(
            PickCommitBaton *_baton,
            NanCallback *callback
        ) : NanAsyncWorker(callback)
          , baton(_baton) {};
        ~PickCommitWorker() {};
        void Execute();
        void HandleOKCallback();

      private:
        PickCommitBaton *baton;
    };

    static NAN_METHOD(PickCommit);

    static NAN_METHOD(PickInitOptions);
};

#endif
