import Link from "next/link";

import { buildValuationGapsHref, type ValuationGapsTab } from "../_lib/tab-params";

type Props = {
  message: string;
  links: { tab: ValuationGapsTab; label: string; count: number }[];
};

export function ValuationGapsEmptyHint({ message, links }: Props) {
  const useful = links.filter((link) => link.count > 0);
  if (useful.length === 0) {
    return (
      <p className="rounded-lg border border-dashed bg-muted/20 px-4 py-6 text-center text-muted-foreground text-sm">
        {message}
      </p>
    );
  }

  return (
    <div className="rounded-lg border border-dashed bg-muted/20 px-4 py-6 text-center text-sm">
      <p className="text-muted-foreground">{message}</p>
      <p className="mt-3 flex flex-wrap items-center justify-center gap-x-3 gap-y-2">
        {useful.map((link) => (
          <Link
            key={link.tab}
            href={buildValuationGapsHref(link.tab)}
            className="font-medium text-primary underline-offset-4 hover:underline"
          >
            {link.label} ({link.count})
          </Link>
        ))}
      </p>
    </div>
  );
}
