'use client';

import { League } from '@gridpilot/racing-domain/entities/League';
import Card from '../ui/Card';

interface LeagueCardProps {
  league: League;
  onClick?: () => void;
}

export default function LeagueCard({ league, onClick }: LeagueCardProps) {
  return (
    <div
      className="cursor-pointer hover:scale-[1.03] transition-transform duration-150"
      onClick={onClick}
    >
      <Card>
      <div className="space-y-3">
        <div className="flex items-start justify-between">
          <h3 className="text-xl font-semibold text-white">{league.name}</h3>
          <span className="text-xs text-gray-500">
            {new Date(league.createdAt).toLocaleDateString()}
          </span>
        </div>
        
        <p className="text-gray-400 text-sm line-clamp-2">
          {league.description}
        </p>
        
        <div className="flex items-center justify-between pt-2 border-t border-charcoal-outline">
          <div className="text-xs text-gray-500">
            Owner ID: {league.ownerId.slice(0, 8)}...
          </div>
          <div className="text-xs text-primary-blue font-medium">
            {league.settings.pointsSystem.toUpperCase()}
          </div>
        </div>
      </div>
      </Card>
    </div>
  );
}