<template>
    <component :is="icon" class="tool-icon w-3.5 h-3.5 inline shrink-0" />
</template>

<script setup lang="ts">
import { computed } from 'vue';
import {
    BookOpenIcon,
    PencilIcon,
    WrenchIcon,
    DocumentPlusIcon,
    BoltIcon,
    GlobeAltIcon,
    CpuChipIcon,
    ComputerDesktopIcon,
    ChatBubbleLeftIcon,
    LinkIcon,
    Cog6ToothIcon,
} from '@heroicons/vue/20/solid';

const props = defineProps<{ tool: string }>();

const iconMap: Record<string, any> = {
    read: BookOpenIcon,
    write: PencilIcon,
    edit: WrenchIcon,
    append: DocumentPlusIcon,
    exec: BoltIcon,
    web_search: GlobeAltIcon,
    web_fetch: GlobeAltIcon,
    memory_search: CpuChipIcon,
    memory_get: CpuChipIcon,
    browser: ComputerDesktopIcon,
};

const icon = computed(() => {
    if (!props.tool) return BoltIcon;
    const t = props.tool.toLowerCase();
    if (iconMap[t]) return iconMap[t];
    if (t.includes('message')) return ChatBubbleLeftIcon;
    if (t.includes('session')) return LinkIcon;
    return Cog6ToothIcon;
});
</script>
