import { Hideable, makeIsHiddenPM } from "../../Hideable";
import { makeOverlayColorPM } from "../../OverlayColor";
import { makeSelectableStatePM } from "../../Selection";
import { ToolRepository } from "../../Tools";
import { makeTransform3DPM } from "../../Transform3D";
import { makeMouseLandmark, makeTouchLandmark } from "../Controller";
import { makeLandmarkEntity, makeLandmarkGlobals } from "../Entities";
import { makeDeleteAllLandmarksUC, makeTryAddLandmarkUC, makeTryPreviewLandmark, SerializeLandmarks, } from "../UseCases";
import { makeLandmarkRepoFactory } from "./landmarkRepoFactory";
export function setupLandmarks(appObjects) {
    const landmarksAO = appObjects.getOrCreate("Landmarks");
    const globals = makeLandmarkGlobals(landmarksAO);
    globals.landmarkRepoFactory = makeLandmarkRepoFactory(appObjects);
    // UCs
    new SerializeLandmarks(landmarksAO);
    makeDeleteAllLandmarksUC(landmarksAO);
    makeTryAddLandmarkUC(landmarksAO);
    // Controllers
    makeMouseLandmark(landmarksAO);
    makeTouchLandmark(landmarksAO);
    const previewAO = appObjects.getOrCreate("LandmarkPreview");
    const preview = makeLandmarkEntity(previewAO);
    makeTryPreviewLandmark(previewAO);
    makeTransform3DPM(previewAO);
    makeOverlayColorPM(previewAO);
    makeSelectableStatePM(previewAO);
    makeIsHiddenPM(previewAO);
    const previewHidable = Hideable.get(previewAO.id, appObjects);
    if (previewHidable) {
        previewHidable.ignoreSerialization = true;
    }
    else {
        appObjects.submitError("setupLandmarks", "Unable to find Hideable on preview landmark");
    }
    globals.previewLandmark = preview;
    // Setup Tool
    const toolRepo = ToolRepository.get(appObjects);
    if (!toolRepo) {
        appObjects.submitError("setupLandmarks", "Unable to find tool repo");
        return landmarksAO;
    }
    toolRepo.makeToolFromData({
        toolType: "LANDMARK",
        isDefault: false,
        label: "Landmark",
        shortcutLabel: "l",
        hotkeys: [{ keyCode: "KeyL" }],
    });
    return landmarksAO;
}
//# sourceMappingURL=setupLandmarks.js.map