'use strict';

var crypto = require('crypto');

// src/features/watch-pr-review/domain/review-marker.ts
var REVIEW_MARKER_PREFIX = "ju-hong-e:watch-pr-review";
function buildReviewSignature(commitOids) {
  const normalized = [...commitOids].sort().join(",");
  return crypto.createHash("sha1").update(normalized).digest("hex").slice(0, 12);
}
function buildReviewMarker(signature) {
  return `<!-- ${REVIEW_MARKER_PREFIX} sig=${signature} -->`;
}
function hasReviewMarkerForSignature(commentBodies, signature) {
  const needle = `${REVIEW_MARKER_PREFIX} sig=${signature}`;
  return commentBodies.some((body) => body.includes(needle));
}

exports.REVIEW_MARKER_PREFIX = REVIEW_MARKER_PREFIX;
exports.buildReviewMarker = buildReviewMarker;
exports.buildReviewSignature = buildReviewSignature;
exports.hasReviewMarkerForSignature = hasReviewMarkerForSignature;
