#ifndef GITREMOTECALLBACKS_H
#define GITREMOTECALLBACKS_H
// generated from struct_header.h
#include <nan.h>
#include <string>

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

  #include "../include/cred.h"
 
using namespace node;
using namespace v8;

class GitRemoteCallbacks : public ObjectWrap {
  public:
    GitRemoteCallbacks(git_remote_callbacks* raw, bool selfFreeing);
    static Persistent<Function> constructor_template;
    static void InitializeComponent (Handle<v8::Object> target);

    git_remote_callbacks *GetValue();
    git_remote_callbacks **GetRefValue();

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

    bool selfFreeing;

            static int credentials_cppCallback (
              git_cred ** cred
                ,
               const char * url
                ,
               const char * username_from_url
                ,
               unsigned int allowed_types
                ,
               void * payload
            );

          static void credentials_asyncWork(uv_work_t* req);
          static void credentials_asyncAfter(uv_work_t* req, int status);
          static void credentials_asyncPromisePolling(uv_work_t* req, int status);
          struct CredentialsBaton {
              git_cred ** cred;
              const char * url;
              const char * username_from_url;
              unsigned int allowed_types;
              void * payload;
 
            uv_work_t req;
            int result;
            Persistent<Object> promise;
            bool done;
          };
     
  private:
    GitRemoteCallbacks();
    ~GitRemoteCallbacks();

    void ConstructFields();

    static NAN_METHOD(JSNewFunction);

  
        static NAN_GETTER(GetVersion);
        static NAN_SETTER(SetVersion);

             NanCallback* credentials;
  
        static NAN_GETTER(GetCredentials);
        static NAN_SETTER(SetCredentials);

             Persistent<Value> payload;
  
        static NAN_GETTER(GetPayload);
        static NAN_SETTER(SetPayload);

  
    git_remote_callbacks *raw;
};

#endif
