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 AIAgent from "../../../Models/DatabaseModels/AIAgent";
import React from "react";
const AIAgentElement = (props) => {
    var _a, _b, _c, _d, _e;
    let aiAgent = null;
    if (props.aiAgent instanceof AIAgent) {
        aiAgent = BaseModel.toJSONObject(props.aiAgent, AIAgent);
    }
    else {
        aiAgent = props.aiAgent;
    }
    if (!aiAgent) {
        return (React.createElement("div", { className: "flex" },
            React.createElement("div", { className: "bold", "data-testid": "ai-agent-not-found" }, "No AI agent found.")));
    }
    return (React.createElement("div", { className: "flex" },
        React.createElement("div", null,
            ((_a = props.aiAgent) === null || _a === void 0 ? void 0 : _a.iconFileId) && (React.createElement(Image, { className: "h-6 w-6 rounded-full", "data-testid": "ai-agent-image", imageUrl: URL.fromString(FILE_URL.toString()).addRoute("/image/" + ((_b = props.aiAgent) === null || _b === void 0 ? void 0 : _b.iconFileId.toString())), alt: ((_c = aiAgent["name"]) === null || _c === void 0 ? void 0 : _c.toString()) || "AI Agent" })),
            !((_d = props.aiAgent) === null || _d === void 0 ? void 0 : _d.iconFileId) && (React.createElement(Icon, { "data-testid": "ai-agent-icon", icon: IconProp.Automation, 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": "ai-agent-name" }, `${((_e = aiAgent["name"]) === null || _e === void 0 ? void 0 : _e.toString()) || ""} ${props.suffix || ""}`),
                " "))));
};
export default AIAgentElement;
//# sourceMappingURL=AIAgent.js.map