'use client';

import Image from 'next/image';

interface AgentCardProps {
  name: string;
  title: string;
  location: string;
  rating?: number;
  reviewCount?: number;
  experience: string;
  expertise: string[];
  imageUrl: string;
  isVerified?: boolean;
  isFeatured?: boolean;
}

export function AgentCard({
  name,
  title,
  location,
  rating,
  reviewCount,
  experience,
  expertise,
  imageUrl,
  isVerified = false,
  isFeatured = false,
}: AgentCardProps) {
  return (
    <div className={`bg-white rounded-2xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow ${isFeatured ? 'border-2 border-[#f5a623]' : ''}`}>
      {/* Image */}
      <div className="relative h-64 bg-gray-100">
        <Image
          src={imageUrl}
          alt={name}
          fill
          className="object-cover"
        />
        {isVerified && (
          <div className="absolute top-3 left-3 bg-[#00293d] text-white text-xs px-2 py-1 rounded-full flex items-center gap-1">
            <svg className="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
              <path fillRule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clipRule="evenodd" />
            </svg>
            Verified Agent
          </div>
        )}
      </div>

      {/* Content */}
      <div className="p-5">
        <h3 className="font-bold text-lg text-[#00293d]">{name}</h3>
        <p className="text-gray-600 text-sm mb-2">{title}</p>

        {/* Location */}
        <div className="flex items-center gap-1 text-gray-500 text-sm mb-3">
          <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" />
            <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" />
          </svg>
          {location}
        </div>

        {/* Rating */}
        {rating && (
          <div className="flex items-center gap-2 mb-3">
            <div className="flex">
              {[...Array(5)].map((_, i) => (
                <svg
                  key={i}
                  className={`w-4 h-4 ${i < Math.floor(rating) ? 'text-[#f5a623]' : 'text-gray-300'}`}
                  fill="currentColor"
                  viewBox="0 0 20 20"
                >
                  <path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
                </svg>
              ))}
            </div>
            {reviewCount && (
              <span className="text-sm text-gray-500">({reviewCount} reviews)</span>
            )}
          </div>
        )}

        {/* Expertise Tags */}
        <div className="flex flex-wrap gap-2 mb-3">
          {expertise.slice(0, 3).map((tag) => (
            <span
              key={tag}
              className="bg-[#c4d9d4]/30 text-[#00293d] text-xs px-2 py-1 rounded-full"
            >
              {tag}
            </span>
          ))}
        </div>

        {/* Experience */}
        <p className="text-sm text-gray-600">
          <span className="font-medium">Experience:</span> {experience}
        </p>
      </div>
    </div>
  );
}
