import Image from "next/image";
import { Card } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import { DiscoverCardProps } from "@/types/discover-card";
import { ArrowUpLeft } from "lucide-react";
import Link from "next/link";

export function DiscoverCard({
  id,
  title,
  type,
  price,
  image,
  logo,
  clientType,
  propertyType,
  subtitle,
}: DiscoverCardProps) {
  return (
    <div className="discover-card relative w-[330px] md:w-[400px] h-[500px] overflow-hidden rounded-3xl snap-start shrink-0 bg-black">
    <Image
  src={image || "/placeholder-property.png"}
  alt={title}
  fill
  className="object-cover"
  unoptimized
/>
      <div className="absolute inset-0 bg-linear-to-b from-black/20 via-black/50 to-black/80" />

      {/* Top Info */}
      <div className="absolute top-4 left-4 right-4 flex gap-2 items-center bg-[#F8FAFC1A] backdrop-blur-xs p-3 rounded-xl">
        <Image src={logo} width={40} height={40} alt="logo" className="object-contain rounded-lg" />
        <div className="text-white space-y-1">
          <h2>{title}</h2>
          <div className="flex items-center gap-2 text-sm font-light text-secoundary-muted">
            {propertyType && <span>{propertyType}</span>}
            {subtitle && propertyType && <span>-</span>}
            {subtitle && <span>{subtitle}</span>}
          </div>
        </div>
      </div>

      {/* Bottom Info */}
      <div className="absolute bottom-20 right-4 text-white">
        <p className="text-sm opacity-80">أسعار تبدأ من</p>
        <p className="text-xl font-medium flex items-center gap-1">
          {price}
          <span className="text-2xl">
            <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
              <g clipPath="url(#clip0_4232_4947)">
                <path d="M17.3804 15.2793C17.2981 15.6181 17.1852 15.9469 17.0425 16.2627L11.2056 17.373C11.2879 17.0344 11.4007 16.7054 11.5435 16.3896L17.3804 15.2793Z" fill="#fff" stroke="#fff" />
                <path d="M17.3851 12.8339C17.7063 12.1968 17.9187 11.5051 18 10.7799L12.7051 11.7875V9.85051L17.385 8.96067C17.7062 8.32356 17.9185 7.63187 17.9998 6.90664L12.7049 7.91339V0.947429C11.8936 1.35503 11.173 1.89758 10.5873 2.53756V8.31625L8.46967 8.71898V0C7.65833 0.407453 6.93778 0.950151 6.35206 1.59013V9.12156L1.61387 10.0224C1.29267 10.6595 1.08019 11.3512 0.998683 12.0765L6.35206 11.0585V13.4978L0.61487 14.5887C0.293664 15.2258 0.0813422 15.9175 0 16.6427L6.00523 15.5008C6.49408 15.4099 6.91425 15.1513 7.18741 14.7954L8.28874 13.3345V13.3342C8.40306 13.1831 8.46967 13.0008 8.46967 12.8045V10.6558L10.5873 10.2531V14.127L17.385 12.8336L17.3851 12.8339Z" fill="#fff" />
              </g>
              <defs>
                <clipPath id="clip0_4232_4947">
                  <rect width="18" height="18" fill="white" />
                </clipPath>
              </defs>
            </svg>
          </span>
        </p>
      </div>

      {/* Button */}
      <div className="absolute bottom-4 left-4 right-4">
        <Link href={`/real-estate/${id}`}>
          <Button className="w-full rounded-full py-5 text-base font-medium bg-white/95 text-black hover:bg-white">
            مشاهدة التفاصيل
            <ArrowUpLeft />
          </Button>
        </Link>
      </div>
    </div>
  );
}
