import { getServerSession } from "next-auth/next";
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
import { redirect } from "next/navigation";
import { UsersTable } from "@/components/users/users-table";

export const metadata = {
  title: "Enkun - Utilisateurs",
};

export default async function UsersPage() {
  const session = await getServerSession(authOptions);

  if (!session) {
    redirect("/signin");
  }

  return (
    <div className='container mx-auto py-10'>
      <UsersTable userRole={session.user.role} />
    </div>
  );
}
