"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _classPrivateFieldGet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldGet"));

var _classPrivateFieldSet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldSet"));

var _lodash = _interopRequireDefault(require("lodash"));

var _http = _interopRequireDefault(require("http"));

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends"));

function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }

function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }

var _routeJSON = /*#__PURE__*/new WeakMap();

var _options = /*#__PURE__*/new WeakMap();

var _server = /*#__PURE__*/new WeakMap();

var _response = /*#__PURE__*/new WeakMap();

var _request = /*#__PURE__*/new WeakMap();

var _callback = /*#__PURE__*/new WeakMap();

var DKA = /*#__PURE__*/function () {
  function DKA(options) {
    var _this = this;

    (0, _classCallCheck2["default"])(this, DKA);

    _classPrivateFieldInitSpec(this, _routeJSON, {
      writable: true,
      value: []
    });

    _classPrivateFieldInitSpec(this, _options, {
      writable: true,
      value: void 0
    });

    _classPrivateFieldInitSpec(this, _server, {
      writable: true,
      value: void 0
    });

    _classPrivateFieldInitSpec(this, _response, {
      writable: true,
      value: void 0
    });

    _classPrivateFieldInitSpec(this, _request, {
      writable: true,
      value: void 0
    });

    _classPrivateFieldInitSpec(this, _callback, {
      writable: true,
      value: void 0
    });

    (0, _classPrivateFieldSet2["default"])(this, _options, _lodash["default"].extend({
      header: [{
        key: "Content-Type",
        value: "application/json"
      }],
      request: {},
      response: {
        statusCode: 200
      }
    }));
    (0, _classPrivateFieldSet2["default"])(this, _server, _http["default"].createServer(function (request, response) {
      (0, _classPrivateFieldSet2["default"])(_this, _response, (0, _extends2["default"])(response, (0, _classPrivateFieldGet2["default"])(_this, _options).response));
      response = (0, _classPrivateFieldGet2["default"])(_this, _response);
      response.setHeader('Content-Type', 'text/html');
      response.write(" " + request.url);
      response.end();
    }));
  }
  /**
   * @param {Function} appEngine
   * @param {Object} options
   */


  (0, _createClass2["default"])(DKA, [{
    key: "use",
    value: function use(appEngine, options) {}
    /**
     * @param {String} url
     * @param {Object} callback
     * @return {ModulesHttp}
     */

  }, {
    key: "get",
    value: function get(url, callback) {
      /**
       *
       * @type {{request: {}, response: {send: (function(*): Promise<*>)}} & (function({request: Object}, {send: Function}))}
       */
      (0, _classPrivateFieldSet2["default"])(this, _callback, _lodash["default"].extend({
        request: {},
        response: {
          send: function () {
            var _send = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
              return _regenerator["default"].wrap(function _callee$(_context) {
                while (1) {
                  switch (_context.prev = _context.next) {
                    case 0:
                    case "end":
                      return _context.stop();
                  }
                }
              }, _callee);
            }));

            function send(_x) {
              return _send.apply(this, arguments);
            }

            return send;
          }()
        }
      }, callback));
    }
    /**
     * @param {String} ipAddress
     * @param {Number} port
     */

  }, {
    key: "listen",
    value: function listen(ipAddress, port) {}
  }]);
  return DKA;
}();

var _default = DKA;
exports["default"] = _default;
//# sourceMappingURL=index.js.map