/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { AllowedUpdateType, StoredSchemaRepository, ITreeCursorSynchronous } from "../core";
import { TreeSchema, TreeFieldSchema, InsertableFlexField } from "../feature-libraries";
import { ISubscribable } from "../events";
import { CheckoutEvents } from "./treeCheckout";
/**
 * Modify `storedSchema` and invoke `setInitialTree` when it's time to set the tree content.
 *
 * Requires `storedSchema` to be in its default/empty state.
 *
 * This is done in such a way that if the content (implicitly assumed to start empty)
 * is never out of schema.
 * This means that if the root field of the new schema requires content (like a value field),
 * a temporary intermediate schema is used so the initial empty state is not out of schema.
 *
 * Since this makes multiple changes, callers may want to wrap it in a transaction.
 */
export declare function initializeContent(storedSchema: StoredSchemaRepository, schema: TreeSchema, setInitialTree: () => void): void;
/**
 * See {@link ISharedTree.schematize} for more details.
 *
 * TODO:
 * - Support adapters for handling out of schema data.
 * - Handle initialization via an adapter.
 * - Support per adapter update policy.
 * - Support lazy schema updates.
 * - Better error for change to invalid schema approach than throwing on later event.
 */
export declare function schematize(events: ISubscribable<CheckoutEvents>, storedSchema: StoredSchemaRepository, config: SchematizeConfiguration): void;
/**
 * @param callback - run after a schema change. If returns true, will run after next change as well.
 */
export declare function afterSchemaChanges(events: ISubscribable<CheckoutEvents>, storedSchema: StoredSchemaRepository, callback: () => boolean): void;
/**
 * View Schema for a `SharedTree`.
 *
 * @alpha
 */
export interface SchemaConfiguration<TRoot extends TreeFieldSchema = TreeFieldSchema> {
    /**
     * The schema which the application wants to view the tree with.
     */
    readonly schema: TreeSchema<TRoot>;
}
/**
 * Content that can populate a `SharedTree`.
 *
 * @alpha
 */
export interface TreeContent<TRoot extends TreeFieldSchema = TreeFieldSchema> extends SchemaConfiguration<TRoot> {
    /**
     * Default tree content to initialize the tree with iff the tree is uninitialized
     * (meaning it does not even have any schema set at all).
     */
    readonly initialTree: InsertableFlexField<TRoot> | readonly ITreeCursorSynchronous[] | ITreeCursorSynchronous;
}
/**
 * Options used to schematize a `SharedTree`.
 *
 * @alpha
 */
export interface SchematizeConfiguration<TRoot extends TreeFieldSchema = TreeFieldSchema> extends SchemaConfiguration<TRoot> {
    /**
     * Controls if and how schema from existing documents can be updated to accommodate the view schema.
     */
    readonly allowedSchemaModifications: AllowedUpdateType;
}
/**
 * Options used to initialize (if needed) and schematize a `SharedTree`.
 *
 * @alpha
 */
export interface InitializeAndSchematizeConfiguration<TRoot extends TreeFieldSchema = TreeFieldSchema> extends TreeContent<TRoot>, SchematizeConfiguration<TRoot> {
}
/**
 * Options used to initialize (if needed) and schematize a `SharedTree`.
 * @remarks
 * Using this builder improves type safety and error quality over just constructing the configuration as a object.
 * @alpha
 */
export declare function buildTreeConfiguration<T extends TreeFieldSchema>(config: InitializeAndSchematizeConfiguration<T>): InitializeAndSchematizeConfiguration<T>;
//# sourceMappingURL=schematizedTree.d.ts.map