//
// Autogenerated by Thrift Compiler (0.5.0-en-exported)
//
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
//


  // Define types and services

  var Thrift = require('thrift');
  var exports = exports || {};


  exports.Display = Thrift.Struct.define('Display',  {
    1: { alias: 'id', type: Thrift.Type.I32 },
    2: { alias: 'name', type: Thrift.Type.STRING },
    3: { alias: 'left', type: Thrift.Type.I32 },
    4: { alias: 'top', type: Thrift.Type.I32 },
    5: { alias: 'width', type: Thrift.Type.I32 },
    6: { alias: 'height', type: Thrift.Type.I32 },
    7: { alias: 'dpi', type: Thrift.Type.I32 }
  });

  var NodeWebkitService = exports.NodeWebkitService = {};

  NodeWebkitService.markup = Thrift.Method.define({
    alias: 'markup',
    args: Thrift.Struct.define('markupArgs', {
      1: { alias: 'resourceUrl', type: Thrift.Type.STRING, index: 0 },
      7: { alias: 'title', type: Thrift.Type.STRING, index: 1 },
      2: { alias: 'x', type: Thrift.Type.I32, index: 2 },
      3: { alias: 'y', type: Thrift.Type.I32, index: 3 },
      4: { alias: 'width', type: Thrift.Type.I32, index: 4 },
      5: { alias: 'height', type: Thrift.Type.I32, index: 5 },
      6: { alias: 'trigger', type: Thrift.Type.I32, index: 6 }
    }),
    result: Thrift.Struct.define('markupResult')
  });

  NodeWebkitService.markupPdf = Thrift.Method.define({
    alias: 'markupPdf',
    args: Thrift.Struct.define('markupPdfArgs', {
      1: { alias: 'pdfUrl', type: Thrift.Type.STRING, index: 0 },
      2: { alias: 'manifestUrl', type: Thrift.Type.STRING, index: 1 },
      3: { alias: 'pageNum', type: Thrift.Type.I32, index: 2 },
      9: { alias: 'title', type: Thrift.Type.STRING, index: 3 },
      4: { alias: 'x', type: Thrift.Type.I32, index: 4 },
      5: { alias: 'y', type: Thrift.Type.I32, index: 5 },
      6: { alias: 'width', type: Thrift.Type.I32, index: 6 },
      7: { alias: 'height', type: Thrift.Type.I32, index: 7 },
      8: { alias: 'trigger', type: Thrift.Type.I32, index: 8 }
    }),
    result: Thrift.Struct.define('markupPdfResult')
  });

  NodeWebkitService.focusMarkupWindow = Thrift.Method.define({
    alias: 'focusMarkupWindow',
    args: Thrift.Struct.define('focusMarkupWindowArgs'),
    result: Thrift.Struct.define('focusMarkupWindowResult')
  });

  NodeWebkitService.closeMarkupWindow = Thrift.Method.define({
    alias: 'closeMarkupWindow',
    args: Thrift.Struct.define('closeMarkupWindowArgs'),
    result: Thrift.Struct.define('closeMarkupWindowResult')
  });

  NodeWebkitService.closeMarkupWindowWithMessage = Thrift.Method.define({
    alias: 'closeMarkupWindowWithMessage',
    args: Thrift.Struct.define('closeMarkupWindowWithMessageArgs', {
      1: { alias: 'message', type: Thrift.Type.STRING, index: 0 }
    }),
    result: Thrift.Struct.define('closeMarkupWindowWithMessageResult')
  });

  NodeWebkitService.rotateImage = Thrift.Method.define({
    alias: 'rotateImage',
    args: Thrift.Struct.define('rotateImageArgs', {
      1: { alias: 'resourceUrl', type: Thrift.Type.STRING, index: 0 },
      2: { alias: 'theta', type: Thrift.Type.I32, index: 1 }
    }),
    result: Thrift.Struct.define('rotateImageResult')
  });

  NodeWebkitService.resizeImage = Thrift.Method.define({
    alias: 'resizeImage',
    args: Thrift.Struct.define('resizeImageArgs', {
      1: { alias: 'resourceUrl', type: Thrift.Type.STRING, index: 0 },
      2: { alias: 'width', type: Thrift.Type.I32, index: 1 },
      3: { alias: 'height', type: Thrift.Type.I32, index: 2 }
    }),
    result: Thrift.Struct.define('resizeImageResult')
  });

  NodeWebkitService.clearImage = Thrift.Method.define({
    alias: 'clearImage',
    args: Thrift.Struct.define('clearImageArgs', {
      1: { alias: 'resourceUrl', type: Thrift.Type.STRING, index: 0 }
    }),
    result: Thrift.Struct.define('clearImageResult')
  });

  NodeWebkitService.present = Thrift.Method.define({
    alias: 'present',
    args: Thrift.Struct.define('presentArgs', {
      1: { alias: 'noteIds', type: Thrift.Type.LIST, def: Thrift.List.define(Thrift.Type.I32) , index: 0 },
      2: { alias: 'index', type: Thrift.Type.I32, index: 1 },
      3: { alias: 'x', type: Thrift.Type.I32, index: 2 },
      4: { alias: 'y', type: Thrift.Type.I32, index: 3 },
      5: { alias: 'width', type: Thrift.Type.I32, index: 4 },
      6: { alias: 'height', type: Thrift.Type.I32, index: 5 },
      7: { alias: 'trigger', type: Thrift.Type.I32, index: 6 }
    }),
    result: Thrift.Struct.define('presentResult')
  });

  NodeWebkitService.focusPresentationWindow = Thrift.Method.define({
    alias: 'focusPresentationWindow',
    args: Thrift.Struct.define('focusPresentationWindowArgs'),
    result: Thrift.Struct.define('focusPresentationWindowResult')
  });

  NodeWebkitService.closePresentationWindow = Thrift.Method.define({
    alias: 'closePresentationWindow',
    args: Thrift.Struct.define('closePresentationWindowArgs'),
    result: Thrift.Struct.define('closePresentationWindowResult')
  });

  NodeWebkitService.minimizeWindow = Thrift.Method.define({
    alias: 'minimizeWindow',
    args: Thrift.Struct.define('minimizeWindowArgs'),
    result: Thrift.Struct.define('minimizeWindowResult')
  });

  NodeWebkitService.restoreWindow = Thrift.Method.define({
    alias: 'restoreWindow',
    args: Thrift.Struct.define('restoreWindowArgs'),
    result: Thrift.Struct.define('restoreWindowResult')
  });

  NodeWebkitService.updateDisplayInfo = Thrift.Method.define({
    alias: 'updateDisplayInfo',
    args: Thrift.Struct.define('updateDisplayInfoArgs', {
      1: { alias: 'displays', type: Thrift.Type.LIST, def: Thrift.List.define(Thrift.Type.STRUCT, exports.Display) , index: 0 }
    }),
    result: Thrift.Struct.define('updateDisplayInfoResult')
  });

  NodeWebkitService.quit = Thrift.Method.define({
    alias: 'quit',
    args: Thrift.Struct.define('quitArgs'),
    result: Thrift.Struct.define('quitResult')
  });

  // Define NodeWebkitService Client

  function NodeWebkitServiceClient(output) {
    this.output = output;
    this.seqid = 0;
  }

  NodeWebkitServiceClient.prototype.markup = function(resourceUrl, title, x, y, width, height, trigger, callback) {
    var mdef = NodeWebkitService.markup;
    var args = new mdef.args();
    args.resourceUrl = resourceUrl;
    args.title = title;
    args.x = x;
    args.y = y;
    args.width = width;
    args.height = height;
    args.trigger = trigger;
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  NodeWebkitServiceClient.prototype.markupPdf = function(pdfUrl, manifestUrl, pageNum, title, x, y, width, height, trigger, callback) {
    var mdef = NodeWebkitService.markupPdf;
    var args = new mdef.args();
    args.pdfUrl = pdfUrl;
    args.manifestUrl = manifestUrl;
    args.pageNum = pageNum;
    args.title = title;
    args.x = x;
    args.y = y;
    args.width = width;
    args.height = height;
    args.trigger = trigger;
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  NodeWebkitServiceClient.prototype.focusMarkupWindow = function(callback) {
    var mdef = NodeWebkitService.focusMarkupWindow;
    var args = new mdef.args();
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  NodeWebkitServiceClient.prototype.closeMarkupWindow = function(callback) {
    var mdef = NodeWebkitService.closeMarkupWindow;
    var args = new mdef.args();
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  NodeWebkitServiceClient.prototype.closeMarkupWindowWithMessage = function(message, callback) {
    var mdef = NodeWebkitService.closeMarkupWindowWithMessage;
    var args = new mdef.args();
    args.message = message;
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  NodeWebkitServiceClient.prototype.rotateImage = function(resourceUrl, theta, callback) {
    var mdef = NodeWebkitService.rotateImage;
    var args = new mdef.args();
    args.resourceUrl = resourceUrl;
    args.theta = theta;
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  NodeWebkitServiceClient.prototype.resizeImage = function(resourceUrl, width, height, callback) {
    var mdef = NodeWebkitService.resizeImage;
    var args = new mdef.args();
    args.resourceUrl = resourceUrl;
    args.width = width;
    args.height = height;
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  NodeWebkitServiceClient.prototype.clearImage = function(resourceUrl, callback) {
    var mdef = NodeWebkitService.clearImage;
    var args = new mdef.args();
    args.resourceUrl = resourceUrl;
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  NodeWebkitServiceClient.prototype.present = function(noteIds, index, x, y, width, height, trigger, callback) {
    var mdef = NodeWebkitService.present;
    var args = new mdef.args();
    args.noteIds = noteIds;
    args.index = index;
    args.x = x;
    args.y = y;
    args.width = width;
    args.height = height;
    args.trigger = trigger;
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  NodeWebkitServiceClient.prototype.focusPresentationWindow = function(callback) {
    var mdef = NodeWebkitService.focusPresentationWindow;
    var args = new mdef.args();
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  NodeWebkitServiceClient.prototype.closePresentationWindow = function(callback) {
    var mdef = NodeWebkitService.closePresentationWindow;
    var args = new mdef.args();
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  NodeWebkitServiceClient.prototype.minimizeWindow = function(callback) {
    var mdef = NodeWebkitService.minimizeWindow;
    var args = new mdef.args();
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  NodeWebkitServiceClient.prototype.restoreWindow = function(callback) {
    var mdef = NodeWebkitService.restoreWindow;
    var args = new mdef.args();
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  NodeWebkitServiceClient.prototype.updateDisplayInfo = function(displays, callback) {
    var mdef = NodeWebkitService.updateDisplayInfo;
    var args = new mdef.args();
    args.displays = displays;
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  NodeWebkitServiceClient.prototype.quit = function(callback) {
    var mdef = NodeWebkitService.quit;
    var args = new mdef.args();
    mdef.sendRequest(this.output, this.seqid++, args, callback);
  };

  exports.NodeWebkitService.Client = NodeWebkitServiceClient;

  // Define NodeWebkitService Server

  function NodeWebkitServiceServer(service, stransport, Protocol) {
    var methodName;
      this.service = service;
      this.stransport = stransport;
      this.processor = new Thrift.Processor();
      for (methodName in NodeWebkitService) {
        if (service[methodName]) {
          this.processor.addMethod(NodeWebkitService[methodName], service[methodName].bind(service));
        }
      }
      this.stransport.process = function (input, output, noop) {
      var inprot = new Protocol(input);
      var outprot = new Protocol(output);
      this.processor.process(inprot, outprot, noop);
    }.bind(this);
  }

  NodeWebkitServiceServer.prototype.start = function () {
    this.stransport.listen();
  };
  NodeWebkitServiceServer.prototype.stop = function () {
    this.stransport.close();
  };

  exports.NodeWebkitService.Server = NodeWebkitServiceServer;

  return exports;

