import Link from 'next/link'
import { dashboardPath, PAGE_CONTEXT_LABELS, type PageContext } from '@/lib/page-context'

/**
 * Layout-only preview switcher; superseded by the real role switch when
 * AUTH_ROLE_SWITCH is on. Internal only (Task 96) — a customer never sees a
 * "view as" bar. Since 2026-09-13 every dashboard is its own route, so the
 * switcher links between them instead of toggling `?view=`.
 */
export function ViewSwitcher({ current }: { current: PageContext }) {
  const views: PageContext[] = ['broker', 'carrier', 'carrier-driver', 'pilot-company', 'pilot-driver']
  return (
    <div className="border-b bg-[#0f1b2d] px-4 py-2 text-center text-xs text-white">
      <span className="mr-2 font-semibold text-[#f5a623]">Pilot preview — view as:</span>
      {views.map((v) => (
        <Link
          key={v}
          href={dashboardPath(v)}
          className={`mx-1 rounded-full px-3 py-1 font-semibold ${
            v === current ? 'bg-[#f5a623] text-[#0f1b2d]' : 'text-neutral-300 hover:text-white'
          }`}
        >
          {PAGE_CONTEXT_LABELS[v]}
        </Link>
      ))}
    </div>
  )
}
