import 'package:flutter/material.dart';

/// Riga compatta metriche stream (sostituisce le MetricCard ingombranti in camera).
class CameraCompactMetrics extends StatelessWidget {
  const CameraCompactMetrics({
    super.key,
    required this.networkType,
    required this.bitrateMbps,
    required this.fps,
    this.batteryLevel,
    this.viewerCount,
    this.light = false,
  });

  final String networkType;
  final double bitrateMbps;
  final int fps;
  final int? batteryLevel;
  final int? viewerCount;
  final bool light;

  @override
  Widget build(BuildContext context) {
    final color = light ? Colors.white70 : Theme.of(context).textTheme.bodySmall?.color;
    final parts = <String>[
      networkType,
      '${bitrateMbps.toStringAsFixed(1)} Mbps',
      '$fps fps',
      if (batteryLevel != null) '$batteryLevel%',
      if (viewerCount != null && viewerCount! > 0) '$viewerCount spett.',
    ];
    return Text(
      parts.join(' · '),
      style: TextStyle(fontSize: 11, color: color, fontWeight: FontWeight.w500),
      maxLines: 1,
      overflow: TextOverflow.ellipsis,
    );
  }
}
