import {
  Card,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card";
import { fetchAuthifierEmailClassification } from "@/lib/db";

export async function EmailClassificationCard({ email }: { email: string }) {
  const provider = email.split("@").pop() ?? "";
  const providerInfo = await fetchAuthifierEmailClassification(provider);
  if (!providerInfo) return null;

  return (
    <Card>
      <CardHeader>
        <CardTitle>Email Classification</CardTitle>
        <CardDescription>{providerInfo.classification}</CardDescription>
      </CardHeader>
    </Card>
  );
}
