"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Mutation = void 0;
const robotics_types_1 = require("../../../controllers/robotics-types");
const integration_base_1 = require("@things-factory/integration-base");
exports.Mutation = {
    async updateTrackingWorkspaceStatus(_, { name, status }, context) {
        const { domain } = context.state;
        var workspace = integration_base_1.ConnectionManager.getConnectionInstanceByName(domain, name);
        if (!workspace || workspace.discriminator !== robotics_types_1.ROBOTICS_OBJECT_TYPES.WORKSPACE) {
            throw Error(`Tracking Workspace '${name}' Not Found`);
        }
        var { engine, params } = workspace;
        var storage = engine.trackingStorage;
        var { objectStatus } = status;
        objectStatus.forEach(objectState => {
            var { id, state } = objectState;
            var { roi, pose } = state || {};
            storage.updateObjectState(id, roi, pose, params === null || params === void 0 ? void 0 : params.poseThreshold);
        });
        return true;
    }
};
//# sourceMappingURL=tracking-workspace-mutation.js.map