/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { Dependee, SimpleDependee } from "../dependency-tracking";
import { ISubscribable } from "../../events";
import { GlobalFieldKey, FieldStoredSchema, TreeSchemaIdentifier, TreeStoredSchema, SchemaData, SchemaPolicy } from "./schema";
/**
 * A {@link SchemaData} with a {@link SchemaPolicy}.
 * @alpha
 */
export interface SchemaDataAndPolicy<TPolicy extends SchemaPolicy = SchemaPolicy> extends SchemaData {
    /**
     * Configuration information, including the defaults for schema which have no been added yet.
     */
    readonly policy: TPolicy;
}
/**
 * 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: SchemaData): void;
    /**
     * Schema change was just applied.
     */
    afterSchemaChange(newSchema: SchemaData): void;
}
/**
 * Mutable collection of stored schema.
 *
 * TODO: could implement more fine grained dependency tracking.
 * @alpha
 */
export interface StoredSchemaRepository<TPolicy extends SchemaPolicy = SchemaPolicy> extends Dependee, ISubscribable<SchemaEvents>, SchemaDataAndPolicy<TPolicy> {
    /**
     * Add the provided schema, possibly over-writing preexisting schema.
     */
    update(newSchema: SchemaData): void;
}
/**
 * StoredSchemaRepository for in memory use:
 * not hooked up to Fluid (does not create Fluid ops when editing).
 */
export declare class InMemoryStoredSchemaRepository<TPolicy extends SchemaPolicy = SchemaPolicy> extends SimpleDependee implements StoredSchemaRepository<TPolicy> {
    readonly policy: TPolicy;
    protected readonly data: MutableSchemaData;
    private readonly events;
    /**
     * For now, the schema are just scored in maps.
     * There are a couple reasons we might not want this simple solution long term:
     * 1. We might want an easy/fast copy.
     * 2. We might want a way to reserve a large namespace of schema with the same schema.
     * The way extraFields 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 extraFields (which is a bit odd).
     */
    constructor(policy: TPolicy, data?: SchemaData);
    on<K extends keyof SchemaEvents>(eventName: K, listener: SchemaEvents[K]): () => void;
    clone(): InMemoryStoredSchemaRepository;
    get globalFieldSchema(): ReadonlyMap<GlobalFieldKey, FieldStoredSchema>;
    get treeSchema(): ReadonlyMap<TreeSchemaIdentifier, TreeStoredSchema>;
    update(newSchema: SchemaData): void;
}
interface MutableSchemaData extends SchemaData {
    globalFieldSchema: Map<GlobalFieldKey, FieldStoredSchema>;
    treeSchema: Map<TreeSchemaIdentifier, TreeStoredSchema>;
}
export declare function lookupGlobalFieldSchema(data: SchemaDataAndPolicy, identifier: GlobalFieldKey): FieldStoredSchema;
export declare function lookupTreeSchema(data: SchemaDataAndPolicy, identifier: TreeSchemaIdentifier): TreeStoredSchema;
export declare function schemaDataIsEmpty(data: SchemaData): boolean;
export {};
//# sourceMappingURL=storedSchemaRepository.d.ts.map