import { auth } from '@/auth'
import { redirect } from 'next/navigation'
import { getSystemConfig } from '@/app/actions/admin-settings'
import { AdminSettingsForm } from './admin-settings-form'

export default async function AdminSettingsPage() {
  const session = await auth()
  
  if ((session?.user as any)?.role !== 'ADMIN') {
    redirect('/')
  }

  const config = await getSystemConfig()

  return (
    <div className="container max-w-4xl mx-auto py-10 px-4">
      <h1 className="text-3xl font-bold mb-8">System Configuration</h1>
      <AdminSettingsForm config={config} />
    </div>
  )
}
