Files
plezy/lib/models/plex/plex_home_user.dart
T

57 lines
1.4 KiB
Dart
Raw Normal View History

import 'package:json_annotation/json_annotation.dart';
part 'plex_home_user.g.dart';
@JsonSerializable()
2025-10-30 18:49:59 +01:00
class PlexHomeUser {
@JsonKey(defaultValue: 0)
2025-10-30 18:49:59 +01:00
final int id;
@JsonKey(defaultValue: '')
2025-10-30 18:49:59 +01:00
final String uuid;
@JsonKey(defaultValue: 'Unknown')
2025-10-30 18:49:59 +01:00
final String title;
final String? username;
final String? email;
final String? friendlyName;
@JsonKey(defaultValue: '')
2025-10-30 18:49:59 +01:00
final String thumb;
@JsonKey(defaultValue: false)
2025-10-30 18:49:59 +01:00
final bool hasPassword;
@JsonKey(defaultValue: false)
2025-10-30 18:49:59 +01:00
final bool restricted;
2025-11-01 09:51:00 +01:00
final int? updatedAt;
@JsonKey(defaultValue: false)
2025-10-30 18:49:59 +01:00
final bool admin;
@JsonKey(defaultValue: false)
2025-10-30 18:49:59 +01:00
final bool guest;
@JsonKey(defaultValue: false)
2025-10-30 18:49:59 +01:00
final bool protected;
PlexHomeUser({
required this.id,
required this.uuid,
required this.title,
this.username,
this.email,
this.friendlyName,
required this.thumb,
required this.hasPassword,
required this.restricted,
required this.updatedAt,
required this.admin,
required this.guest,
required this.protected,
});
factory PlexHomeUser.fromJson(Map<String, dynamic> json) => _$PlexHomeUserFromJson(json);
2025-10-30 18:49:59 +01:00
Map<String, dynamic> toJson() => _$PlexHomeUserToJson(this);
2025-10-30 18:49:59 +01:00
String get displayName => friendlyName ?? title;
bool get isAdminUser => admin;
bool get isRestrictedUser => restricted;
bool get isGuestUser => guest;
2025-11-04 04:44:22 +01:00
bool get requiresPassword => protected;
2025-10-30 18:49:59 +01:00
}