"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupHoverLabel = setupHoverLabel;
const core_1 = require("@vived/core");
const Stylus_1 = require("../../Stylus");
const Transform3D_1 = require("../../Transform3D");
const Controllers_1 = require("../Controllers");
const Entities_1 = require("../Entities");
const PM_1 = require("../PM");
const UseCases_1 = require("../UseCases");
function setupHoverLabel(appObjects, options) {
    const hoverLabelAO = appObjects.getOrCreate("HoverLabel");
    // Entity
    const hoverLabelEntity = (0, Entities_1.makeHoverLabelEntity)(hoverLabelAO);
    // UC
    if (options?.tryShowFactory) {
        options.tryShowFactory(hoverLabelAO);
    }
    else {
        (0, UseCases_1.makeTryShowHoverLabel)(hoverLabelAO);
    }
    (0, UseCases_1.makeToggleAllowHoverLabel)(hoverLabelAO);
    new UseCases_1.SerializeAllowHoverLabel(hoverLabelAO);
    // PM
    (0, PM_1.makeWorldHoverLabelPM)(hoverLabelAO);
    (0, PM_1.makeScreenHoverLabelPM)(hoverLabelAO);
    (0, PM_1.makeAllowHoverLabelPM)(hoverLabelAO);
    (0, Transform3D_1.makeTransform3DPM)(hoverLabelAO);
    // Controller
    (0, Controllers_1.makeHoverLabelMouse)(hoverLabelAO);
    (0, Controllers_1.makeHoverLabelTouch)(hoverLabelAO);
    (0, Controllers_1.makeStylusHoverLabelController)(hoverLabelAO);
    const stylus = Stylus_1.StylusEntity.get(appObjects);
    if (!stylus) {
        appObjects.submitError("setupHoverLabel", "StylusEntity needs to be setup before Hover Label");
    }
    else {
        hoverLabelEntity.transform.parent = stylus.transform;
        hoverLabelEntity.transform.localPosition = core_1.Vector3.Zero();
        hoverLabelEntity.transform.localRotation = core_1.Quaternion.Identity();
        hoverLabelEntity.transform.localScale = core_1.Vector3.One();
    }
    return hoverLabelEntity;
}
//# sourceMappingURL=setupHoverLabel.js.map