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

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

#include "../include/repository.h"
#include "../include/checkout_options.h"

using namespace node;
using namespace v8;

class GitCheckout : public ObjectWrap {
public:

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

  bool selfFreeing;

private:

  static NAN_METHOD(JSNewFunction);


  struct HeadBaton {
    int error_code;
    const git_error* error;
    git_repository * repo;
    const git_checkout_options * opts;
  };
  class HeadWorker : public NanAsyncWorker {
  public:
    HeadWorker(
      HeadBaton *_baton,
      NanCallback *callback
    ) : NanAsyncWorker(callback)
      , baton(_baton) {};
    ~HeadWorker() {};
    void Execute();
    void HandleOKCallback();

  private:
    HeadBaton *baton;
  };

  static NAN_METHOD(Head);

  static NAN_METHOD(InitOptions);
};

#endif
