"use client";

import { Button } from "@/components/ui/button";
import { FileSpreadsheet } from "lucide-react";
import { exportToExcel, type ExportRow } from "@/lib/utils/csv";

interface ExportButtonsProps {
  rows: ExportRow[];
  filename: string;
  disabled?: boolean;
  summary?: string;
}

export function ExportButtons({ rows, filename, disabled, summary }: ExportButtonsProps) {
  return (
    <div className="flex items-center gap-3 flex-wrap">
      {summary && <span className="text-sm text-gray-400">{summary}</span>}
      <Button
        variant="outline"
        size="sm"
        disabled={disabled || rows.length === 0}
        onClick={() => exportToExcel(rows, `${filename}.xlsx`)}
        className="border-[#2e2e3e] hover:border-purple-500/50 hover:bg-purple-500/5 text-gray-300"
      >
        <FileSpreadsheet className="w-4 h-4 mr-1.5" /> Excel herunterladen
      </Button>
    </div>
  );
}
