/// Mirrors `systemPlaylistsStatusResp` from internal/api/me_system_playlists.go.
/// Reflects the caller's most recent system_playlist_runs row, or zero
/// values when no row exists yet (the user has never had a build attempted).
class SystemPlaylistsStatus {
  const SystemPlaylistsStatus({
    required this.inFlight,
    this.lastRunAt,
    this.lastError,
  });

  final bool inFlight;
  final String? lastRunAt;
  final String? lastError;

  factory SystemPlaylistsStatus.empty() =>
      const SystemPlaylistsStatus(inFlight: false);

  factory SystemPlaylistsStatus.fromJson(Map<String, dynamic> j) =>
      SystemPlaylistsStatus(
        inFlight: j['in_flight'] as bool? ?? false,
        lastRunAt: j['last_run_at'] as String?,
        lastError: j['last_error'] as String?,
      );
}
