"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.translateEquipmentData = translateEquipmentData;
const tslib_1 = require("tslib");
const equipment_translations_1 = require("./equipment-translations");
const mergedEquipmentData = equipment_translations_1.merged;
function translateEquipmentData(data, type) {
    const { equipmentInput = {}, equipmentOutput = {} } = data, rest = tslib_1.__rest(data, ["equipmentInput", "equipmentOutput"]);
    const translations = mergedEquipmentData[type];
    if (!translations)
        throw new Error('해당 타입의 레포트는 추후 제공 예정입니다.');
    const translateKeys = (data, translationMap) => {
        return Object.entries(data).reduce((translated, [key, value]) => {
            translationMap.hasOwnProperty(key) ? (translated[translationMap[key]] = value) : delete translated[key];
            return translated;
        }, {});
    };
    return Object.assign(Object.assign({}, rest), { equipmentType: translations.type, equipmentInput: translateKeys(equipmentInput, translations.input), equipmentOutput: translateKeys(equipmentOutput, translations.output) });
}
//# sourceMappingURL=equipment-report-data.js.map