"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeCalloutFactory = makeCalloutFactory;
const Hideable_1 = require("../../Hideable");
const Label_1 = require("../../Label");
const OverlayColor_1 = require("../../OverlayColor");
const Selection_1 = require("../../Selection");
const Transform3D_1 = require("../../Transform3D");
const Entities_1 = require("../Entities");
const PM_1 = require("../PM");
const UC_1 = require("../UC");
function makeCalloutFactory(appObjects, options) {
    return function calloutFactory(id) {
        const appObject = appObjects.getOrCreate(id);
        const callout = (0, Entities_1.makeCalloutEntity)(appObject);
        // UCs
        (0, UC_1.makeDeleteCalloutUC)(appObject);
        new UC_1.CalloutScaleHook(appObject);
        new Label_1.SetCustomLabelUC(appObject);
        new Label_1.ClearCustomLabelUC(appObject);
        (0, Transform3D_1.makePanTransformUC)(callout.labelTransform.appObject);
        new OverlayColor_1.SetOverlayColorUC(appObject);
        (0, UC_1.makeSetCalloutSizeUC)(appObject);
        // UC
        if (options?.lookAtCameraFactory) {
            options.lookAtCameraFactory(appObject);
        }
        else {
            (0, UC_1.makeLookAtCameraUC)(appObject);
        }
        // PMs
        (0, Label_1.makeLabelPM)(appObject);
        (0, Transform3D_1.makeTransform3DPM)(callout.rootTransform.appObject);
        (0, Transform3D_1.makeTransform3DPM)(callout.labelTransform.appObject);
        (0, Hideable_1.makeIsHiddenPM)(appObject);
        (0, OverlayColor_1.makeOverlayColorPM)(appObject);
        (0, Selection_1.makeSelectableStatePM)(appObject);
        (0, PM_1.makeCalloutLinePointsPM)(appObject);
        (0, PM_1.makeCalloutOffsetPM)(appObject);
        (0, PM_1.makeCalloutSizePM)(appObject);
        const selection = Selection_1.Selection.get(appObject.appObjectRepo);
        if (selection) {
            selection.addSelectable(callout.selectable);
        }
        return callout;
    };
}
//# sourceMappingURL=calloutFactory.js.map