"use client"; import Card from "./Card"; // Field schema — config-driven, used for both searchConfig and fetchConfig const FIELD_SCHEMA = { baseUrl: { label: "Endpoint", format: (v) => v, isLink: true, mono: true }, method: { label: "Method", format: (v) => v }, authType: { label: "Auth", format: (v) => v }, authHeader: { label: "Auth Header", format: (v) => v, mono: true }, costPerQuery: { label: "Cost / call", format: (v) => v === 0 ? "Free" : `$${v.toFixed(4)}` }, freeMonthlyQuota: { label: "Free quota", format: (v) => v === 0 ? "—" : v >= 999999 ? "Unlimited" : `${v.toLocaleString()} / mo` }, searchTypes: { label: "Types", format: (v) => v.join(", ") }, formats: { label: "Formats", format: (v) => v.join(", ") }, defaultMaxResults: { label: "Default results", format: (v) => v }, maxMaxResults: { label: "Max results", format: (v) => v }, maxCharacters: { label: "Max chars", format: (v) => v.toLocaleString() }, timeoutMs: { label: "Timeout", format: (v) => `${v / 1000}s` }, cacheTTLMs: { label: "Cache TTL", format: (v) => `${v / 60000}m` }, }; export default function ProviderInfoCard({ config, title = "Provider Info" }) { if (!config) return null; const rows = Object.entries(FIELD_SCHEMA) .filter(([key]) => config[key] !== undefined && config[key] !== null && config[key] !== "") .map(([key, schema]) => ({ key, label: schema.label, value: schema.format(config[key]), isLink: schema.isLink, mono: schema.mono, raw: config[key], })); return (

{title}

{rows.map((r) => (
{r.label} {r.isLink ? ( {r.value} ) : ( {r.value} )}
))}
); }