"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.LocationBasedSharedTreeEditBuilder = exports.IdBasedSharedTreeEditBuilder = void 0;
const index_js_1 = require("../feature-libraries/index.js");
/**
 * Implementation of {@link DataEditor} based on the default set of supported field kinds.
 * @sealed
 */
class IdBasedSharedTreeEditBuilder extends index_js_1.DefaultIdBasedDataEditor {
    constructor(modularChangeFamily, mintRevisionTag, changeReceiver, options) {
        super(modularChangeFamily, mintRevisionTag, (taggedChange) => changeReceiver({
            ...taggedChange,
            change: { changes: [{ type: "data", innerChange: taggedChange.change }] },
        }), options);
        this.changeReceiver = changeReceiver;
        this.schema = {
            setStoredSchema: (oldSchema, newSchema) => {
                changeReceiver({
                    revision: mintRevisionTag(),
                    change: {
                        changes: [
                            {
                                type: "schema",
                                innerChange: {
                                    schema: { new: newSchema, old: oldSchema },
                                    isInverse: false,
                                },
                            },
                        ],
                    },
                });
            },
        };
    }
}
exports.IdBasedSharedTreeEditBuilder = IdBasedSharedTreeEditBuilder;
class LocationBasedSharedTreeEditBuilder extends index_js_1.LocationBasedDataEditor {
    constructor(idBasedEditor, locator) {
        super(idBasedEditor, locator);
        this.schema = idBasedEditor.schema;
    }
}
exports.LocationBasedSharedTreeEditBuilder = LocationBasedSharedTreeEditBuilder;
//# sourceMappingURL=sharedTreeEditBuilder.js.map