import { columns } from "@/app/admin/users/columns";
import { DataTable } from "@/app/admin/users/data-table";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { db } from "@/server/db";

import type { Metadata } from "next";

export const metadata: Metadata = {
	title: "Alle Benutzer",
};

export default async function AdminPage() {
	const data = await db.query.users.findMany();

	return (
		<Card>
			<CardHeader>
				<CardTitle>Benutzerverwaltung</CardTitle>
				<CardDescription>Suche, Bearbeite und Lösche Benutzer</CardDescription>
			</CardHeader>
			<CardContent>
				<DataTable columns={columns} data={data} />
			</CardContent>
		</Card>
	);
}
