import { Suspense } from "react";
import { AuditLogTable } from "@/components/admin/audit/audit-log-table";
import { Skeleton } from "@/components/ui/skeleton";
import { PageHeader } from '@/components/navigation/page-header';

export default function AuditLogPage() {
  return (
    <>
      <PageHeader
        title="Audit Log"
        description="View system activity and security events"
        breadcrumbs={[{ label: 'Admin', href: '/admin' }, { label: 'Audit Log' }]}
        accent
      />
      <div className="container mx-auto py-8 px-4">
        <Suspense fallback={<AuditLogSkeleton />}>
          <AuditLogTable />
        </Suspense>
      </div>
    </>
  );
}

function AuditLogSkeleton() {
  return (
    <div className="space-y-4">
      <div className="flex gap-4">
        <Skeleton className="h-10 w-[200px]" />
        <Skeleton className="h-10 w-[200px]" />
        <Skeleton className="h-10 w-[200px]" />
      </div>
      <div className="rounded-md border">
        <div className="p-4 space-y-4">
          {[...Array(10)].map((_, i) => (
            <Skeleton key={i} className="h-12 w-full" />
          ))}
        </div>
      </div>
    </div>
  );
}
