export const dynamic = 'force-dynamic'
import { redirect } from 'next/navigation'
import { cookies } from 'next/headers'
import { verifySessionToken } from '@/lib/admin-auth'
import { AdminNav } from '@/components/admin/AdminNav'
import { HeroVerwaltung } from '@/components/admin/HeroVerwaltung'
import type { Metadata } from 'next'

export const metadata: Metadata = { title: 'Hero – Admin' }

export default async function AdminHeroPage() {
  const cookieStore = await cookies()
  const token = cookieStore.get('admin_session')?.value
  const session = token ? await verifySessionToken(token) : null
  if (!session) redirect('/admin/login')

  return (
    <div className="min-h-screen bg-[#111925]">
      <AdminNav />
      <div className="max-w-4xl mx-auto px-4 py-8">
        <h1 className="text-2xl font-bold tracking-tight mb-6" style={{ color: 'var(--text-primary)' }}>
          Hero-Sektion
        </h1>
        <HeroVerwaltung />
      </div>
    </div>
  )
}
