"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.evaluateFileNameMatch = evaluateFileNameMatch;
const stepValidation_1 = require("../core/entityValidation/stepValidation");
function evaluateFileNameMatch(actualFileName, expectedPattern, mode) {
    if (!expectedPattern) {
        return true;
    }
    const lowerActual = actualFileName.normalize('NFC').toLowerCase();
    const lowerExpected = expectedPattern.normalize('NFC').toLowerCase();
    switch (mode) {
        case 'contains':
            return lowerActual.includes(lowerExpected);
        case 'starts_with':
            return lowerActual.startsWith(lowerExpected);
        case 'ends_with':
            return lowerActual.endsWith(lowerExpected);
        case 'matches_regex': {
            try {
                return (0, stepValidation_1.parseRegexPattern)(expectedPattern, { defaultFlags: 'i' }).test(actualFileName.normalize('NFC'));
            }
            catch {
                return false;
            }
        }
        case 'equals':
        default:
            return (actualFileName.normalize('NFC') === expectedPattern.normalize('NFC'));
    }
}
