import { TemplateResult, CSSResult } from 'lit';
import { DataNamespace, IDataNamespace, IPatchRevision, IApplication, BroadcastEvent } from '@api-client/core/build/browser.js';
import { JsonPatch } from '@api-client/json';
import { ApplicationInit, ApplicationScreen } from '../ApplicationScreen.js';
import { IRoute, IRouteResult } from '../../mixins/RouteMixin.js';
import { SchemaDesignerContextMenu } from './SchemaDesignerContextMenu.js';
import NavElement from '../../elements/schema-design/SchemaDesignNavigation.js';
import type { HttpClientStoreBindings } from '../../bindings/base/HttpClientStoreBindings.js';
import '../../define/schema-design/schema-design-navigation.js';
import '../../define/data/data-entity-editor.js';
import '../../define/data/data-model-visualization.js';
import '../../define/ui/ui-button.js';
export interface PageInit extends ApplicationInit {
    idb: HttpClientStoreBindings;
}
export default class SchemaDesignerScreen extends ApplicationScreen {
    static get styles(): CSSResult[];
    static get routes(): IRoute[];
    protected _key: string;
    /**
     * The schema file key.
     */
    get key(): string;
    /**
     * The read data namespace.
     */
    root?: DataNamespace;
    protected menu: SchemaDesignerContextMenu;
    nav?: NavElement;
    protected updatingSchema?: boolean;
    protected isDirty?: boolean;
    protected schema?: string;
    /**
     * Own patches sent to the server.
     * These are removed after the sever event is received.
     */
    protected pendingPatches: Map<string, JsonPatch>;
    /**
     * The list of patches made by the current user and received from the server since the beginning of this session
     * or page reload.
     * This is to used to recognize own patches so it won't process a patch that is already applied to the project.
     */
    protected livePatches: Map<string, IPatchRevision>;
    /**
     * The key of the selected item in the root namespace. It corresponds to the `page`.
     */
    selected?: string;
    mediaChannel: BroadcastChannel;
    protected _workspace: string;
    /**
     * The key of the workspace that has the project.
     */
    get workspace(): string;
    constructor(init: PageInit);
    initialize(): Promise<void>;
    storeChanged(): Promise<void>;
    protected setupWorkspaceParameters(): void;
    /**
     * Used to read the namespace file from the backend.
     */
    readNamespaceFile(key: string): Promise<IDataNamespace>;
    /**
     * Stores the patch in the data store.
     * @param key The key of the media file.
     * @param id The generated id of the patch
     * @param value The patch to apply in the backend
     * @param app The application info.
     */
    storePatch(key: string, id: string, value: JsonPatch, app: IApplication): Promise<void>;
    /**
     * A handler for the broadcast channel message which informs about changes to files media.
     */
    protected mediaMessageHandler(e: MessageEvent): void;
    protected openStart(): void;
    protected resetRoute(): void;
    protected defaultRoute(): void;
    protected e404Route(): void;
    protected modelRoute(info: IRouteResult): Promise<void>;
    protected entityRoute(info: IRouteResult): void;
    /**
     * @returns The value of the meta file key encoded in the query params under the `key`.
     */
    protected readFileKey(): string | undefined;
    /**
     * Setups the namespace file during app initialization.
     *
     * @param key The namespace file id
     * @returns true when the namespace was setup correctly. False when there was an error.
     */
    protected setupNamespace(key: string): Promise<boolean>;
    /**
     * A reference to this function is passed to the context menu
     * and it is called when a project mutates.
     */
    protected contextMenuMutationCallback(): void;
    /**
     * Apples changes to a DataNamespace file.
     * @param event The backend event received from the store.
     */
    protected processChangeFileEvent(event: BroadcastEvent): void;
    /**
     * Logic run when a patch operation is reported from the backend.
     * @param rev The revision info from the backend event
     */
    protected processFilePatch(rev: IPatchRevision): void;
    /**
     * To be called when a change in the editor is detected.
     * It prepares the patch and stored it in the data store.
     */
    updateSchema(): Promise<void>;
    protected navigationSelectionHandler(e: CustomEvent): void;
    protected kindToRoute(kind: string): string | undefined;
    protected entityChangeHandler(): void;
    protected entityNameChangeHandler(): void;
    pageTemplate(): TemplateResult;
    protected headerTemplate(): TemplateResult;
    protected navigationTemplate(): TemplateResult;
    protected mainTemplate(): TemplateResult;
    protected e404Template(): TemplateResult;
    protected renderPage(): TemplateResult;
    protected _emptySelectionTemplate(): TemplateResult;
    protected _dataModelTemplate(): TemplateResult;
    protected _entityTemplate(): TemplateResult;
}
//# sourceMappingURL=SchemaDesigner.screen.d.ts.map