"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PageResourceZonesConverter = void 0;
const ta_json_1 = require("ta-json");
const page_component_resource_1 = require("../models/pages/page-component-resource");
class PageResourceZonesConverter {
    /**
     * Serializes a string map of arrays of {@link PageComponentResource}s.
     *
     * @param value - The map of strings to arrays of {@link PageComponentResource}s
     * @returns A JSON value object.
     */
    serialize(value) {
        const result = {};
        Object.keys(value).forEach(zoneName => {
            const zone = value[zoneName];
            result[zoneName] = zone.map(pageComponentResource => {
                return ta_json_1.TaJson.serialize(pageComponentResource);
            });
        });
        return result;
    }
    /**
     * Deserializes a JSON object into a string map of arrays of {@link PageComponentResource}s.
     *
     * @param value - A JSON object
     * @returns A mapping of strings to arrays of {@link PageComponentResource}s.
     */
    deserialize(value) {
        if (!value) {
            return {};
        }
        const result = {};
        Object.keys(value).forEach(zoneName => {
            const zone = value[zoneName];
            if (Array.isArray(zone)) {
                result[zoneName] = zone.map(pageComponentResource => {
                    return ta_json_1.TaJson.deserialize(pageComponentResource, page_component_resource_1.PageComponentResource);
                });
            }
        });
        return result;
    }
}
exports.PageResourceZonesConverter = PageResourceZonesConverter;
//# sourceMappingURL=page-resource-zones-converter.js.map