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

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

#include "../include/repository.h"
#include "../include/clone_options.h"
#include "../include/remote.h"
#include "../include/checkout_options.h"
#include "../include/signature.h"

using namespace node;
using namespace v8;

class GitClone : public ObjectWrap {
  public:

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

    bool selfFreeing;

  private:

    static NAN_METHOD(JSNewFunction);


    struct CloneBaton {
      int error_code;
      const git_error* error;
      git_repository * out;
      const char * url;
      const char * local_path;
      const git_clone_options * options;
    };
    class CloneWorker : public NanAsyncWorker {
      public:
        CloneWorker(
            CloneBaton *_baton,
            NanCallback *callback
        ) : NanAsyncWorker(callback)
          , baton(_baton) {};
        ~CloneWorker() {};
        void Execute();
        void HandleOKCallback();

      private:
        CloneBaton *baton;
    };

    static NAN_METHOD(Clone);

    static NAN_METHOD(InitOptions);

    static NAN_METHOD(Into);

    static NAN_METHOD(LocalInto);
};

#endif
