import { FILE_URL } from "../../Config";
import Icon from "../Icon/Icon";
import Image from "../Image/Image";
import BaseModel from "../../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
import URL from "../../../Types/API/URL";
import IconProp from "../../../Types/Icon/IconProp";
import Probe from "../../../Models/DatabaseModels/Probe";
import React from "react";
const ProbeElement = (props) => {
    var _a, _b, _c, _d, _e;
    let probe = null;
    if (props.probe instanceof Probe) {
        probe = BaseModel.toJSONObject(props.probe, Probe);
    }
    else {
        probe = props.probe;
    }
    if (!probe) {
        return (React.createElement("div", { className: "flex" },
            React.createElement("div", { className: "bold", "data-testid": "probe-not-found" }, "No probe found.")));
    }
    return (React.createElement("div", { className: "flex" },
        React.createElement("div", null,
            ((_a = props.probe) === null || _a === void 0 ? void 0 : _a.iconFileId) && (React.createElement(Image, { className: "h-6 w-6 rounded-full", "data-testid": "probe-image", imageUrl: URL.fromString(FILE_URL.toString()).addRoute("/image/" + ((_b = props.probe) === null || _b === void 0 ? void 0 : _b.iconFileId.toString())), alt: ((_c = probe["name"]) === null || _c === void 0 ? void 0 : _c.toString()) || "Probe" })),
            !((_d = props.probe) === null || _d === void 0 ? void 0 : _d.iconFileId) && (React.createElement(Icon, { "data-testid": "probe-icon", icon: IconProp.Signal, className: "text-gray-400 group-hover:text-gray-500 flex-shrink-0 -ml-0.5 mt-0.5 h-6 w-6" }))),
        React.createElement("div", { className: "mt-1 mr-1 ml-3" },
            React.createElement("div", null,
                React.createElement("span", { "data-testid": "probe-name" }, `${((_e = probe["name"]) === null || _e === void 0 ? void 0 : _e.toString()) || ""} ${props.suffix || ""}`),
                " "))));
};
export default ProbeElement;
//# sourceMappingURL=Probe.js.map