import { CompanyDetail } from '@/components/companies/company-detail';
import { TrackEntityView } from '@/components/search/track-entity-view';
import { auth } from '@/lib/auth';
import { headers } from 'next/headers';

interface CompanyDetailPageProps {
  params: Promise<{ companyId: string }>;
}

export default async function CompanyDetailPage({ params }: CompanyDetailPageProps) {
  const { companyId } = await params;

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

  return (
    <>
      <TrackEntityView type="company" id={companyId} />
      <CompanyDetail companyId={companyId} currentUserId={currentUserId} />
    </>
  );
}
