import { ClientDetail } from '@/components/clients/client-detail';
import { TrackEntityView } from '@/components/search/track-entity-view';
import { auth } from '@/lib/auth';
import { headers } from 'next/headers';

interface ClientDetailPageProps {
  params: Promise<{ clientId: string }>;
}

export default async function ClientDetailPage({ params }: ClientDetailPageProps) {
  const { clientId } = await params;

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

  return (
    <>
      <TrackEntityView type="client" id={clientId} />
      <ClientDetail clientId={clientId} currentUserId={currentUserId} />
    </>
  );
}
