/**
 * Shared types for standings that can be used in both server and client code
 */

export interface TeamStanding {
  teamId: string;
  teamName: string;
  ownerName?: string | null;
  totalPoints: number;
  currentRank: number;
  previousRank: number | null;
  rankChange: number; // Positive = moved up, negative = moved down
  placementCounts: {
    first: number;
    second: number;
    third: number;
    fourth: number;
    fifth: number;
    sixth: number;
    seventh: number;
    eighth: number;
  };
  participantsRemaining: number;
  calculatedAt: Date;
  // Phase 5.4: Expected value projections
  actualPoints?: number | null;
  projectedPoints?: number | null;
  participantsFinished?: number | null;
  // 7-day point change (optional, present when loaded with change data)
  sevenDayPointChange?: number;
}

export interface TeamStandingSnapshot {
  date: Date;
  rank: number;
  totalPoints: number;
}

export interface TeamStandingWithChange extends TeamStanding {
  sevenDayRankChange: number;
  sevenDayOldRank: number | null;
  sevenDayPointChange: number;
}
