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

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