'use client';
import { Suspense } from 'react';
import { useSearchParams } from 'next/navigation';
import { APP_ROLES } from '@/constants';
import { SelectRole } from '@/components/auth';

function SelectRoleContent() {
  const searchParams = useSearchParams();
  const initialRole = searchParams.get('role') === APP_ROLES.NURSE ? APP_ROLES.NURSE : APP_ROLES.CUSTOMER;
  return <SelectRole initialRole={initialRole} />;
}

/** First-use role picker for an authenticated user with no public role yet. */
export default function SelectRolePage() {
  return (
    <Suspense>
      <SelectRoleContent />
    </Suspense>
  );
}
