'use client';

import { Key, AlertCircle } from 'lucide-react';
import Link from 'next/link';

import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/Card';

export function APIKeysTile() {
  // Mock data - in production, this would come from API
  const apiKeys = {
    active: 5,
    expired: 0,
    expiringSoon: 1,
  };

  return (
    <Card className="bg-gray-800 border-gray-700">
      <CardHeader>
        <CardTitle className="text-white flex items-center gap-2">
          <Key className="h-5 w-5 text-orange-500" />
          API Keys & Credentials
        </CardTitle>
      </CardHeader>
      <CardContent>
        <div className="space-y-4">
          <div className="text-center">
            <p className="text-4xl font-bold text-white mb-2">{apiKeys.active}</p>
            <p className="text-sm text-gray-400">Active API Keys</p>
          </div>
          
          {apiKeys.expiringSoon > 0 && (
            <div className="p-3 bg-yellow-500/10 border border-yellow-500/20 rounded-lg">
              <div className="flex items-center gap-2">
                <AlertCircle className="h-4 w-4 text-yellow-400" />
                <span className="text-sm text-yellow-400 font-semibold">
                  {apiKeys.expiringSoon} key{apiKeys.expiringSoon > 1 ? 's' : ''} expiring soon
                </span>
              </div>
            </div>
          )}

          {apiKeys.expired > 0 && (
            <div className="p-3 bg-red-500/10 border border-red-500/20 rounded-lg">
              <div className="flex items-center gap-2">
                <AlertCircle className="h-4 w-4 text-red-400" />
                <span className="text-sm text-red-400 font-semibold">
                  {apiKeys.expired} expired key{apiKeys.expired > 1 ? 's' : ''}
                </span>
              </div>
            </div>
          )}

          <Link 
            href="/developer/api-keys"
            className="block text-center text-sm text-orange-500 hover:text-orange-400 transition-colors"
          >
            Manage API Keys →
          </Link>
        </div>
      </CardContent>
    </Card>
  );
}

