import { dispatchStateChange } from "../../Dispatcher/UC/DispatchStateChangeUC";
import { UndoRedoEntity, } from "../../UndoRedo/Entities/UndoRedoEntity";
import { LandmarkRepo } from "../Entities/LandmarkRepo";
export class DeleteLandmarkUndoRedo {
    get landmarkRepo() {
        return LandmarkRepo.getByID(this.landmarkDTO.parentID, this.appObjects);
    }
    constructor(landmarkDTO, appObjects) {
        this.landmarkDTO = landmarkDTO;
        this.appObjects = appObjects;
        this.undoAction = () => {
            if (!this.landmarkRepo)
                return;
            const landmark = this.landmarkRepo.createLandmark(this.landmarkDTO.id);
            landmark.data = this.landmarkDTO;
            dispatchStateChange(this.appObjects);
        };
        this.redoAction = () => {
            if (!this.landmarkRepo)
                return;
            this.landmarkRepo.deleteLandmark(this.landmarkDTO.id);
            dispatchStateChange(this.appObjects);
        };
        const undoRedo = UndoRedoEntity.get(appObjects);
        if (!undoRedo) {
            appObjects.submitWarning("DeleteLandmarkUndoRedo", "Unable to find UndoRedoEntity");
            return;
        }
        undoRedo.submitAction(this);
    }
}
//# sourceMappingURL=DeleteLandmarkUndoRedo.js.map