'use client';

import { usePathname } from 'next/navigation';
import { ProgressIndicator } from '@/components/ProgressIndicator';

export default function BookingLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const pathname = usePathname();
  
  const stepMap: Record<string, string> = {
    '/booking/search': 'search',
    '/booking/results': 'results',
    '/booking/auth-check': 'passengers',
    '/booking/passengers': 'passengers',
    '/booking/seats': 'seats',
    '/booking/review': 'review',
    '/booking/payment': 'payment',
    '/booking/confirmation': 'confirmation',
  };

  const currentStep = stepMap[pathname] || 'search';
  const showProgress = pathname !== '/booking/search' && pathname !== '/booking/confirmation' && pathname !== '/booking/detail' && pathname !== '/booking/lookup';

  return (
    <div>
      {showProgress && (
        <div className="bg-white dark:bg-gray-800 border-b dark:border-gray-700">
          <ProgressIndicator currentStep={currentStep} />
        </div>
      )}
      {children}
    </div>
  );
}
