import { makeIsHiddenPM } from "../../Hideable";
import { ClearCustomLabelUC, makeLabelPM, SetCustomLabelUC } from "../../Label";
import { makeOverlayColorPM, SetOverlayColorUC } from "../../OverlayColor";
import { makeSelectableStatePM, Selection } from "../../Selection";
import { makePanTransformUC, makeTransform3DPM } from "../../Transform3D";
import { makeCalloutEntity } from "../Entities";
import { makeCalloutLinePointsPM, makeCalloutOffsetPM, makeCalloutSizePM, } from "../PM";
import { CalloutScaleHook, makeDeleteCalloutUC, makeLookAtCameraUC, makeSetCalloutSizeUC, } from "../UC";
export function makeCalloutFactory(appObjects, options) {
    return function calloutFactory(id) {
        const appObject = appObjects.getOrCreate(id);
        const callout = makeCalloutEntity(appObject);
        // UCs
        makeDeleteCalloutUC(appObject);
        new CalloutScaleHook(appObject);
        new SetCustomLabelUC(appObject);
        new ClearCustomLabelUC(appObject);
        makePanTransformUC(callout.labelTransform.appObject);
        new SetOverlayColorUC(appObject);
        makeSetCalloutSizeUC(appObject);
        // UC
        if (options?.lookAtCameraFactory) {
            options.lookAtCameraFactory(appObject);
        }
        else {
            makeLookAtCameraUC(appObject);
        }
        // PMs
        makeLabelPM(appObject);
        makeTransform3DPM(callout.rootTransform.appObject);
        makeTransform3DPM(callout.labelTransform.appObject);
        makeIsHiddenPM(appObject);
        makeOverlayColorPM(appObject);
        makeSelectableStatePM(appObject);
        makeCalloutLinePointsPM(appObject);
        makeCalloutOffsetPM(appObject);
        makeCalloutSizePM(appObject);
        const selection = Selection.get(appObject.appObjectRepo);
        if (selection) {
            selection.addSelectable(callout.selectable);
        }
        return callout;
    };
}
//# sourceMappingURL=calloutFactory.js.map