import { Quaternion, Vector3 } from "@vived/core";
import { StylusEntity } from "../../Stylus";
import { makeTransform3DPM } from "../../Transform3D";
import { ZSpaceEntity } from "../../zSpace";
import { makeMouseLabelDropAuthor, makeStylusLabelDrop, makeTouchLabelDropAuthor, } from "../Controller";
import { makeLabelDropRepo } from "../Entities";
import { makeLabelDropDragItemPM, makeLabelDropEditingIDPM, makeLabelDropListPM, makeLabelDropReviewPM, makeRemainingLabelDropListPM, } from "../PM";
import { ClearEditingLabelDropUCHook, makeDeleteAllLabelDropUC, makeDeleteLabelDropUC, makeDragLabelDropUC, makeDragLabelDropWorldUC, makeEditLabelDropUC, makeLabelDropCorrectAnimationUC, makeLabelDropIncorrectAnimationUC, makeLabelDropOnNothingAnimationUC, makeToggleLabelDropTargetUC, makeValidateLabelDrop, SerializeLabelDrop, } from "../UseCases";
import { makeLabelDropItemFactory } from "./labelDropItemFactory";
export function setupLabelDrop(appObjects) {
    const ao = appObjects.getOrCreate("LabelDrop");
    // Entity
    const labelDropEntity = makeLabelDropRepo(ao);
    labelDropEntity.labelDropItemFactory = makeLabelDropItemFactory(appObjects);
    // UCs
    new SerializeLabelDrop(ao);
    new ClearEditingLabelDropUCHook(ao);
    makeEditLabelDropUC(ao);
    makeDragLabelDropUC(ao);
    makeDragLabelDropWorldUC(ao);
    makeDeleteLabelDropUC(ao);
    makeDeleteAllLabelDropUC(ao);
    makeToggleLabelDropTargetUC(ao);
    makeLabelDropCorrectAnimationUC(ao);
    makeLabelDropOnNothingAnimationUC(ao);
    makeLabelDropIncorrectAnimationUC(ao);
    makeValidateLabelDrop(ao);
    // PMs
    makeLabelDropEditingIDPM(ao);
    makeRemainingLabelDropListPM(ao);
    makeLabelDropReviewPM(ao);
    makeTransform3DPM(ao);
    makeLabelDropDragItemPM(ao);
    makeLabelDropListPM(ao);
    // Controllers
    makeMouseLabelDropAuthor(ao);
    makeTouchLabelDropAuthor(ao);
    makeStylusLabelDrop(ao);
    const stylus = 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 = Vector3.Zero();
        labelDropEntity.dragHelperTransform.localRotation = Quaternion.Identity();
        labelDropEntity.dragHelperTransform.localScale = Vector3.One();
    }
    const zSpace = 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 = Vector3.Zero();
        labelDropEntity.dragLabelTransform.localRotation = Quaternion.Identity();
        labelDropEntity.dragLabelTransform.localScale = Vector3.One();
    }
}
//# sourceMappingURL=setupLabelDrop.js.map