import TeamDetailTemplate from '@/templates/TeamDetailTemplate';
import type { TeamDetailsViewModel } from '@/lib/view-models/TeamDetailsViewModel';
import type { TeamMemberViewModel } from '@/lib/view-models/TeamMemberViewModel';

// This is a server component that can be used for static rendering
// It receives pre-fetched data and renders the template

interface TeamDetailStaticProps {
  team: TeamDetailsViewModel | null;
  memberships: TeamMemberViewModel[];
  currentDriverId: string;
  isLoading?: boolean;
}

export default function TeamDetailStatic({ 
  team, 
  memberships, 
  currentDriverId,
  isLoading = false 
}: TeamDetailStaticProps) {
  // Determine admin status
  const isAdmin = team ? (
    team.isOwner ||
    memberships.some((m) => m.driverId === currentDriverId && (m.role === 'manager' || m.role === 'owner'))
  ) : false;

  // For static rendering, we don't have interactive state
  // So we pass empty values and handlers that won't be used
  return (
    <TeamDetailTemplate
      team={team}
      memberships={memberships}
      activeTab="overview"
      loading={isLoading}
      isAdmin={isAdmin}
      onTabChange={() => {}}
      onUpdate={() => {}}
      onRemoveMember={() => {}}
      onChangeRole={() => {}}
      onGoBack={() => {}}
    />
  );
}