'use client';
import StatusBadge from '@/components/ats/status-badge';
import DecisionActions from '@/components/ats/decision-actions';

export default function CandidatesTable({
  items,
  onAccept,
  onReject,
  onHistory
}: any) {
  return (
    <table>
      <thead>
        <tr>
          <th>candidat</th>
          <th>score</th>
          <th>statut</th>
          <th>actions</th>
        </tr>
      </thead>
      <tbody>
        {items.map((i: any) => (
          <tr key={i.matchCandidateId}>
            <td>{i.first_name} {i.last_name}</td>
            <td>{i.score}</td>
            <td><StatusBadge status={i.status} /></td>
            <td>
              <DecisionActions
                status={i.status}
                onAccept={() => onAccept(i.matchCandidateId)}
                onReject={() => onReject(i.matchCandidateId)}
              />
              <button onClick={() => onHistory(i.matchCandidateId)}>
                historique
              </button>
            </td>
          </tr>
        ))}
      </tbody>
    </table>
  );
}
