import * as React from 'react'
import { cn } from '../../lib/utils'

export interface EmptyStateAction {
  label: string
  onClick: () => void
}

export interface EmptyStateProps {
  title: string
  description?: string
  action?: EmptyStateAction
  className?: string
}

export function EmptyState({
  title,
  description,
  action,
  className,
}: EmptyStateProps) {
  return (
    <div
      className={cn(
        'flex flex-col items-center justify-center py-12 px-4 text-center',
        className
      )}
      role="status"
      aria-live="polite"
    >
      <h3 className="text-xl font-semibold text-foreground mb-3">{title}</h3>
      {description && (
        <p className="text-base text-muted-foreground mb-8 max-w-md leading-relaxed">
          {description}
        </p>
      )}
      {action && (
        <button
          onClick={action.onClick}
          className="inline-flex items-center justify-center rounded-md text-sm font-medium bg-primary text-primary-foreground shadow hover:bg-primary/90 h-9 px-4 py-2 transition-colors"
          aria-label={action.label}
        >
          {action.label}
        </button>
      )}
    </div>
  )
}
