"use strict";

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

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

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

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

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

var POSTGRES = /*#__PURE__*/function () {
  /**
   * Function For Data System
   *
   * @param config
   */
  function POSTGRES(config) {
    (0, _classCallCheck2["default"])(this, POSTGRES);
    this.config = _lodash["default"].extend({
      engine: POSTGRES.PSQL_CONNECTION,
      user: 'me',
      host: 'localhost',
      database: 'api',
      password: 'password',
      port: 5432
    }, config);

    var PSQLEngine = require("pg");

    switch (this.config.engine) {
      case POSTGRES.PSQL_CONNECTION:
        this.DBInstance = new PSQLEngine.Connection(this.config);
        break;

      case POSTGRES.PSQL_POOL:
        this.DBInstance = new PSQLEngine.Pool(this.config);
        break;

      default:
        break;
    }
  }

  (0, _createClass2["default"])(POSTGRES, null, [{
    key: "PSQL_CONNECTION",
    get:
    /***
     * @returns {number}
     * @constructor
     */
    function get() {
      return 1;
    }
  }, {
    key: "PSQL_POOL",
    get: function get() {
      return 2;
    }
  }]);
  return POSTGRES;
}();

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