import { notFound } from 'next/navigation';
import { TeamDetailPageQuery } from '@/lib/page-queries/page-queries/TeamDetailPageQuery';
import { TeamDetailPageClient } from './TeamDetailPageClient';

export default async function Page({ params }: { params: { id: string } }) {
  const result = await TeamDetailPageQuery.execute(params.id);

  switch (result.status) {
    case 'ok':
      return <TeamDetailPageClient pageDto={result.dto} />;
    case 'notFound':
      notFound();
    case 'redirect':
      // This would typically use redirect() from next/navigation
      // but we need to handle it at the page level
      return null;
    case 'error':
      // For now, treat errors as not found
      // In production, you might want a proper error page
      notFound();
  }
}