"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTestTitleById = exports.isResult = exports.notApplicable = exports.resultFromTest = exports.resultFromTestWithMessage = void 0;
const IInfoItemData_1 = require("../IInfoItemData");
const ProjectInfoItem_1 = require("../ProjectInfoItem");
function resultFromTestWithMessage(test, generatorId, message, projectItem) {
    return new ProjectInfoItem_1.default(test.severity || IInfoItemData_1.InfoItemType.error, generatorId, test.id, message ?? test.defaultMessage ?? test.title, projectItem);
}
exports.resultFromTestWithMessage = resultFromTestWithMessage;
function resultFromTest(test, { id, message, item, data, }) {
    return new ProjectInfoItem_1.default(test.severity || IInfoItemData_1.InfoItemType.error, test.generatorId || id || "", test.id, message ?? test.defaultMessage ?? test.title, item, data);
}
exports.resultFromTest = resultFromTest;
// Can be returned to show this check does apply to this case
function notApplicable() {
    return [];
}
exports.notApplicable = notApplicable;
// confirms a result has been returned and/or filters nulls in a way the compiler will understand
function isResult(value) {
    return !!value;
}
exports.isResult = isResult;
function getTestTitleById(record, testId) {
    return Object.values(record).find((test) => test.id === testId)?.title || `Unknown Test: ${testId}`;
}
exports.getTestTitleById = getTestTitleById;

//# sourceMappingURL=../../maps/info/tests/TestDefinition.js.map
