/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { SharedTree as SharedTreeImpl } from "./shared-tree/index.js";
import { pkgVersion } from "./packageVersion.js";
/**
 * A channel factory that creates an {@link ITree}.
 * @internal
 */
export 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: pkgVersion,
        };
    }
    async load(runtime, id, services, channelAttributes) {
        const tree = new SharedTreeImpl(id, runtime, channelAttributes, this.options, "SharedTree");
        await tree.load(services);
        return tree;
    }
    create(runtime, id) {
        const tree = new SharedTreeImpl(id, runtime, this.attributes, this.options, "SharedTree");
        tree.initializeLocal();
        return tree;
    }
}
/**
 * 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
 */
export const SharedTree = {
    /**
     * Gets the factory this factory is a wrapper for.
     */
    getFactory() {
        return new TreeFactory({});
    },
};
//# sourceMappingURL=treeFactory.js.map