// Super Admin Dashboard Types

export interface PlatformMetrics {
  totalRevenue: number;
  totalFees: number;
  activeOrganizers: number;
  totalTickets: number;
  revenueChange: number;
  feesChange: number;
  organizersChange: number;
  ticketsChange: number;
}

export interface RevenueBreakdown {
  totals: {
    grossRevenue: number;
    platformFees: number;
    netRevenue: number;
  };
}

export interface SalesTrends {
  trends: Array<{
    period: string;
    revenue: number;
    transactions: number;
    fees: number;
  }>;
  summary: {
    averageMonthlyRevenue: number;
    averageMonthlyFees: number;
    growth: number;
    totalPeriods: number;
  };
}

export interface EventAnalytics {
  events: Array<{
    id: string;
    title: string;
    organizationId: string;
    organizerName?: string;
    startTime: string;
    isPublished: boolean;
    category?: string;
    ticketsSold: number;
    totalRevenue: number;
    sellThroughRate: number;
    avgTicketPrice: number;
  }>;
  summary: {
    totalEvents: number;
    totalTicketsSold: number;
    avgTicketPrice: number;
    avgSellThroughRate: number;
  };
}

export interface OrganizerPerformance {
  organizers: Array<{
    id: string;
    name: string;
    email?: string;
    eventCount: number;
    publishedEvents: number;
    ticketsSold: number;
    totalRevenue: number;
    platformFees: number;
    avgTicketPrice: number;
    joinDate: string;
  }>;
}

export interface TicketAnalytics {
  tickets: Array<{
    id: string;
    customerName?: string;
    customerEmail?: string;
    event: {
      title: string;
      organizationName: string;
    };
    ticketType: {
      name: string;
    };
    price: number;
    seatRow?: string;
    seatNumber?: string;
    status: 'active' | 'used' | 'refunded' | 'cancelled';
    createdAt: string;
    usedAt?: string;
    refundedAt?: string;
  }>;
  stats: {
    total: number;
    active: number;
    used: number;
    refunded: number;
  };
  pagination?: {
    page: number;
    total: number;
    pages: number;
  };
}

export interface RecentActivity {
  activities: Array<{
    type: 'ticket_sale' | 'event_created' | 'organizer_joined';
    date: string;
    amount?: number;
    event_name?: string;
    organization_name?: string;
    name?: string;
    description?: string;
    details?: string;
  }>;
}

export interface TerritoryManagerStats {
  activeManagers: number;
  pendingApplications: number;
  totalCommissions: number;
}

export interface FeatureToggles {
  territoryManagerEnabled: boolean;
}

export interface SuperAdminApiResponse<T = any> {
  success: boolean;
  data: T;
  error?: string;
}

// Export data types
export interface ExportData {
  [key: string]: any;
}

export type ExportType = 'revenue' | 'organizers' | 'events' | 'tickets';

export interface FilterOptions {
  startDate?: string;
  endDate?: string;
  organizerId?: string;
  eventId?: string;
  status?: string;
  limit?: number;
  page?: number;
}