import { YachtDetail } from '@/components/yachts/yacht-detail';
import { TrackEntityView } from '@/components/search/track-entity-view';
import { auth } from '@/lib/auth';
import { headers } from 'next/headers';

interface YachtDetailPageProps {
  params: Promise<{ yachtId: string }>;
}

export default async function YachtDetailPage({ params }: YachtDetailPageProps) {
  const { yachtId } = await params;

  const session = await auth.api.getSession({ headers: await headers() });
  const currentUserId = session?.user?.id;

  return (
    <>
      <TrackEntityView type="yacht" id={yachtId} />
      <YachtDetail yachtId={yachtId} currentUserId={currentUserId} />
    </>
  );
}
