import { Suspense } from "react";
import { UserTable } from "@/components/admin/users/user-table";
import { Skeleton } from "@/components/ui/skeleton";
import { PageHeader } from '@/components/navigation/page-header';

export default function UsersPage() {
  return (
    <>
      <PageHeader
        title="User Management"
        description="Manage users, roles, and permissions"
        breadcrumbs={[{ label: 'Admin', href: '/admin' }, { label: 'Users' }]}
        accent
      />
      <div className="container mx-auto py-8 px-4">
        <Suspense fallback={<UserTableSkeleton />}>
          <UserTable />
        </Suspense>
      </div>
    </>
  );
}

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