import { AppShell } from '@/components/app/app-shell'
import { requireRoleRoute } from '@/lib/role-route'
import { PilotAssignmentWorkspace } from '@/components/app/pilot-assignment/pilot-assignment-workspace'

/** Pilot Driver Assignment View (PC) — `/pc-trip-workspace/<trip number>`. Phase 1 replica. */
export default async function Page({ params }: { params: Promise<{ ref: string }> }) {
  const { user, profile } = await requireRoleRoute('pilot-driver')
  const { ref } = await params
  return (
    <AppShell profile={profile}>
      <PilotAssignmentWorkspace assignmentKey={decodeURIComponent(ref)} as="pilot_driver" isAdmin={user.internal} />
    </AppShell>
  )
}
