import type { ReactNode } from 'react'
import { Link } from 'react-router-dom'
import { cn } from '@/lib/utils'

interface EmptyStateProps {
  icon?: ReactNode
  illustration?: ReactNode
  title: string
  description?: string
  action?: ReactNode
  learnMoreLink?: string
  learnMoreText?: string
  className?: string
}

export function EmptyState({
  icon,
  illustration,
  title,
  description,
  action,
  learnMoreLink,
  learnMoreText = 'Learn more',
  className,
}: EmptyStateProps) {
  return (
    <div className={cn('flex flex-col items-center justify-center py-12 text-center', className)}>
      {illustration && (
        <div className="mb-6 opacity-60">
          {illustration}
        </div>
      )}
      {!illustration && icon && (
        <div className="mb-4 text-muted-foreground">{icon}</div>
      )}
      <h3 className="text-lg font-semibold text-foreground">{title}</h3>
      {description && (
        <p className="mt-2 max-w-sm text-sm text-muted-foreground">{description}</p>
      )}
      {action && <div className="mt-4">{action}</div>}
      {learnMoreLink && (
        <Link
          to={learnMoreLink}
          className="mt-3 text-sm text-muted-foreground hover:text-foreground transition-colors"
        >
          {learnMoreText} &rarr;
        </Link>
      )}
    </div>
  )
}

export default EmptyState
