import { AppObjectUC } from "@vived/core";
import { dispatchStateChange } from "../../Dispatcher";
import { LabelEntity } from "../Entities";
import { ClearCustomLabelUndoRedo } from "./ClearCustomLabelUndoRedo";
export class ClearCustomLabelUC extends AppObjectUC {
    get label() {
        return this.getCachedLocalComponent(LabelEntity.type);
    }
    constructor(appObject) {
        super(appObject, ClearCustomLabelUC.type);
        this.clearCustomLabel = () => {
            if (!this.label) {
                this.warn("[ClearCustomLabelUC] Unable to get Entity");
                return;
            }
            if (this.label.custom === "")
                return;
            const prevLabel = this.label.custom;
            this.label.custom = "";
            new ClearCustomLabelUndoRedo(prevLabel, this.appObject);
            dispatchStateChange(this.appObjects);
        };
    }
    static get(appObj) {
        return appObj.getComponent(this.type);
    }
}
ClearCustomLabelUC.type = "ClearCustomLabelUC";
//# sourceMappingURL=ClearCustomLabelUC.js.map