2024-11-09 10:28:45 +00:00
|
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
2024-11-16 17:16:54 +00:00
|
|
|
import 'package:hive_flutter/hive_flutter.dart';
|
2024-11-09 10:28:45 +00:00
|
|
|
|
|
|
|
part 'account.freezed.dart';
|
|
|
|
part 'account.g.dart';
|
|
|
|
|
|
|
|
@freezed
|
|
|
|
class SnAccount with _$SnAccount {
|
2024-11-16 17:16:54 +00:00
|
|
|
const SnAccount._();
|
|
|
|
|
2024-11-09 10:28:45 +00:00
|
|
|
const factory SnAccount({
|
2024-11-16 17:16:54 +00:00
|
|
|
@HiveField(0) required int id,
|
2024-11-09 10:28:45 +00:00
|
|
|
required DateTime createdAt,
|
2024-11-16 17:16:54 +00:00
|
|
|
required DateTime updatedAt,
|
2024-11-09 10:28:45 +00:00
|
|
|
required DateTime? deletedAt,
|
2024-11-16 17:16:54 +00:00
|
|
|
required DateTime? confirmedAt,
|
|
|
|
required List<SnAccountContact>? contacts,
|
|
|
|
required String avatar,
|
|
|
|
required String banner,
|
2024-11-09 10:28:45 +00:00
|
|
|
required String description,
|
|
|
|
required String name,
|
|
|
|
required String nick,
|
|
|
|
required Map<String, dynamic> permNodes,
|
|
|
|
required SnAccountProfile? profile,
|
2024-12-02 16:02:30 +00:00
|
|
|
@Default([]) List<SnAccountBadge> badges,
|
2024-11-09 10:28:45 +00:00
|
|
|
required DateTime? suspendedAt,
|
2024-11-16 17:16:54 +00:00
|
|
|
required int? affiliatedId,
|
|
|
|
required int? affiliatedTo,
|
|
|
|
required int? automatedBy,
|
|
|
|
required int? automatedId,
|
2024-11-09 10:28:45 +00:00
|
|
|
}) = _SnAccount;
|
|
|
|
|
|
|
|
factory SnAccount.fromJson(Map<String, Object?> json) =>
|
|
|
|
_$SnAccountFromJson(json);
|
|
|
|
}
|
|
|
|
|
|
|
|
@freezed
|
|
|
|
class SnAccountContact with _$SnAccountContact {
|
|
|
|
const factory SnAccountContact({
|
|
|
|
required int accountId,
|
|
|
|
required String content,
|
|
|
|
required DateTime createdAt,
|
|
|
|
required DateTime? deletedAt,
|
|
|
|
required int id,
|
|
|
|
required bool isPrimary,
|
|
|
|
required bool isPublic,
|
|
|
|
required int type,
|
|
|
|
required DateTime updatedAt,
|
|
|
|
required DateTime? verifiedAt,
|
|
|
|
}) = _SnAccountContact;
|
|
|
|
|
|
|
|
factory SnAccountContact.fromJson(Map<String, Object?> json) =>
|
|
|
|
_$SnAccountContactFromJson(json);
|
|
|
|
}
|
|
|
|
|
|
|
|
@freezed
|
|
|
|
class SnAccountProfile with _$SnAccountProfile {
|
|
|
|
const factory SnAccountProfile({
|
|
|
|
required int id,
|
|
|
|
required int accountId,
|
|
|
|
required DateTime? birthday,
|
|
|
|
required DateTime createdAt,
|
|
|
|
required DateTime? deletedAt,
|
|
|
|
required int experience,
|
|
|
|
required String firstName,
|
|
|
|
required String lastName,
|
|
|
|
required DateTime? lastSeenAt,
|
|
|
|
required DateTime updatedAt,
|
|
|
|
}) = _SnAccountProfile;
|
|
|
|
|
|
|
|
factory SnAccountProfile.fromJson(Map<String, Object?> json) =>
|
|
|
|
_$SnAccountProfileFromJson(json);
|
|
|
|
}
|
2024-11-30 14:39:49 +00:00
|
|
|
|
|
|
|
@freezed
|
|
|
|
class SnRelationship with _$SnRelationship {
|
|
|
|
const factory SnRelationship({
|
|
|
|
required int id,
|
|
|
|
required DateTime createdAt,
|
|
|
|
required DateTime updatedAt,
|
|
|
|
required DateTime? deletedAt,
|
|
|
|
required int accountId,
|
|
|
|
required int relatedId,
|
|
|
|
required SnAccount? account,
|
|
|
|
required SnAccount? related,
|
|
|
|
required int status,
|
|
|
|
@Default({}) Map<String, dynamic> permNodes,
|
|
|
|
}) = _SnRelationship;
|
|
|
|
|
|
|
|
factory SnRelationship.fromJson(Map<String, Object?> json) =>
|
|
|
|
_$SnRelationshipFromJson(json);
|
|
|
|
}
|
2024-12-02 16:02:30 +00:00
|
|
|
|
|
|
|
@freezed
|
|
|
|
class SnAccountBadge with _$SnAccountBadge {
|
|
|
|
const factory SnAccountBadge({
|
|
|
|
required int id,
|
|
|
|
required DateTime createdAt,
|
|
|
|
required DateTime updatedAt,
|
|
|
|
required dynamic deletedAt,
|
|
|
|
required String type,
|
|
|
|
required int accountId,
|
|
|
|
@Default({}) Map<String, dynamic> metadata,
|
|
|
|
}) = _SnAccountBadge;
|
|
|
|
|
|
|
|
factory SnAccountBadge.fromJson(Map<String, Object?> json) =>
|
|
|
|
_$SnAccountBadgeFromJson(json);
|
|
|
|
}
|