'use client';

import { useCallback } from 'react';
import { usePathname, useRouter } from 'next/navigation';
import { StickyMobileCTA } from './StickyMobileCTA';

export function StickyMobileCTAWrapper() {
  const pathname = usePathname();
  const router = useRouter();

  const scrollToForm = useCallback(() => {
    if (pathname !== '/') {
      router.push('/#lead-form');
      return;
    }
    document.getElementById('lead-form')?.scrollIntoView({ behavior: 'smooth' });
  }, [pathname, router]);

  return <StickyMobileCTA onCtaClick={scrollToForm} />;
}

