import { jsx } from "react/jsx-runtime";
import { AgentIcon, ApiProject } from "../../../../icons/index.js";
import { useState } from "react";
import { BuiltInToolType, ProjectType } from "../../../../types.js";
import { AddDataColumnIcon } from "./AddDataColumnIcon.js";
import { AnalyzeIcon } from "./AnalyzeIcon.js";
import { AttachmentIcon } from "./AttachmentIcon.js";
import { IxpIcon } from "./IXPIcon.js";
import { ProcessIcon } from "./ProcessIcon.js";
const ToolResourceIcon = ({ size = 24, tool })=>{
    const [imgError, setImgError] = useState(false);
    if (tool.iconUrl && !imgError) return /*#__PURE__*/ jsx("img", {
        src: tool.iconUrl,
        alt: tool.name,
        style: {
            width: size,
            height: size,
            objectFit: 'contain'
        },
        onError: ()=>setImgError(true)
    });
    switch(tool.projectType){
        case ProjectType.Agent:
            return /*#__PURE__*/ jsx(AgentIcon, {
                w: size,
                h: size
            });
        case ProjectType.Api:
            return /*#__PURE__*/ jsx(ApiProject, {
                w: size,
                h: size
            });
        case ProjectType.IXP:
            return /*#__PURE__*/ jsx(IxpIcon, {});
        case ProjectType.Internal:
            switch(tool.toolType){
                case BuiltInToolType.AnalyzeAttachments:
                    return /*#__PURE__*/ jsx(AttachmentIcon, {});
                case BuiltInToolType.BatchTransform:
                    return /*#__PURE__*/ jsx(AddDataColumnIcon, {});
                case BuiltInToolType.DeepRAG:
                    return /*#__PURE__*/ jsx(AnalyzeIcon, {});
                case BuiltInToolType.LoadAttachments:
                    return /*#__PURE__*/ jsx(AttachmentIcon, {});
                default:
                    return /*#__PURE__*/ jsx(ProcessIcon, {});
            }
        default:
            return /*#__PURE__*/ jsx(ProcessIcon, {});
    }
};
export { ToolResourceIcon };
