import { AppObjectUC, getSingletonComponent, } from "@vived/core";
import { AppDispatcher } from "../Entities/AppDispatcher";
export class DispatchStartZSpaceUC extends AppObjectUC {
    constructor() {
        super(...arguments);
        this.requestType = "START_ZSPACE";
    }
}
DispatchStartZSpaceUC.type = "DispatchStartZSpaceUC";
DispatchStartZSpaceUC.get = (appObjects) => getSingletonComponent(DispatchStartZSpaceUC.type, appObjects);
export function makeDispatchStartZSpaceUC(appObject) {
    return new DispatchStateChangeUCImp(appObject);
}
class DispatchStateChangeUCImp extends DispatchStartZSpaceUC {
    constructor(appObject) {
        super(appObject, DispatchStartZSpaceUC.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("DispatchStartZSpaceUC has been added to an App Object that does not have a AppDispatcher. Add a dispatcher first");
            this.dispose();
        }
    }
}
//# sourceMappingURL=DispatchStartZSpaceUC.js.map