"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TrackingCamera = exports.trackingCameraResolver = void 0;
const integration_base_1 = require("@things-factory/integration-base");
const robotics_types_1 = require("../../../controllers/robotics-types");
exports.trackingCameraResolver = {
    async trackingCamera(_, { name }, context) {
        const { domain } = context.state;
        var connection = integration_base_1.ConnectionManager.getConnectionInstanceByName(domain, name);
        if (!connection || connection.discriminator !== robotics_types_1.ROBOTICS_OBJECT_TYPES.CAMERA) {
            throw Error(`TrackingCamera '${name}' Not Found`);
        }
        var { handEyeConfig, handEyeMatrix, cameraCalibration, rois, camObjOffset, width, height } = connection.params || {};
        var { cameraMatrix, distortionCoefficient } = cameraCalibration || {};
        return Object.assign(Object.assign({}, connection), { cameraMatrix,
            distortionCoefficient,
            handEyeConfig,
            handEyeMatrix,
            rois,
            camObjOffset,
            width,
            height });
    }
};
exports.TrackingCamera = {
    async baseRobotArm(trackingCamera) {
        const { domain } = trackingCamera;
        const { baseRobotArm } = trackingCamera.params || {};
        var baseRobotArmObj = integration_base_1.ConnectionManager.getConnectionInstanceByName(domain, baseRobotArm);
        if (!baseRobotArmObj || baseRobotArmObj.discriminator !== robotics_types_1.ROBOTICS_OBJECT_TYPES.ROBOT_ARM) {
            return;
        }
        return baseRobotArmObj;
    }
};
//# sourceMappingURL=tracking-camera.js.map