// Mirrors internal/api/types.go UserView. The /api/* user shape — narrower
// than dbq.User (no password hash, no api_token, no subsonic_password).
//
// `id` is a pgtype.UUID server-side which marshals to a plain string when
// Valid, so we accept it as String here. `is_admin` is always present in
// the server response but we tolerate its absence (default false) to keep
// older fixtures and partial mocks loadable.
class User {
  const User({
    required this.id,
    required this.username,
    required this.isAdmin,
  });

  final String id;
  final String username;
  final bool isAdmin;

  factory User.fromJson(Map<String, dynamic> j) => User(
        id: j['id'] as String,
        username: j['username'] as String,
        isAdmin: j['is_admin'] as bool? ?? false,
      );
}
