// This is a generated file, modify: generate/templates/templates/struct_header.h

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

#include "async_baton.h"
#include "async_worker.h"
#include "callback_wrapper.h"
#include "context.h"
#include "reference_counter.h"
#include "nodegit_wrapper.h"
#include "configurable_class_wrapper.h"
#include "v8_helpers.h"

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

  #include "../include/credential.h"
  #include "../include/cert.h"
  #include "../include/indexer_progress.h"
  #include "../include/buf.h"
 
using namespace node;
using namespace v8;

class GitRemoteCallbacks;
class ConfigurableGitRemoteCallbacks;
 
struct GitRemoteCallbacksTraits {
  typedef GitRemoteCallbacks cppClass;
  typedef git_remote_callbacks cType;
  typedef ConfigurableGitRemoteCallbacks configurableCppClass;
 
  static const bool isDuplicable = false;
  static void duplicate(git_remote_callbacks **dest, git_remote_callbacks *src) {
     Nan::ThrowError("duplicate called on GitRemoteCallbacks which cannot be duplicated");
   }

  static std::string className() { return "GitRemoteCallbacks"; };
  static const bool isSingleton = false;
  static const bool isFreeable = true;
  static void free(git_remote_callbacks *raw) {
    unsigned long referenceCount = 0;
     if (referenceCount == 0) {
      ::free(raw); // :: to avoid calling this free recursively
    }
   }
};
  
class ConfigurableGitRemoteCallbacks : public nodegit::ConfigurableClassWrapper<GitRemoteCallbacksTraits> {
  friend class nodegit::ConfigurableClassWrapper<GitRemoteCallbacksTraits>;

public:
  static v8ConversionResult fromJavascript(nodegit::Context *nodegitContext, v8::Local<v8::Value> input);
  ~ConfigurableGitRemoteCallbacks();

  ConfigurableGitRemoteCallbacks(const ConfigurableGitRemoteCallbacks &) = delete;
  ConfigurableGitRemoteCallbacks(ConfigurableGitRemoteCallbacks &&) = delete;
  ConfigurableGitRemoteCallbacks &operator=(const ConfigurableGitRemoteCallbacks &) = delete;
  ConfigurableGitRemoteCallbacks &operator=(ConfigurableGitRemoteCallbacks &&) = delete;

          static int sidebandProgress_cppCallback (
            const char * str
              ,
             int len
              ,
             void * payload
          );

        static void sidebandProgress_cancelAsync(void *baton);
        static void sidebandProgress_async(void *baton);
        static void sidebandProgress_promiseCompleted(bool isFulfilled, nodegit::AsyncBaton *_baton, v8::Local<v8::Value> result);
           class SidebandProgressBaton : public nodegit::AsyncBatonWithResult<int> {
          public:
              const char * str;
              int len;
              void * payload;
 
            SidebandProgressBaton(const int &defaultResult)
              : nodegit::AsyncBatonWithResult<int>(defaultResult) {
              }
          };
         static ConfigurableGitRemoteCallbacks * sidebandProgress_getInstanceFromBaton (
          SidebandProgressBaton *baton);
          static int credentials_cppCallback (
            git_credential ** credential
              ,
             const char * url
              ,
             const char * username_from_url
              ,
             unsigned int allowed_types
              ,
             void * payload
          );

        static void credentials_cancelAsync(void *baton);
        static void credentials_async(void *baton);
        static void credentials_promiseCompleted(bool isFulfilled, nodegit::AsyncBaton *_baton, v8::Local<v8::Value> result);
           class CredentialsBaton : public nodegit::AsyncBatonWithResult<int> {
          public:
              git_credential ** credential;
              const char * url;
              const char * username_from_url;
              unsigned int allowed_types;
              void * payload;
 
            CredentialsBaton(const int &defaultResult)
              : nodegit::AsyncBatonWithResult<int>(defaultResult) {
              }
          };
         static ConfigurableGitRemoteCallbacks * credentials_getInstanceFromBaton (
          CredentialsBaton *baton);
          static int certificateCheck_cppCallback (
            git_cert * cert
              ,
             int valid
              ,
             const char * host
              ,
             void * payload
          );

        static void certificateCheck_cancelAsync(void *baton);
        static void certificateCheck_async(void *baton);
        static void certificateCheck_promiseCompleted(bool isFulfilled, nodegit::AsyncBaton *_baton, v8::Local<v8::Value> result);
           class CertificateCheckBaton : public nodegit::AsyncBatonWithResult<int> {
          public:
              git_cert * cert;
              int valid;
              const char * host;
              void * payload;
 
