import { notFound } from 'next/navigation'
import ClientForm from '@/views/clients/ClientForm'

const LEGAL_SERVICE = process.env.LEGAL_SERVICE_URL ?? 'http://localhost:3200'

export default async function EditClientPage({ params }: { params: Promise<{ lang: string; id: string }> }) {
  const { lang, id } = await params
  const res = await fetch(`${LEGAL_SERVICE}/client-folders/${id}`, { cache: 'no-store' })
  if (!res.ok) notFound()
  const folder = await res.json()
  return <ClientForm mode='edit' existing={folder} lang={lang} />
}
