import type { ComponentType } from "react";
import type { LucideProps } from "lucide-react";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";

interface AdminActionButtonProps {
  icon: ComponentType<LucideProps>;
  label: string;
  tone?: "default" | "danger" | "success";
  onClick?: () => void;
}

export function AdminActionButton({
  icon: Icon,
  label,
  tone = "default",
  onClick,
}: AdminActionButtonProps) {
  return (
    <Button
      type="button"
      variant="ghost"
      size="icon"
      aria-label={label}
      title={label}
      onClick={onClick}
      className={cn(
        "h-9 w-9 rounded-lg shadow-none",
        tone === "danger" &&
          "bg-red-50 text-red-700 hover:bg-red-100 hover:text-red-700",
        tone === "success" &&
          "bg-green-50 text-green-700 hover:bg-green-100 hover:text-green-700",
        tone === "default" &&
          "bg-[var(--theme-surface-strong)] text-slate-600 hover:bg-[var(--theme-highlight)] hover:text-[var(--theme-primary)]",
      )}
    >
      <Icon className="h-4 w-4" />
    </Button>
  );
}
