import { redirect } from 'next/navigation'
import { getProfile, getSessionUser } from '@/lib/auth'
import { AppShell } from '@/components/app/app-shell'
import { EstimatorForm } from './estimator-form'

/** Permit cost estimator — UI preview; connects to the existing estimator service. */
export default async function EstimatorPage() {
  const user = await getSessionUser()
  if (!user) redirect('/login')
  const profile = (await getProfile())!

  return (
    <AppShell profile={profile}>
      <main className="mx-auto max-w-4xl px-4 py-8">
        <h1 className="text-2xl font-bold tracking-tight">Permit Estimator</h1>
        <p className="mt-1 text-sm text-neutral-500">
          Estimate state permit fees for an oversize move before you order anything.
        </p>
        <EstimatorForm />
      </main>
    </AppShell>
  )
}
