class VideoItem {
  const VideoItem({required this.name, required this.size});

  final String name;
  final int size;

  factory VideoItem.fromJson(Map<String, dynamic> json) {
    return VideoItem(
      name: json['name'] as String? ?? '',
      size: json['size'] as int? ?? 0,
    );
  }

  String get sizeLabel {
    if (size >= 1024 * 1024) {
      return '${(size / (1024 * 1024)).toStringAsFixed(1)} MB';
    }
    if (size >= 1024) {
      return '${(size / 1024).toStringAsFixed(1)} KB';
    }
    return '$size B';
  }
}
