"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupLabelDrop = setupLabelDrop;
const core_1 = require("@vived/core");
const Stylus_1 = require("../../Stylus");
const Transform3D_1 = require("../../Transform3D");
const zSpace_1 = require("../../zSpace");
const Controller_1 = require("../Controller");
const Entities_1 = require("../Entities");
const PM_1 = require("../PM");
const UseCases_1 = require("../UseCases");
const labelDropItemFactory_1 = require("./labelDropItemFactory");
function setupLabelDrop(appObjects) {
    const ao = appObjects.getOrCreate("LabelDrop");
    // Entity
    const labelDropEntity = (0, Entities_1.makeLabelDropRepo)(ao);
    labelDropEntity.labelDropItemFactory = (0, labelDropItemFactory_1.makeLabelDropItemFactory)(appObjects);
    // UCs
    new UseCases_1.SerializeLabelDrop(ao);
    new UseCases_1.ClearEditingLabelDropUCHook(ao);
    (0, UseCases_1.makeEditLabelDropUC)(ao);
    (0, UseCases_1.makeDragLabelDropUC)(ao);
    (0, UseCases_1.makeDragLabelDropWorldUC)(ao);
    (0, UseCases_1.makeDeleteLabelDropUC)(ao);
    (0, UseCases_1.makeDeleteAllLabelDropUC)(ao);
    (0, UseCases_1.makeToggleLabelDropTargetUC)(ao);
    (0, UseCases_1.makeLabelDropCorrectAnimationUC)(ao);
    (0, UseCases_1.makeLabelDropOnNothingAnimationUC)(ao);
    (0, UseCases_1.makeLabelDropIncorrectAnimationUC)(ao);
    (0, UseCases_1.makeValidateLabelDrop)(ao);
    // PMs
    (0, PM_1.makeLabelDropEditingIDPM)(ao);
    (0, PM_1.makeRemainingLabelDropListPM)(ao);
    (0, PM_1.makeLabelDropReviewPM)(ao);
    (0, Transform3D_1.makeTransform3DPM)(ao);
    (0, PM_1.makeLabelDropDragItemPM)(ao);
    (0, PM_1.makeLabelDropListPM)(ao);
    // Controllers
    (0, Controller_1.makeMouseLabelDropAuthor)(ao);
    (0, Controller_1.makeTouchLabelDropAuthor)(ao);
    (0, Controller_1.makeStylusLabelDrop)(ao);
    const stylus = Stylus_1.StylusEntity.get(appObjects);
    if (!stylus) {
        appObjects.submitError("setupLabelDrop", "StylusEntity needs to be setup before Label Drop");
    }
    else {
        labelDropEntity.dragHelperTransform.parent = stylus.transform;
        labelDropEntity.dragHelperTransform.localPosition = core_1.Vector3.Zero();
        labelDropEntity.dragHelperTransform.localRotation = core_1.Quaternion.Identity();
        labelDropEntity.dragHelperTransform.localScale = core_1.Vector3.One();
    }
    const zSpace = zSpace_1.ZSpaceEntity.get(appObjects);
    if (!zSpace) {
        appObjects.submitError("setupLabelDrop", "zSpace needs to be setup before Label Drop");
    }
    else {
        labelDropEntity.dragLabelTransform.parent = zSpace.display.transform;
        labelDropEntity.dragLabelTransform.localPosition = core_1.Vector3.Zero();
        labelDropEntity.dragLabelTransform.localRotation = core_1.Quaternion.Identity();
        labelDropEntity.dragLabelTransform.localScale = core_1.Vector3.One();
    }
}
//# sourceMappingURL=setupLabelDrop.js.map