import prisma from '@/lib/prisma'
import CreateUserForm from './CreateUserForm'
import UserList from './UserList'

export const metadata = {
  title: 'Kullanıcı Yönetimi - Admin',
}

export default async function UsersPage() {
  const users = await prisma.users.findMany({
    orderBy: { created_at: 'asc' },
    select: {
      id: true,
      username: true,
      role: true,
      created_at: true,
    }
  })

  return (
    <div className="space-y-6">
      <h1 className="text-2xl font-bold text-gray-900">Kullanıcı Yönetimi</h1>
      <CreateUserForm />
      <UserList users={users} />
    </div>
  )
}
