"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringifyMemorySpecData = exports.stringifyGraphUnitSpecData = exports.stringifyGraphSpecData = exports.stringifyUnitBundleSpecData = exports.stringifyBundleSpecData = exports.stringifyBundleSpec = void 0;
const stringifyPinData_1 = require("../types/stringifyPinData");
const stringify_1 = require("./stringify");
const stringifyBundleSpec = (spec) => {
    const { unit, specs } = spec;
    stringifyGraphUnitSpecData(unit);
};
exports.stringifyBundleSpec = stringifyBundleSpec;
function stringifyBundleSpecData(bundle) {
    const { spec } = bundle;
    stringifyGraphSpecData(spec);
}
exports.stringifyBundleSpecData = stringifyBundleSpecData;
function stringifyUnitBundleSpecData(unitBundle) {
    stringifyGraphUnitSpecData(unitBundle.unit);
}
exports.stringifyUnitBundleSpecData = stringifyUnitBundleSpecData;
function stringifyGraphSpecData(spec) {
    for (const unitId in spec.units) {
        stringifyGraphUnitSpecData(spec.units[unitId]);
    }
}
exports.stringifyGraphSpecData = stringifyGraphSpecData;
function stringifyGraphUnitSpecData(unit) {
    const { memory } = unit;
    if (memory) {
        stringifyMemorySpecData(memory);
    }
}
exports.stringifyGraphUnitSpecData = stringifyGraphUnitSpecData;
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);
}
exports.stringifyMemorySpecData = stringifyMemorySpecData;
function stringifyGraphUnitPinSpecData(input) {
    for (const inputId in input) {
        const { data } = input[inputId];
        if (data !== undefined) {
            input[inputId].data = (0, stringify_1.stringify)(data);
        }
    }
}
//# sourceMappingURL=stringifySpec.js.map