/********************************************************************************
 * Copyright (c) 2022-2024 STMicroelectronics and others.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 *
 * This Source Code may also be made available under the following Secondary
 * Licenses when the conditions for such availability set forth in the Eclipse
 * Public License v. 2.0 are satisfied: GNU General Public License, version 2
 * with the GNU Classpath Exception which is available at
 * https://www.gnu.org/software/classpath/license.html.
 *
 * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
 ********************************************************************************/
import { Args, Bounds, Dimension, GModelElementSchema, GModelRootSchema, JsonPrimitive, Point } from '@eclipse-glsp/protocol';
export type GModelElementConstructor<G extends GModelElement = GModelElement> = new () => G;
/**
 * Base type for all elements of the graphical model.
 * Each model element must have a unique ID and a type that is used to look up its view.
 */
export declare abstract class GModelElement implements GModelElementSchema {
    /**
     * The `type` of a `GModelElement` has two main purposes. It is used by the GLSP client
     * during the rendering phase to lookup the View that is responsible for rendering this element.
     * In addition, it serves as the discriminator for serialization & deserialization of `GModeElements` and their corresponding
     * `GModelElementSchema`. e.g. If the glsp server receives a `GModelElementSchema` (plain JSON object) the type is used to
     * lookup and construct the corresponding `GModelElement` class.
     */
    type: string;
    /**
     * Each model element must have a unique ID. Duplicate ids in the graphical element will result in an error during the
     * rendering phase.
     */
    id: string;
    /**
     * A set of css classes that should be applied to the DOM element that corresponds to this element.
     */
    cssClasses: string[];
    /**
     * A `GModelElement can have an arbitrary amount of children. This parent-child relation ship is also reflected in
     * the corresponding DOM element i.e. DOM elements that reflect children of this element are also children
     * of the DOM element that reflects this element.
     */
    children: GModelElement[];
    /**
     * Each `GModelElement` (apart from  the root element) must have an assigned parent. Orphan elements are not allowed.
     */
    parent: GModelElement;
    /**
     * Additional custom arguments. Can be used to transmit additional information between client & server without
     * having to extend the model.
     */
    args?: Args;
    /**
     * Retrieve the {@link GModelRoot} element by traversing up the parent hierachy.
     */
    get root(): GModelRoot;
}
/**
 * A fluent builder API that simplifies the construction of complex {@link GModelElement}s.
 * The builder API is derived from the Java GLSP server implementation where it is used to hide the complexity
 * of creating EMF objects. However, the API is also useful in a Typescript/Node context to declare the creation of a new
 * {@link GModelElement} in a more concise way.
 */
export declare abstract class GModelElementBuilder<G extends GModelElement> {
    protected proxy: G;
    protected elementConstructor: GModelElementConstructor<G>;
    constructor(elementConstructor: GModelElementConstructor<G>);
    reset(): this;
    build(): G;
    id(id: string): this;
    type(type: string): this;
    addCssClass(cssClass: string): this;
    addCssClasses(cssClasses: string[]): this;
    addCssClasses(...cssClasses: string[]): this;
    add(child: GModelElement): this;
    addChildren(children: GModelElement[]): this;
    addChildren(...children: GModelElement[]): this;
    addArg(key: string, value: JsonPrimitive): this;
    addArgs(args: Args): this;
    addArgs(args: Map<string, JsonPrimitive>): this;
}
export declare class GModelRoot extends GModelElement implements GModelRootSchema {
    static builder(): GModelRootBuilder;
    canvasBounds?: Bounds;
    revision?: number;
}
export declare class GModelRootBuilder<G extends GModelRoot = GModelRoot> extends GModelElementBuilder<G> {
    revision(revision: number): this;
    canvasBounds(position: Point, size: Dimension): this;
    canvasBounds(bounds: Bounds): this;
}
//# sourceMappingURL=gmodel-element.d.ts.map