/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import BTree from "sorted-btree";
import { ISubscribable } from "../../events";
import { TreeFieldStoredSchema, TreeNodeSchemaIdentifier, TreeNodeStoredSchema, TreeStoredSchema } from "./schema";
/**
 * Events for {@link StoredSchemaRepository}.
 *
 * TODO: consider having before and after events per subtree instead while applying anchor (and this just shows what happens at the root).
 * @alpha
 */
export interface SchemaEvents {
    /**
     * Schema change is about to be applied.
     */
    beforeSchemaChange(newSchema: TreeStoredSchema): void;
    /**
     * Schema change was just applied.
     */
    afterSchemaChange(newSchema: TreeStoredSchema): void;
}
/**
 * Mutable collection of stored schema.
 *
 * TODO: could implement more fine grained dependency tracking.
 * @alpha
 */
export interface StoredSchemaRepository extends ISubscribable<SchemaEvents>, TreeStoredSchema {
    /**
     * Replaces all schema with the provided schema.
     * Can over-write preexisting schema, and removes unmentioned schema.
     */
    update(newSchema: TreeStoredSchema): void;
}
/**
 * StoredSchemaRepository for in memory use:
 * not hooked up to Fluid (does not create Fluid ops when editing).
 */
export declare class InMemoryStoredSchemaRepository implements StoredSchemaRepository {
    protected nodeSchemaData: BTree<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>;
    protected rootFieldSchemaData: TreeFieldStoredSchema;
    protected readonly events: ISubscribable<SchemaEvents> & import("../../events").IEmitter<SchemaEvents> & import("../../events").HasListeners<SchemaEvents>;
    /**
     * Copies in the provided schema. If `data` is an InMemoryStoredSchemaRepository, it will be cheap-cloned.
     * Otherwise, it will be deep-cloned.
     *
     * We might not want to store schema in maps long term, as we might want a way to reserve a
     * large space of schema IDs within a schema.
     * The way mapFields has been structured mitigates the need for this, but it still might be useful.
     *
     * (ex: someone using data as field identifiers might want to
     * reserve all fields identifiers starting with "foo." to have a specific schema).
     * Combined with support for such namespaces in the allowed sets in the schema objects,
     * that might provide a decent alternative to mapFields (which is a bit odd).
     */
    constructor(data?: TreeStoredSchema);
    on<K extends keyof SchemaEvents>(eventName: K, listener: SchemaEvents[K]): () => void;
    get nodeSchema(): ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>;
    get rootFieldSchema(): TreeFieldStoredSchema;
    update(newSchema: TreeStoredSchema): void;
    private cloneData;
}
export declare function schemaDataIsEmpty(data: TreeStoredSchema): boolean;
//# sourceMappingURL=storedSchemaRepository.d.ts.map