var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getLastSyncedAt = void 0;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _createSelectQuery = require("../sqlite-utils/createSelectQuery");
var _SqliteClient = require("../SqliteClient");
var getLastSyncedAt = exports.getLastSyncedAt = function () {
  var _ref2 = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(_ref) {
    var _result$;
    var currentUserId, result;
    return _regenerator["default"].wrap(function _callee$(_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          currentUserId = _ref.currentUserId;
          _SqliteClient.SqliteClient.logger == null || _SqliteClient.SqliteClient.logger('info', 'getLastSyncedAt', {
            currentUserId: currentUserId
          });
          _context.next = 4;
          return _SqliteClient.SqliteClient.executeSql.apply(null, (0, _createSelectQuery.createSelectQuery)('userSyncStatus', ['*'], {
            userId: currentUserId
          }));
        case 4:
          result = _context.sent;
          return _context.abrupt("return", (_result$ = result[0]) == null ? void 0 : _result$.lastSyncedAt);
        case 6:
        case "end":
          return _context.stop();
      }
    }, _callee);
  }));
  return function getLastSyncedAt(_x) {
    return _ref2.apply(this, arguments);
  };
}();
//# sourceMappingURL=getLastSyncedAt.js.map