import { AppObjectUC, getSingletonComponent, } from "@vived/core";
import { AppDispatcher } from "../Entities/AppDispatcher";
export class DispatchStopZSpaceUC extends AppObjectUC {
    constructor() {
        super(...arguments);
        this.requestType = "STOP_ZSPACE";
    }
}
DispatchStopZSpaceUC.type = "DispatchStopZSpaceUC";
DispatchStopZSpaceUC.get = (appObjects) => getSingletonComponent(DispatchStopZSpaceUC.type, appObjects);
export function makeDispatchStopZSpaceUC(appObject) {
    return new DispatchStateChangeUCImp(appObject);
}
class DispatchStateChangeUCImp extends DispatchStopZSpaceUC {
    constructor(appObject) {
        super(appObject, DispatchStopZSpaceUC.type);
        this.requestVersion = 1;
        this.doDispatch = () => {
            if (!this.appDispatcher)
                return;
            this.appDispatcher.formRequestAndDispatch(this.requestType, this.requestVersion);
        };
        this.appDispatcher = appObject.getComponent(AppDispatcher.type);
        if (!this.appDispatcher) {
            this.warn("DispatchStopZSpaceUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
            this.dispose();
        }
    }
}
//# sourceMappingURL=DispatchStopZSpaceUC.js.map