            CertificateCheckBaton(const int &defaultResult)
              : nodegit::AsyncBatonWithResult<int>(defaultResult) {
              }
          };
         static ConfigurableGitRemoteCallbacks * certificateCheck_getInstanceFromBaton (
          CertificateCheckBaton *baton);
          static int transferProgress_cppCallback (
            const git_indexer_progress * stats
              ,
             void * payload
          );

        static void transferProgress_cancelAsync(void *baton);
        static void transferProgress_async(void *baton);
        static void transferProgress_promiseCompleted(bool isFulfilled, nodegit::AsyncBaton *_baton, v8::Local<v8::Value> result);
           class TransferProgressBaton : public nodegit::AsyncBatonWithResult<int> {
          public:
              const git_indexer_progress * stats;
              void * payload;
 
            TransferProgressBaton(const int &defaultResult)
              : nodegit::AsyncBatonWithResult<int>(defaultResult) {
              }
          };
         static ConfigurableGitRemoteCallbacks * transferProgress_getInstanceFromBaton (
          TransferProgressBaton *baton);
          static int pushTransferProgress_cppCallback (
            unsigned int current
              ,
             unsigned int total
              ,
             size_t bytes
              ,
             void * payload
          );

        static void pushTransferProgress_cancelAsync(void *baton);
        static void pushTransferProgress_async(void *baton);
        static void pushTransferProgress_promiseCompleted(bool isFulfilled, nodegit::AsyncBaton *_baton, v8::Local<v8::Value> result);
           class PushTransferProgressBaton : public nodegit::AsyncBatonWithResult<int> {
          public:
              unsigned int current;
              unsigned int total;
              size_t bytes;
              void * payload;
 
            PushTransferProgressBaton(const int &defaultResult)
              : nodegit::AsyncBatonWithResult<int>(defaultResult) {
              }
          };
         static ConfigurableGitRemoteCallbacks * pushTransferProgress_getInstanceFromBaton (
          PushTransferProgressBaton *baton);
          static int pushUpdateReference_cppCallback (
            const char * refname
              ,
             const char * status
              ,
             void * data
          );

        static void pushUpdateReference_cancelAsync(void *baton);
        static void pushUpdateReference_async(void *baton);
        static void pushUpdateReference_promiseCompleted(bool isFulfilled, nodegit::AsyncBaton *_baton, v8::Local<v8::Value> result);
           class PushUpdateReferenceBaton : public nodegit::AsyncBatonWithResult<int> {
          public:
              const char * refname;
              const char * status;
              void * data;
 
            PushUpdateReferenceBaton(const int &defaultResult)
              : nodegit::AsyncBatonWithResult<int>(defaultResult) {
              }
          };
         static ConfigurableGitRemoteCallbacks * pushUpdateReference_getInstanceFromBaton (
          PushUpdateReferenceBaton *baton);
            static int resolveUrl_cppCallback (
            git_buf * url_resolved
              ,
             const char * url
              ,
             int direction
              ,
             void * payload
          );

        static void resolveUrl_cancelAsync(void *baton);
        static void resolveUrl_async(void *baton);
        static void resolveUrl_promiseCompleted(bool isFulfilled, nodegit::AsyncBaton *_baton, v8::Local<v8::Value> result);
           class ResolveUrlBaton : public nodegit::AsyncBatonWithResult<int> {
          public:
              git_buf * url_resolved;
              const char * url;
              int direction;
              void * payload;
 
            ResolveUrlBaton(const int &defaultResult)
              : nodegit::AsyncBatonWithResult<int>(defaultResult) {
              }
          };
         static ConfigurableGitRemoteCallbacks * resolveUrl_getInstanceFromBaton (
          ResolveUrlBaton *baton);
   
private:
  ConfigurableGitRemoteCallbacks(nodegit::Context *nodegitContext);
  ConfigurableGitRemoteCallbacks() = delete;
  Nan::Global<Value> promiseError;

             CallbackWrapper sidebandProgress;
             CallbackWrapper credentials;
             CallbackWrapper certificateCheck;
             CallbackWrapper transferProgress;
             CallbackWrapper pushTransferProgress;
             CallbackWrapper pushUpdateReference;
                CallbackWrapper resolveUrl;
    
};

#endif
