import { notFound } from 'next/navigation';
import { PageWrapper } from '@/components/shared/state/PageWrapper';
import { SponsorLeagueDetailTemplate } from '@/templates/SponsorLeagueDetailTemplate';
import { PageDataFetcher } from '@/lib/page/PageDataFetcher';
import { SPONSOR_SERVICE_TOKEN } from '@/lib/di/tokens';
import type { SponsorService } from '@/lib/services/sponsors/SponsorService';

export default async function Page({ params }: { params: { id: string } }) {
  const data = await PageDataFetcher.fetch<SponsorService, 'getLeagueDetail'>(
    SPONSOR_SERVICE_TOKEN, 
    'getLeagueDetail', 
    params.id
  );
  
  if (!data) notFound();
  
  return <PageWrapper data={data} Template={SponsorLeagueDetailTemplate} />;
}