import { ViewData } from '../contracts/view-data/ViewData';

/**
 * LeagueDetailViewData - Pure ViewData for LeagueDetailTemplate
 * Contains only raw serializable data, no methods or computed properties
 */

export interface LeagueInfoData {
  name: string;
  description?: string;
  membersCount: number;
  racesCount: number;
  avgSOF: number | null;
  structure: string;
  scoring: string;
  createdAt: string;
  discordUrl?: string;
  youtubeUrl?: string;
  websiteUrl?: string;
}

export interface SponsorInfo {
  id: string;
  name: string;
  tier: 'main' | 'secondary';
  logoUrl?: string;
  websiteUrl?: string;
  tagline?: string;
}

export interface LiveRaceData {
  id: string;
  name: string;
  date: string;
  registeredCount?: number;
  strengthOfField?: number;
}

export interface DriverSummaryData {
  driverId: string;
  driverName: string;
  avatarUrl: string | null;
  rating: number | null;
  rank: number | null;
  roleBadgeText: string;
  roleBadgeClasses: string;
  profileUrl: string;
}

export interface SponsorMetric {
  icon: any; // React component (lucide-react icon)
  label: string;
  value: string | number;
  color?: string;
  trend?: {
    value: number;
    isPositive: boolean;
  };
}

export interface SponsorshipSlot {
  tier: 'main' | 'secondary';
  available: boolean;
  price: number;
  benefits: string[];
}

export interface NextRaceInfo {
  id: string;
  name: string;
  date: string;
  track?: string;
  car?: string;
}

export interface SeasonProgress {
  completedRaces: number;
  totalRaces: number;
  percentage: number;
}

export interface RecentResult {
  raceId: string;
  raceName: string;
  position: number;
  points: number;
  finishedAt: string;
}

export interface LeagueDetailViewData extends ViewData {
  // Basic info
  leagueId: string;
  name: string;
  description: string;
  logoUrl?: string;
  
  // Info card data
  info: LeagueInfoData;
  
  // Live races
  runningRaces: LiveRaceData[];
  
  // Sponsors
  sponsors: SponsorInfo[];
  
  // Management
  ownerSummary: DriverSummaryData | null;
  adminSummaries: DriverSummaryData[];
  stewardSummaries: DriverSummaryData[];
  memberSummaries: DriverSummaryData[];
  
  // Sponsor insights (for sponsor mode)
  sponsorInsights: {
    avgViewsPerRace: number;
    engagementRate: string;
    estimatedReach: number;
    tier: 'premium' | 'standard' | 'starter';
    trustScore: number;
    discordMembers: number;
    monthlyActivity: number;
    mainSponsorAvailable: boolean;
    secondarySlotsAvailable: number;
    mainSponsorPrice: number;
    secondaryPrice: number;
    totalImpressions: number;
    metrics: SponsorMetric[];
    slots: SponsorshipSlot[];
  } | null;

  // New fields for enhanced league pages
  nextRace?: NextRaceInfo;
  seasonProgress?: SeasonProgress;
  recentResults?: RecentResult[];
  
  // Admin fields
  walletBalance?: number;
  pendingProtestsCount?: number;
  pendingJoinRequestsCount?: number;
}
