import { AppShell } from '@/components/app/app-shell'
import { requireRoleRoute } from '@/lib/role-route'
import { NewTripForm } from './new-trip-form'

/**
 * Freight Broker · New Trip — `/fb-new-trip` (Nash, 2026-09-19): "only two
 * sections — the top one is the rate confirmation, and part two will have
 * the drag and drop of the permits." Inviting the carrier dispatcher and
 * choosing permit handling happen in the workspace after the trip exists —
 * both optional; a broker may create a trip that is already finished just
 * to analyze it. The trip-request page (/fb-new-trip-request) is unchanged.
 */
export default async function FreightBrokerNewTripPage() {
  const { profile } = await requireRoleRoute('broker')
  return (
    <AppShell profile={profile}>
      <main className="mx-auto max-w-2xl px-4 py-8">
        <h1 className="text-2xl font-bold tracking-tight">Create a trip</h1>
        <p className="mt-1 text-sm text-neutral-600">
          Drop the rate confirmation, drop any permits you already have, and create the trip. Invite
          the carrier dispatcher and choose how permits are handled whenever you are ready.
        </p>
        <NewTripForm />
      </main>
    </AppShell>
  )
}
