import { AppObjectUC, getSingletonComponent, } from "@vived/core";
import { dispatchStateChange } from "../../Dispatcher";
import { HoverLabelEntity } from "../Entities/HoverLabelEntity";
export class ToggleAllowHoverLabelUC extends AppObjectUC {
    static get(appObjects) {
        return getSingletonComponent(ToggleAllowHoverLabelUC.type, appObjects);
    }
}
ToggleAllowHoverLabelUC.type = "ToggleAllowHoverLabelUC";
export function makeToggleAllowHoverLabel(appObject) {
    return new ToggleAllowHoverLabelIMP(appObject);
}
class ToggleAllowHoverLabelIMP extends ToggleAllowHoverLabelUC {
    constructor(appObject) {
        super(appObject, ToggleAllowHoverLabelUC.type);
        this.toggleAllowHoverLabel = () => {
            if (!this.hoverLabelEntity)
                return;
            this.hoverLabelEntity.allowHoverLabel = !this.hoverLabelEntity
                .allowHoverLabel;
            dispatchStateChange(this.appObjects);
        };
        this.hoverLabelEntity = this.appObject.getComponent(HoverLabelEntity.type);
        if (!this.hoverLabelEntity) {
            this.warn("PM has been added to an App Object that does not have a HoverLabelEntity. Add the Entity first");
        }
    }
}
//# sourceMappingURL=ToggleAllowHoverLabel.js.map