'use client';

import { Suspense } from 'react';
import { useSearchParams } from 'next/navigation';
import FaydaSetupWizard from '@/components/FaydaSetupWizard';

// Landing page for the IAM's Fayda set-password SMS link:
// ${FE_BASE_URL}/set-password?email=..&userId=..&verificationCode=..
// The wizard starts at step 2 with the code prefilled; the user enters their
// phone number (verify-and-login requires it) and a new password.
function SetPasswordContent() {
  const searchParams = useSearchParams();
  const verificationCode = searchParams.get('verificationCode') || '';

  return <FaydaSetupWizard initialOtp={verificationCode} />;
}

export default function SetPasswordPage() {
  return (
    <Suspense fallback={null}>
      <SetPasswordContent />
    </Suspense>
  );
}
