/// Mirrors web/src/lib/api/me.ts MyProfile. The `display_name` and /// `email` are nullable — server returns null when the user hasn't /// set them yet (registration only requires a username). class MyProfile { const MyProfile({ required this.id, required this.username, this.displayName, this.email, required this.isAdmin, }); final String id; final String username; final String? displayName; final String? email; final bool isAdmin; factory MyProfile.fromJson(Map j) => MyProfile( id: j['id'] as String? ?? '', username: j['username'] as String? ?? '', displayName: j['display_name'] as String?, email: j['email'] as String?, isAdmin: j['is_admin'] as bool? ?? false, ); } /// Mirrors web/src/lib/api/listenbrainz.ts LBStatus. class ListenBrainzStatus { const ListenBrainzStatus({ required this.enabled, required this.tokenSet, this.lastScrobbledAt, }); final bool enabled; /// True when the user has stored a token (token itself is never read /// back from the server). UI uses this to show "token saved" vs /// "no token" without exposing the value. final bool tokenSet; final String? lastScrobbledAt; factory ListenBrainzStatus.fromJson(Map j) => ListenBrainzStatus( enabled: j['enabled'] as bool? ?? false, tokenSet: j['token_set'] as bool? ?? false, lastScrobbledAt: j['last_scrobbled_at'] as String?, ); }