"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupLandmarks = setupLandmarks;
const Hideable_1 = require("../../Hideable");
const OverlayColor_1 = require("../../OverlayColor");
const Selection_1 = require("../../Selection");
const Tools_1 = require("../../Tools");
const Transform3D_1 = require("../../Transform3D");
const Controller_1 = require("../Controller");
const Entities_1 = require("../Entities");
const UseCases_1 = require("../UseCases");
const landmarkRepoFactory_1 = require("./landmarkRepoFactory");
function setupLandmarks(appObjects) {
    const landmarksAO = appObjects.getOrCreate("Landmarks");
    const globals = (0, Entities_1.makeLandmarkGlobals)(landmarksAO);
    globals.landmarkRepoFactory = (0, landmarkRepoFactory_1.makeLandmarkRepoFactory)(appObjects);
    // UCs
    new UseCases_1.SerializeLandmarks(landmarksAO);
    (0, UseCases_1.makeDeleteAllLandmarksUC)(landmarksAO);
    (0, UseCases_1.makeTryAddLandmarkUC)(landmarksAO);
    // Controllers
    (0, Controller_1.makeMouseLandmark)(landmarksAO);
    (0, Controller_1.makeTouchLandmark)(landmarksAO);
    const previewAO = appObjects.getOrCreate("LandmarkPreview");
    const preview = (0, Entities_1.makeLandmarkEntity)(previewAO);
    (0, UseCases_1.makeTryPreviewLandmark)(previewAO);
    (0, Transform3D_1.makeTransform3DPM)(previewAO);
    (0, OverlayColor_1.makeOverlayColorPM)(previewAO);
    (0, Selection_1.makeSelectableStatePM)(previewAO);
    (0, Hideable_1.makeIsHiddenPM)(previewAO);
    const previewHidable = Hideable_1.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 = Tools_1.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