class RecordingItem {
  const RecordingItem({
    required this.id,
    required this.sessionId,
    required this.opponentName,
    required this.teamName,
    this.endedAt,
    this.replayUrl,
    this.expiresAt,
  });

  final String id;
  final String sessionId;
  final String opponentName;
  final String teamName;
  final DateTime? endedAt;
  final String? replayUrl;
  final DateTime? expiresAt;

  factory RecordingItem.fromJson(Map<String, dynamic> json) {
    return RecordingItem(
      id: json['id'] as String,
      sessionId: json['session_id'] as String,
      opponentName: json['opponent_name'] as String,
      teamName: json['team_name'] as String,
      endedAt: json['ended_at'] != null
          ? DateTime.parse(json['ended_at'] as String)
          : null,
      replayUrl: json['replay_url'] as String?,
      expiresAt: json['expires_at'] != null
          ? DateTime.parse(json['expires_at'] as String)
          : null,
    );
  }
}
