/**
 * 🎯 Interfaces para Dashboard de Performance de Rotas
 * Estruturas de dados para métricas e visualizações futuristas
 */

// ========================================
// 🛣️ STATUS DE ROTAS
// ========================================
export interface RouteStatus {
  id: string;
  name: string;
  count: number;
  percentage: number;
  trend: 'up' | 'down' | 'stable';
  trendValue: number;
  color: string;
  icon: string;
}

export interface RouteStatusMetrics {
  active: RouteStatus;
  completed: RouteStatus;
  pending: RouteStatus;
  delayed: RouteStatus;
  total: number;
  monthlyTrend: number;
}

// ========================================
// 🚛 PERFIL DE VEÍCULOS
// ========================================
export interface VehicleProfile {
  type: string;
  count: number;
  percentage: number;
  averageAge: number;
  performanceScore: number;
  mostUsed: boolean;
  color: string;
  icon: string;
}

export interface VehicleMetrics {
  profiles: VehicleProfile[];
  totalVehicles: number;
  averageAge: number;
  topPerformer: VehicleProfile;
}

// ========================================
// 👨‍💼 PERFIL DE MOTORISTAS
// ========================================
export interface DriverProfile {
  gender: 'male' | 'female' | 'other';
  count: number;
  percentage: number;
  averageAge: number;
  performanceScore: number;
  color: string;
}

export interface DriverMetrics {
  profiles: DriverProfile[];
  totalDrivers: number;
  averageAge: number;
  activeDrivers: number;
  topPerformers: number;
}

// ========================================
// 🚚 MODAL DE TRANSPORTE
// ========================================
export interface TransportModal {
  type: 'road' | 'rail' | 'air' | 'sea' | 'multimodal';
  name: string;
  count: number;
  percentage: number;
  efficiency: number;
  cost: number;
  color: string;
  icon: string;
}

export interface TransportModalMetrics {
  modals: TransportModal[];
  totalRoutes: number;
  mostEfficient: TransportModal;
  mostUsed: TransportModal;
}

// ========================================
// 💰 DADOS OPERACIONAIS E FINANCEIROS
// ========================================
export interface OperationalCost {
  type: 'fuel' | 'tolls' | 'fines' | 'maintenance' | 'other';
  name: string;
  amount: number;
  percentage: number;
  trend: 'up' | 'down' | 'stable';
  trendValue: number;
  color: string;
  icon: string;
}

export interface OperationalMetrics {
  averageDuration: number; // em horas
  totalDistance: number;   // em km
  costs: OperationalCost[];
  totalCost: number;
  costPerKm: number;
  efficiency: number;
}

// ========================================
// 📦 VOLUMES TRANSPORTADOS
// ========================================
export interface VolumeMetrics {
  totalVolumes: number;
  volumesByStatus: {
    active: number;
    completed: number;
    pending: number;
    delayed: number;
  };
  averageVolumePerVehicle: number;
  volumeEfficiency: number;
  trend: 'up' | 'down' | 'stable';
  trendValue: number;
}

// ========================================
// 🎨 CONFIGURAÇÕES VISUAIS
// ========================================
export interface ChartConfig {
  type: 'pie' | 'doughnut' | 'bar' | 'line' | 'area' | 'radar';
  animated: boolean;
  neonEffect: boolean;
  holographic: boolean;
  colors: string[];
  gradients?: string[];
}

export interface CardConfig {
  title: string;
  subtitle?: string;
  icon: string;
  color: string;
  glowEffect: boolean;
  animated: boolean;
  size: 'small' | 'medium' | 'large';
}

// ========================================
// 📊 DASHBOARD PRINCIPAL
// ========================================
export interface RoutesPerformanceDashboard {
  routeStatus: RouteStatusMetrics;
  vehicleMetrics: VehicleMetrics;
  driverMetrics: DriverMetrics;
  transportModal: TransportModalMetrics;
  operationalMetrics: OperationalMetrics;
  volumeMetrics: VolumeMetrics;
  lastUpdated: Date;
  refreshInterval: number;
}

// ========================================
// 🔧 CONFIGURAÇÕES DO DASHBOARD
// ========================================
export interface DashboardConfig {
  theme: 'dark' | 'light' | 'auto';
  animations: boolean;
  autoRefresh: boolean;
  refreshInterval: number;
  compactMode: boolean;
  showTrends: boolean;
  showPercentages: boolean;
}

// ========================================
// 📱 FILTROS E PERÍODOS
// ========================================
export interface DashboardFilters {
  dateRange: {
    start: Date;
    end: Date;
  };
  vehicleTypes?: string[];
  driverIds?: string[];
  transportModals?: string[];
  routeStatus?: string[];
}

export interface TimePeriod {
  id: string;
  name: string;
  days: number;
  active: boolean;
}
