Solian/lib/models/account.dart

102 lines
2.2 KiB
Dart
Raw Normal View History

import 'package:freezed_annotation/freezed_annotation.dart';
part 'account.g.dart';
@JsonSerializable()
2024-05-18 10:17:16 +00:00
class Account {
int id;
DateTime createdAt;
DateTime updatedAt;
DateTime? deletedAt;
2024-07-13 11:09:04 +00:00
DateTime? confirmedAt;
DateTime? suspendedAt;
2024-05-18 10:17:16 +00:00
String name;
String nick;
dynamic avatar;
dynamic banner;
2024-05-18 10:17:16 +00:00
String description;
2024-09-07 17:48:01 +00:00
AccountProfile? profile;
2024-06-03 15:36:46 +00:00
List<AccountBadge>? badges;
2024-05-18 10:17:16 +00:00
String? emailAddress;
Account({
required this.id,
required this.createdAt,
required this.updatedAt,
2024-05-28 16:14:41 +00:00
required this.deletedAt,
2024-07-13 11:09:04 +00:00
required this.confirmedAt,
required this.suspendedAt,
2024-05-18 10:17:16 +00:00
required this.name,
required this.nick,
required this.avatar,
required this.banner,
required this.description,
2024-09-07 17:48:01 +00:00
required this.profile,
2024-06-03 15:36:46 +00:00
required this.badges,
2024-05-28 16:14:41 +00:00
required this.emailAddress,
2024-05-18 10:17:16 +00:00
});
factory Account.fromJson(Map<String, dynamic> json) =>
_$AccountFromJson(json);
2024-05-18 10:17:16 +00:00
Map<String, dynamic> toJson() => _$AccountToJson(this);
2024-05-18 10:17:16 +00:00
}
2024-06-03 15:36:46 +00:00
@JsonSerializable()
2024-06-03 15:36:46 +00:00
class AccountBadge {
int id;
DateTime createdAt;
DateTime updatedAt;
DateTime? deletedAt;
Map<String, dynamic>? metadata;
String type;
int accountId;
AccountBadge({
required this.id,
required this.accountId,
required this.createdAt,
required this.updatedAt,
required this.deletedAt,
required this.metadata,
required this.type,
});
factory AccountBadge.fromJson(Map<String, dynamic> json) =>
_$AccountBadgeFromJson(json);
2024-06-03 15:36:46 +00:00
Map<String, dynamic> toJson() => _$AccountBadgeToJson(this);
2024-06-03 15:36:46 +00:00
}
2024-09-07 17:48:01 +00:00
@JsonSerializable()
class AccountProfile {
int id;
DateTime createdAt;
DateTime updatedAt;
DateTime? deletedAt;
String? firstName;
String? lastName;
int? experience;
DateTime? lastSeenAt;
DateTime? birthday;
int accountId;
AccountProfile({
required this.id,
required this.createdAt,
required this.updatedAt,
required this.deletedAt,
required this.firstName,
required this.lastName,
required this.experience,
required this.lastSeenAt,
required this.birthday,
required this.accountId,
});
factory AccountProfile.fromJson(Map<String, dynamic> json) =>
_$AccountProfileFromJson(json);
Map<String, dynamic> toJson() => _$AccountProfileToJson(this);
}