import Link from "next/link";
import type { PartnerProfile } from "@/content/partners";
import { PartnerLogoPlaceholder } from "@/components/brand/PartnerLogoPlaceholder";
import { Card, CardContent, CardDescription, CardHeader } from "@/components/ui/card";
import { Button } from "@/components/ui/button";

type Props = {
  partner: PartnerProfile;
  tierLabel?: string;
};

export function PartnerCard({ partner, tierLabel }: Props) {
  return (
    <Card className="topo-card-surface h-full border-border/80 bg-white text-[#1a5c38]">
      {tierLabel && (
        <p className="px-6 pt-6 text-xs font-semibold uppercase tracking-widest text-muted-foreground">
          {tierLabel}
        </p>
      )}
      <CardHeader className={tierLabel ? "pt-2" : undefined}>
        <PartnerLogoPlaceholder
          size="lg"
          className="w-full border-[#1a5c38]/20 bg-[#f0f5f2] text-[#1a5c38]/50"
        />
      </CardHeader>
      <CardContent className="flex flex-1 flex-col">
        <CardDescription className="flex-1 text-base leading-relaxed">
          {partner.description}
        </CardDescription>
        {partner.url && !partner.isPlaceholder && (
          <Button
            variant="link"
            className="topo-card-link mt-4 h-auto p-0"
            asChild
          >
            <Link href={partner.url} target="_blank" rel="noopener noreferrer">
              More info
            </Link>
          </Button>
        )}
      </CardContent>
    </Card>
  );
}
