"use client";

import { incrementDownloadCount } from "@/lib/actions/downloads";

export function DownloadButton({
  labelId,
  fileUrl,
  fileName,
}: {
  labelId: string;
  fileUrl: string;
  fileName: string;
}) {
  return (
    <a
      href={fileUrl}
      download={fileName}
      onClick={() => {
        // Fire-and-forget -- doesn't block the browser's native download.
        incrementDownloadCount(labelId);
      }}
      className="rounded-full bg-terracotta px-5 py-2 text-sm font-medium text-white hover:bg-terracotta/90"
    >
      Download
    </a>
  );
}
