import Table from './Table'
import Image from 'next/image'
import { MatchPlayer } from '@/app/types/match'

type Props = {
  player: MatchPlayer
}

export default function MatchPlayerCard({ player }: Props) {
  return (
    <Table.Row hoverable>
        <td className="w-[48px] p-1 text-center align-middle whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200">
            <Image className="rounded-full shrink-0 border object-cover" alt={`Avatar von ${player.user.name}`} src={player.user.avatar} width={40} height={40}></Image>
        </td>
        <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-neutral-200">
            {player.user.name}
        </td>
        <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200">
            {player.stats?.kills ?? '-'}
        </td>
        <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200">
            {player.stats?.deaths ?? '-'}
        </td>
        <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200">
            {player.stats?.assists ?? '-'}
        </td>
        <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200">
            {player.stats?.adr ?? '-'}
        </td>
        <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200">
            {player.stats?.adr ?? '-'}
        </td>
        <td className="px-6 py-4 whitespace-nowrap text-end text-sm font-medium">
            <button
            type="button"
            className="text-blue-600 hover:text-blue-800 dark:text-blue-500 dark:hover:text-blue-400"
            >
            Details
            </button>
        </td>
    </Table.Row>
  )
}
