/// Mirrors web/src/lib/api/types.ts LidarrQuarantineMineRow. One row
/// per quarantined track owned by the caller. Server returns a flat
/// list (no Page envelope) at /api/quarantine/mine.
class QuarantineMineRow {
  const QuarantineMineRow({
    required this.trackId,
    required this.reason,
    this.notes,
    required this.createdAt,
    required this.trackTitle,
    required this.trackDurationMs,
    required this.albumId,
    required this.albumTitle,
    this.albumCoverArtPath,
    required this.artistId,
    required this.artistName,
  });

  final String trackId;
  /// One of: bad_rip / wrong_file / wrong_tags / duplicate / other.
  final String reason;
  final String? notes;
  final String createdAt;
  final String trackTitle;
  final int trackDurationMs;
  final String albumId;
  final String albumTitle;
  final String? albumCoverArtPath;
  final String artistId;
  final String artistName;

  factory QuarantineMineRow.fromJson(Map<String, dynamic> j) =>
      QuarantineMineRow(
        trackId: j['track_id'] as String? ?? '',
        reason: j['reason'] as String? ?? 'other',
        notes: j['notes'] as String?,
        createdAt: j['created_at'] as String? ?? '',
        trackTitle: j['track_title'] as String? ?? '',
        trackDurationMs: (j['track_duration_ms'] as num?)?.toInt() ?? 0,
        albumId: j['album_id'] as String? ?? '',
        albumTitle: j['album_title'] as String? ?? '',
        albumCoverArtPath: j['album_cover_art_path'] as String?,
        artistId: j['artist_id'] as String? ?? '',
        artistName: j['artist_name'] as String? ?? '',
      );
}
