import React from 'react';
import { Badge } from '@/components/ui/badge';
import {
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger
} from '@/components/ui/tooltip';
import { GitBranch, GitPullRequest, ShieldCheck } from 'lucide-react';

interface CodeReviewCellProps {
  requireCodeReview?: boolean;
}

export const CodeReviewCell: React.FC<CodeReviewCellProps> = ({
  requireCodeReview
}) => {
  const config = requireCodeReview
    ? {
        icon: <ShieldCheck className="h-3 w-3 text-blue-500" />,
        label: '需要',
        variant: 'default' as const,
        description: '部署前需要进行代码审查',
        color: 'text-blue-600'
      }
    : {
        icon: <GitPullRequest className="h-3 w-3 text-gray-500" />,
        label: '不需要',
        variant: 'secondary' as const,
        description: '部署时不需要代码审查',
        color: 'text-gray-500'
      };

  return (
    <TooltipProvider>
      <Tooltip delayDuration={300}>
        <TooltipTrigger asChild>
          <div className="flex items-center gap-1.5">
            <Badge variant={config.variant} className="text-xs px-2 py-0.5">
              <div className="flex items-center gap-1">
                {config.icon}
                <span>{config.label}</span>
              </div>
            </Badge>
          </div>
        </TooltipTrigger>
        <TooltipContent className="max-w-xs bg-gray-900 border-gray-700 text-white">
          <div className="text-white text-xs">
            {config.description}
          </div>
        </TooltipContent>
      </Tooltip>
    </TooltipProvider>
  );
};
