#ifndef GITDIFF_H
#define GITDIFF_H

#include <nan.h>
#include <string>

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

#include "../include/diff.h"
#include "../include/delta.h"
#include "../include/repository.h"
#include "../include/tree.h"
#include "../include/index.h"
#include "../include/diff_options.h"
#include "../include/diff_options.h"
#include "../include/diff.h"
#include "../include/repository.h"
#include "../include/tree.h"
#include "../include/index.h"
#include "../include/commit.h"


using namespace node;
using namespace v8;

class GitDiff : public ObjectWrap {
  public:

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

        git_diff *GetValue();

    static Handle<Value> New(void *raw);
    
  private:
        GitDiff(git_diff *raw);
    ~GitDiff();
    
    static NAN_METHOD(New);

    
                  
    struct TreeToTreeBaton {
      int error_code;
      const git_error* error;
                    git_diff * diff;
                            git_repository * repo;
                            git_tree * old_tree;
                            git_tree * new_tree;
                            const git_diff_options * opts;
                  };
    class TreeToTreeWorker : public NanAsyncWorker {
      public:
        TreeToTreeWorker(
            TreeToTreeBaton *_baton,
            NanCallback *callback
        ) : NanAsyncWorker(callback)
          , baton(_baton) {};
        ~TreeToTreeWorker() {};
        void Execute();
        void HandleOKCallback();

      private:
        TreeToTreeBaton *baton;
    };
        
    static NAN_METHOD(TreeToTree);
                        
    static NAN_METHOD(NumDeltas);
                        
    static NAN_METHOD(GetDelta);
          
        git_diff *raw;
    };

#endif
