"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringifyBundleSpec = void 0;
exports.stringifyBundleSpecData = stringifyBundleSpecData;
exports.stringifyUnitBundleSpecData = stringifyUnitBundleSpecData;
exports.stringifyGraphSpecData = stringifyGraphSpecData;
exports.stringifyGraphUnitSpecData = stringifyGraphUnitSpecData;
exports.stringifyMemorySpecData = stringifyMemorySpecData;
const stringifyPinData_1 = require("../types/stringifyPinData");
const stringifyBundleSpec = (spec) => {
    const { unit, specs } = spec;
    stringifyGraphUnitSpecData(unit);
};
exports.stringifyBundleSpec = stringifyBundleSpec;
function stringifyBundleSpecData(bundle) {
    const { spec } = bundle;
    stringifyGraphSpecData(spec);
}
function stringifyUnitBundleSpecData(unitBundle) {
    stringifyGraphUnitSpecData(unitBundle.unit);
}
function stringifyGraphSpecData(spec) {
    for (const unitId in spec.units) {
        stringifyGraphUnitSpecData(spec.units[unitId]);
    }
}
function stringifyGraphUnitSpecData(unit) {
    const { memory } = unit;
    if (memory) {
        stringifyMemorySpecData(memory);
    }
}
function stringifyMemorySpecData(memory) {
    for (const inputId in memory.input) {
        const input = memory.input[inputId];
        memory.input[inputId] = (0, stringifyPinData_1.stringifyDataObj)(input);
    }
    for (const outputId in memory.output) {
        const output = memory.output[outputId];
        memory.output[outputId] = (0, stringifyPinData_1.stringifyDataObj)(output);
    }
    memory.memory = (0, stringifyPinData_1.stringifyDataObj)(memory.memory);
}
//# sourceMappingURL=stringifySpec.js.map