import { mockDb } from '@/lib/mockDb'
import WidgetPartnerForm from './WidgetPartnerForm'
import { notFound } from 'next/navigation'
import { getTranslations } from 'next-intl/server'

export default async function AdminWidgetPartnerEditPage(props: {
  params: Promise<{ id: string, locale: string }>
}) {
  const params = await props.params
  const t = await getTranslations('Admin')
  let partner = null

  if (params.id !== 'new') {
    partner = await mockDb.getWidgetPartner(params.id)
    if (!partner) {
      notFound()
    }
  }

  // Get neighborhoods for the dropdown
  const neighborhoods = await mockDb.getNeighborhoods()

  return (
    <div className="space-y-6">
      <WidgetPartnerForm partner={partner} neighborhoods={neighborhoods} locale={params.locale} />
    </div>
  )
}
