import { Article, GfxType, Session, GfxRepresentation } from "@intelligentgraphics/igd.productdata";
import { AsyncHook } from "@intelligentgraphics/ig.utilities";
import * as Core from "@intelligentgraphics/ig.gfx.core";
import { _API } from "@intelligentgraphics/ig.gfx.core";
import { LoadScheduler } from "./Scheduler";
export interface ArticleInserterOptions {
    gfxType: GfxType;
    disableHashOptimizations: boolean;
    loadMode: Core.ELoadGeometryPreviews | undefined;
    executeArticlePlacement?: PlaceArticleCallback;
}
export declare type PlaceArticleCallback = (api: Core._API, comId: string, gfxId: string) => void;
export declare type ArticleUpdateType = "geometric" | "materialOnly";
export interface ArticleUpdateCallbackParams {
    initial: boolean;
    status: "preview" | "final";
    updateType: ArticleUpdateType;
}
interface ArticleStatus {
    status: "preview";
    gfxRepresentation: GfxRepresentation;
    configurationHash: string;
}
declare type Result<T, E> = (T extends void ? {
    status: "ok";
} : {
    status: "ok";
    data: T;
}) | {
    status: "error";
    error: E;
};
export declare type InsertSingleArticleError = {
    type: "articleUnknown";
} | {
    type: "noGfxRepresentation";
} | {
    type: "unknown";
    error: Error;
};
export declare type InsertSingleArticleResult = Result<void, InsertSingleArticleError> | {
    status: "updateRequired";
};
export interface ArticleGfxUpdate {
    article: Article;
    force: boolean;
    animationPositionChange: boolean;
    configurationOrArticleIdChange: boolean;
}
export declare class ArticleInserter {
    private readonly session;
    private readonly api;
    private readonly loadScheduler;
    private readonly options;
    hooks: {
        /**
         * before a gfx representation is loaded
         */
        prepareForUpdate: AsyncHook<[Article, GfxType]>;
        /**
         * after a gfx representation is loaded and we want to manipulate the gfx representation in the scene
         */
        manipulateAfterUpdate: AsyncHook<[Article, ArticleUpdateCallbackParams]>;
        /**
         * after loading and manipulation of loaded articles
         */
        articleUpdateDone: AsyncHook<[Article, ArticleUpdateCallbackParams]>;
    };
    private articleStatus;
    constructor(session: Session, api: _API, loadScheduler: LoadScheduler, options: ArticleInserterOptions);
    getArticleLoadingStatus(comId: string): ArticleStatus | undefined;
    /**
     * Loads a gfx update for the article
     *
     * @private
     * @param {string} comId
     */
    insertSingleArticle({ article, configurationOrArticleIdChange, force, animationPositionChange, }: ArticleGfxUpdate): Promise<InsertSingleArticleResult>;
    private synchronizeArticleSessionPlacement;
    private canLoadAsPreview;
    private getSceneArticlePlacement;
    private applyComponentData;
    private updatePlanningMaterials;
    private applyMultiArticleUserData;
    private setChildSelectionMode;
    private prepareRoot;
    private prepareNiches;
    private tryApplyPlacement;
    private executeDefaultPlacement;
}
export {};
