import { dispatchStateChange } from "../../Dispatcher/UC/DispatchStateChangeUC";
import { OverlayColor, OverlayColorEnums, } from "../../OverlayColor/Entities/OverlayColor";
import { UndoRedoEntity, } from "../../UndoRedo/Entities/UndoRedoEntity";
export class ClearAllColorOverlayUndoRedo {
    constructor(undoState, appObjects) {
        this.undoState = undoState;
        this.appObjects = appObjects;
        this.undoAction = () => {
            this.undoState.forEach((color, id) => {
                const overlay = OverlayColor.getByID(id, this.appObjects);
                if (overlay) {
                    overlay.overlayColor = color;
                }
            });
            dispatchStateChange(this.appObjects);
        };
        this.redoAction = () => {
            this.undoState.forEach((color, id) => {
                const overlay = OverlayColor.getByID(id, this.appObjects);
                if (overlay) {
                    overlay.overlayColor = OverlayColorEnums.NONE;
                }
            });
            dispatchStateChange(this.appObjects);
        };
        const undoRedo = UndoRedoEntity.get(appObjects);
        if (!undoRedo) {
            appObjects.submitError("ClearAllColorOverlayUndoRedo", "Unable to find UndoRedoEntity");
            return;
        }
        undoRedo.submitAction(this);
    }
}
//# sourceMappingURL=ClearAllColorOverlayUndoRedo.js.map