import { batchSendWxRobotMarkdown } from '../wecom-robot/batch-send.mjs';
import { parseEslintError } from './parse.mjs';
import { genRobotMsg } from './robot-msg.mjs';
import '@babel/runtime/regenerator';
import '../tslib.es6-848120af.js';
import '../wecom-robot/base.mjs';
import '../wecom-robot/helper.mjs';
import 'axios';
import '../wecom-robot/send-img.mjs';
import '../node-img/img.mjs';
import '../nodejs/crypto.mjs';
import '../nodejs/fs.mjs';
import '../nodejs/request.mjs';
import '../nodejs/path.mjs';
import '@babel/runtime/helpers/toConsumableArray';
import '../fs/fs.mjs';
import '../nodejs/os.mjs';
import '../git/git-link.mjs';
import '../slash/slash.mjs';

function parseEslintAndSendRobot(_ref) {
  var mrId = _ref.mrId,
    mrUrl = _ref.mrUrl,
    lintReportFile = _ref.lintReportFile,
    repoConfig = _ref.repoConfig,
    robotInfo = _ref.robotInfo;
  var webhookUrl = robotInfo.webhookUrl,
    chatId = robotInfo.chatId;
  var _parseEslintError = parseEslintError({
      lintReportFile: lintReportFile
    }),
    errorMap = _parseEslintError.errorMap,
    total = _parseEslintError.total;
  console.log('[parseEslintAndSendRobot] total: ', total);
  if (!total) return;
  var robotMsg = genRobotMsg({
    mrId: mrId,
    mrUrl: mrUrl,
    errorMap: errorMap,
    total: total,
    repoConfig: repoConfig
  });
  if (webhookUrl) {
    return batchSendWxRobotMarkdown({
      webhookUrl: webhookUrl,
      chatId: chatId,
      content: robotMsg
    });
  }
}

export { parseEslintAndSendRobot };
