"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeDetachedFieldIndexCodecFamily = exports.makeDetachedFieldIndexCodec = void 0;
const index_js_1 = require("../../codec/index.js");
const detachedFieldIndexFormatV1_js_1 = require("./detachedFieldIndexFormatV1.js");
const detachedFieldIndexFormatV2_js_1 = require("./detachedFieldIndexFormatV2.js");
const detachedFieldIndexCodecV1_js_1 = require("./detachedFieldIndexCodecV1.js");
const detachedFieldIndexCodecV2_js_1 = require("./detachedFieldIndexCodecV2.js");
function makeDetachedFieldIndexCodec(revisionTagCodec, options, idCompressor) {
    const family = makeDetachedFieldIndexCodecFamily(revisionTagCodec, options, idCompressor);
    const writeVersion = options.oldestCompatibleClient < index_js_1.FluidClientVersion.v2_52 ? detachedFieldIndexFormatV1_js_1.version1 : detachedFieldIndexFormatV2_js_1.version2;
    return (0, index_js_1.makeVersionDispatchingCodec)(family, { ...options, writeVersion });
}
exports.makeDetachedFieldIndexCodec = makeDetachedFieldIndexCodec;
function makeDetachedFieldIndexCodecFamily(revisionTagCodec, options, idCompressor) {
    return (0, index_js_1.makeCodecFamily)([
        [detachedFieldIndexFormatV1_js_1.version1, (0, detachedFieldIndexCodecV1_js_1.makeDetachedNodeToFieldCodecV1)(revisionTagCodec, options, idCompressor)],
        [detachedFieldIndexFormatV2_js_1.version2, (0, detachedFieldIndexCodecV2_js_1.makeDetachedNodeToFieldCodecV2)(revisionTagCodec, options, idCompressor)],
    ]);
}
exports.makeDetachedFieldIndexCodecFamily = makeDetachedFieldIndexCodecFamily;
//# sourceMappingURL=detachedFieldIndexCodecs.js.map