import Link from 'next/link';
import type { EventSummary } from '@/types';
import { routes } from '@/lib/routes';
import { LongArrowRightIcon } from '@/components/icons/common';

/** Home page "What's Going On" card (includes/event-card.php). `href` overrides the event link (hand-picked home cards). */
export default function EventCard({ event, href }: { event: EventSummary; href?: string }) {
  return (
    <div className="col-lg-4 col-md-6">
      <div className="event-card">
        <img src={event.image} className="event-img" alt={event.title} />
        <div className="event-body">
          <h3 className="event-title">{event.title}</h3>
          <p className="event-meta">{[event.venue, event.date].filter(Boolean).join(' | ')}</p>
          <div className="split-btn">
            <Link href={href ?? routes.event(event.citySlug, event.slug)} className="text-sm fw-600 text-uppercase">
              More info
            </Link>
            <span className="split-divider"></span>
            <Link href={routes.requestInvitation} className="text-sm fw-600 text-uppercase">
              RSVP <LongArrowRightIcon color="#938048" />
            </Link>
          </div>
        </div>
      </div>
    </div>
  );
}
