import React from "react";
import { LucideIcon, Plus } from "lucide-react";
import { Button } from "@/components/ui/button";
import Link from "next/link";
import { cn } from "@/lib/utils";

interface EmptyStateProps {
  icon: LucideIcon;
  title: string;
  description: string;
  actionHref?: string;
  actionLabel?: string;
  className?: string;
}

/**
 * EmptyState provides a standardized, visually appealing placeholder when no data is found.
 * It follows uncodixfy principles with clean icons, clear messaging, and a primary CTA.
 */
export function EmptyState({
  icon: Icon,
  title,
  description,
  actionHref,
  actionLabel,
  className,
}: EmptyStateProps) {
  return (
    <div className={cn(
      "flex flex-col items-center justify-center py-12 px-4 text-center rounded-xl border border-dashed border-border/60 bg-muted/5",
      className
    )}>
      <div className="size-12 rounded-full bg-primary/10 flex items-center justify-center mb-4">
        <Icon className="size-6 text-primary" />
      </div>
      <h3 className="text-lg font-bold tracking-tight mb-1">{title}</h3>
      <p className="text-sm text-muted-foreground max-w-xs mb-6">
        {description}
      </p>
      {actionHref && actionLabel && (
        <Link href={actionHref}>
          <Button size="sm" className="font-bold text-xs shadow-md shadow-primary/10">
            <Plus className="size-3.5 mr-1.5" />
            {actionLabel}
          </Button>
        </Link>
      )}
    </div>
  );
}
