"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeChangeAtomIdCodec = void 0;
const index_js_1 = require("./modular-schema/index.js");
function makeChangeAtomIdCodec(revisionTagCodec) {
    return {
        encode(changeAtomId, context) {
            return changeAtomId.revision === undefined || changeAtomId.revision === context.revision
                ? changeAtomId.localId
                : [changeAtomId.localId, revisionTagCodec.encode(changeAtomId.revision, context)];
        },
        decode(changeAtomId, context) {
            return Array.isArray(changeAtomId)
                ? {
                    localId: changeAtomId[0],
                    revision: revisionTagCodec.decode(changeAtomId[1], context),
                }
                : { localId: changeAtomId, revision: context.revision };
        },
        encodedSchema: index_js_1.EncodedChangeAtomId,
    };
}
exports.makeChangeAtomIdCodec = makeChangeAtomIdCodec;
//# sourceMappingURL=changeAtomIdCodec.js.map