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

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

#include "../include/config.h"
// Forward declaration.
struct git_config {
};

using namespace node;
using namespace v8;

class GitConfig : public ObjectWrap {
public:

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

  git_config *GetValue();
  git_config **GetRefValue();

  static Handle<Value> New(void *raw, bool selfFreeing);
  bool selfFreeing;

private:
  GitConfig(git_config *raw, bool selfFreeing);
  ~GitConfig();

  static NAN_METHOD(JSNewFunction);


  static NAN_METHOD(SetInt64);

  static NAN_METHOD(SetMultivar);

  static NAN_METHOD(SetString);

  struct SnapshotBaton {
    int error_code;
    const git_error* error;
    git_config * out;
    git_config * config;
  };
  class SnapshotWorker : public NanAsyncWorker {
  public:
    SnapshotWorker(
      SnapshotBaton *_baton,
      NanCallback *callback
    ) : NanAsyncWorker(callback)
      , baton(_baton) {};
    ~SnapshotWorker() {};
    void Execute();
    void HandleOKCallback();

  private:
    SnapshotBaton *baton;
  };

  static NAN_METHOD(Snapshot);
  git_config *raw;
};

#endif
