'use client';

import React from 'react';
import { AlertTriangle } from 'lucide-react';
import Button from '../ui/Button';

interface DriverDTO {
  id: string;
  name: string;
}

interface InlinePenaltyButtonProps {
  driver: DriverDTO;
  onPenaltyClick?: (driver: DriverDTO) => void;
  isAdmin: boolean;
}

export default function InlinePenaltyButton({
  driver,
  onPenaltyClick,
  isAdmin,
}: InlinePenaltyButtonProps) {
  if (!isAdmin) return null;

  const handleButtonClick = () => {
    if (onPenaltyClick) {
      onPenaltyClick(driver);
    }
  };

  return (
    <Button
      variant="danger"
      className="p-1.5 min-h-[32px] w-8 h-8 rounded-full flex items-center justify-center"
      onClick={handleButtonClick}
      title={`Issue penalty to ${driver.name}`}
    >
      <AlertTriangle className="w-4 h-4 flex-shrink-0" />
    </Button>
  );
}