"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DispatchStartZSpaceUC = void 0;
exports.makeDispatchStartZSpaceUC = makeDispatchStartZSpaceUC;
const core_1 = require("@vived/core");
const AppDispatcher_1 = require("../Entities/AppDispatcher");
class DispatchStartZSpaceUC extends core_1.AppObjectUC {
    constructor() {
        super(...arguments);
        this.requestType = "START_ZSPACE";
    }
}
exports.DispatchStartZSpaceUC = DispatchStartZSpaceUC;
DispatchStartZSpaceUC.type = "DispatchStartZSpaceUC";
DispatchStartZSpaceUC.get = (appObjects) => (0, core_1.getSingletonComponent)(DispatchStartZSpaceUC.type, appObjects);
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_1.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