import Link from "next/link";
import { MessageSquareQuote, FileCode2, Palette, SlidersHorizontal, Table2, Database, Wrench, type LucideIcon } from "lucide-react";
import type { ToolMeta } from "@/lib/tools/_shared/types";

// Явная карта (не `import * as Icons`) — иначе весь набор lucide попадает в бандл.
const ICONS: Record<string, LucideIcon> = {
  MessageSquareQuote,
  FileCode2,
  Palette,
  SlidersHorizontal,
  Table2,
  Database,
};

export function ToolCard({ tool }: { tool: ToolMeta }) {
  const Icon = ICONS[tool.icon] ?? Wrench;
  return (
    <Link href={`/tools/${tool.id}`} className="card-aubade p-4 flex flex-col gap-2 no-underline">
      <div className="flex items-center gap-2" style={{ color: "var(--foreground)" }}>
        <Icon size={20} />
        <span className="font-bold">{tool.title}</span>
      </div>
      <p className="text-sm" style={{ color: "var(--muted-foreground)" }}>{tool.description}</p>
    </Link>
  );
}
