export interface AdminDashboardData {
  timestamp: string;
  status: "healthy" | "unhealthy";
  system: {
    memory: Record<string, unknown>;
    disk: {
      used_percent?: number;
      total_gb?: number;
      free_gb?: number;
    };
  };
  providers: Record<string, ProviderStatus>;
  cleanup: {
    files_cleaned: number;
    tracked_files_count: number;
  };
  rate_limits: {
    active_clients: number;
  };
  config: {
    max_file_size_mb: number;
    supported_extensions: string[];
    translation_service: string;
  };
}

export interface ProviderStatus {
  name: string;
  available: boolean;
  last_check: string | null;
  latency_ms?: number;
  error?: string;
  /** true when availability is derived from configuration (no live call) */
  config_only?: boolean;
  /** optional display label provided by the backend */
  label?: string;
}

export interface CleanupResponse {
  status: "success" | "error";
  files_cleaned: number;
  message: string;
}

export type StatsPeriod = "today" | "week" | "month";

export interface ProviderBreakdownItem {
  count: number;
  percentage: number;
}

export interface FormatBreakdownItem {
  count: number;
  percentage: number;
}

export interface TopUser {
  user_id: string;
  email: string;
  translation_count: number;
}

export interface TranslationStatsData {
  period: StatsPeriod;
  total_translations: number;
  total_translations_last_period: number;
  error_rate: number;
  error_count: number;
  success_count: number;
  top_users: TopUser[];
  provider_breakdown: Record<string, ProviderBreakdownItem>;
  format_breakdown: Record<string, FormatBreakdownItem>;
}

export interface TranslationStatsResponse {
  data: TranslationStatsData;
  meta: {
    generated_at: string;
  };
}
