"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeModularChangeCodecFamily = void 0;
const index_js_1 = require("../../codec/index.js");
const treeCompressionUtils_js_1 = require("../treeCompressionUtils.js");
const modularChangeCodecV1_js_1 = require("./modularChangeCodecV1.js");
const modularChangeCodecV2_js_1 = require("./modularChangeCodecV2.js");
function makeModularChangeCodecFamily(fieldKindConfigurations, revisionTagCodec, fieldsCodec, codecOptions, chunkCompressionStrategy = treeCompressionUtils_js_1.TreeCompressionStrategy.Compressed) {
    return (0, index_js_1.makeCodecFamily)(Array.from(fieldKindConfigurations.entries(), ([version, fieldKinds]) => [
        version,
        makeModularChangeCodec(version, fieldKinds, revisionTagCodec, fieldsCodec, codecOptions, chunkCompressionStrategy),
    ]));
}
exports.makeModularChangeCodecFamily = makeModularChangeCodecFamily;
const minVersionForCodec2 = 101;
function makeModularChangeCodec(version, fieldKinds, revisionTagCodec, fieldsCodec, codecOptions, chunkCompressionStrategy = treeCompressionUtils_js_1.TreeCompressionStrategy.Compressed) {
    if (version < minVersionForCodec2) {
        return (0, modularChangeCodecV1_js_1.makeModularChangeCodecV1)(fieldKinds, revisionTagCodec, fieldsCodec, codecOptions, chunkCompressionStrategy);
    }
    return (0, modularChangeCodecV2_js_1.makeModularChangeCodecV2)(fieldKinds, revisionTagCodec, fieldsCodec, codecOptions, chunkCompressionStrategy);
}
//# sourceMappingURL=modularChangeCodecs.js.map