"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.SharedTree = exports.TreeFactory = void 0;
const index_js_1 = require("./shared-tree/index.js");
const packageVersion_js_1 = require("./packageVersion.js");
/**
 * A channel factory that creates an {@link ITree}.
 * @internal
 */
class TreeFactory {
    constructor(options) {
        this.options = options;
        this.type = "https://graph.microsoft.com/types/tree";
        this.attributes = {
            type: this.type,
            snapshotFormatVersion: "0.0.0",
            packageVersion: packageVersion_js_1.pkgVersion,
        };
    }
    async load(runtime, id, services, channelAttributes) {
        const tree = new index_js_1.SharedTree(id, runtime, channelAttributes, this.options, "SharedTree");
        await tree.load(services);
        return tree;
    }
    create(runtime, id) {
        const tree = new index_js_1.SharedTree(id, runtime, this.attributes, this.options, "SharedTree");
        tree.initializeLocal();
        return tree;
    }
}
exports.TreeFactory = TreeFactory;
/**
 * SharedTree is a hierarchical data structure for collaboratively editing JSON-like trees
 * of objects, arrays, and other data types.
 *
 * @remarks
 * This implements {@link @fluidframework/fluid-static#SharedObjectClass}.
 * @privateRemarks
 * Due to the dependency structure and the placement of that interface SharedObjectClass,
 * this interface implementation can not be recorded in the type here.
 * @public
 */
exports.SharedTree = {
    /**
     * Gets the factory this factory is a wrapper for.
     */
    getFactory() {
        return new TreeFactory({});
    },
};
//# sourceMappingURL=treeFactory.js.map