import { dispatchStateChange } from "../../Dispatcher";
import { UndoRedoEntity } from "../../UndoRedo";
import { LabelEntity } from "../Entities";
export class ClearCustomLabelUndoRedo {
    constructor(prevLabel, appObject) {
        this.prevLabel = prevLabel;
        this.appObject = appObject;
        this.undoAction = () => {
            if (!this.label)
                return;
            this.label.custom = this.prevLabel;
            dispatchStateChange(this.appObject.appObjectRepo);
        };
        this.redoAction = () => {
            if (!this.label)
                return;
            this.label.custom = "";
            dispatchStateChange(this.appObject.appObjectRepo);
        };
        this.label = LabelEntity.get(appObject);
        if (!this.label) {
            appObject.appObjectRepo.submitWarning("ClearCustomLabelUndoRedo", "Unable to find LabelEntity");
            return;
        }
        const undoRedo = UndoRedoEntity.get(appObject.appObjectRepo);
        if (!undoRedo) {
            appObject.appObjectRepo.submitWarning("ClearCustomLabelUndoRedo", "Unable to find UndoRedoEntity");
            return;
        }
        undoRedo.submitAction(this);
    }
}
//# sourceMappingURL=ClearCustomLabelUndoRedo.js.map