'use client';

import { Shield, CheckCircle, AlertCircle } from 'lucide-react';

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

export function ComplianceStatusTile() {
  // Mock data - in production, this would come from API
  const compliance = {
    soc2: { status: 'compliant', lastAudit: '2024-01-15' },
    iso27001: { status: 'compliant', lastAudit: '2024-01-10' },
    gdpr: { status: 'compliant', lastAudit: '2024-01-20' },
    hipaa: { status: 'pending', lastAudit: null },
  };

  const getStatusIcon = (status: string) => {
    if (status === 'compliant') {
      return <CheckCircle className="h-4 w-4 text-green-400" />;
    }
    return <AlertCircle className="h-4 w-4 text-yellow-400" />;
  };

  const getStatusColor = (status: string) => {
    if (status === 'compliant') return 'text-green-400';
    return 'text-yellow-400';
  };

  return (
    <Card className="bg-gray-800 border-gray-700">
      <CardHeader>
        <CardTitle className="text-white flex items-center gap-2">
          <Shield className="h-5 w-5 text-orange-500" />
          Compliance Status
        </CardTitle>
      </CardHeader>
      <CardContent>
        <div className="space-y-3">
          {Object.entries(compliance).map(([key, value]) => (
            <div key={key} className="p-3 bg-gray-900 rounded-lg">
              <div className="flex items-center justify-between mb-1">
                <div className="flex items-center gap-2">
                  {getStatusIcon(value.status)}
                  <span className="text-sm text-gray-300 uppercase">{key}</span>
                </div>
                <span className={`text-xs font-semibold ${getStatusColor(value.status)}`}>
                  {value.status}
                </span>
              </div>
              {value.lastAudit && (
                <p className="text-xs text-gray-400 mt-1">
                  Last audit: {new Date(value.lastAudit).toLocaleDateString()}
                </p>
              )}
            </div>
          ))}
        </div>
      </CardContent>
    </Card>
  );
}

