import { ComponentType } from "../common/constant";
import EventEmitter from "../common/event-emitter";
import { DTModel, DTModelGroup } from "./model";
export interface Options {
    type: ComponentType;
    name: string;
    realType: string;
    realId: string | undefined;
    modelId: string;
    parentId?: string | undefined;
    children?: Array<Options>;
    url?: string | undefined;
    exists?: boolean;
    mappingUrl?: string | undefined;
    props?: {
        type?: string;
        tags?: string[];
        position?: number[];
        rotation?: number[];
        scale?: number[];
        isCustom?: boolean;
    } & Record<string, any>;
    extension?: {
        sync?: boolean;
        preload?: boolean;
        geo?: {
            longitude: number;
            latitude: number;
        };
    } & Record<string, any>;
}
export interface ComponentProperty<M extends DTModel> {
    isComponent: boolean;
    id: string;
    modelId: string;
    type: string;
    ext: {
        typeCode: string | number;
        tags: string[];
        type: string;
        other: Record<string, any>;
        name: string;
        geo: {
            longitude?: number;
            latitude?: number;
        };
    };
    parent: Component<M> | undefined;
    children: Component<M>[];
    model: M;
}
export interface ComponentMethod<M extends DTModel> {
    search(type: string, shallow?: boolean): ComponentGroup<M>;
    get(id: string, shallow?: boolean): Component<M> | undefined;
    filter(callback: (component: Component<M>) => boolean, shallow?: boolean): ComponentGroup<M>;
    add(child: Component<M> | string | Partial<Options>, attach?: boolean): Promise<Component<M>>;
    remove(child: Component<M>): Promise<void>;
    removeFromParent(): Promise<void>;
    replace(target: Component<M>): void;
    dispose(): Promise<void>;
    clear(): Promise<void>;
}
export interface ComponentGroup<M extends DTModel> extends Array<Component<M>> {
    isGroup: boolean;
    model: DTModelGroup<M>;
    removeFromParent(): Promise<void>;
    dispose(): Promise<void>;
    clear(): Promise<void>;
}
export type Component<M extends DTModel> = ComponentProperty<M> & ComponentMethod<M> & EventEmitter;
