This commit is contained in:
2026-10-16 01:25:50 +05:30
commit c60ea2d370
89 changed files with 4661 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
class SupportTicket {
const SupportTicket({
required this.id,
required this.userId,
required this.username,
required this.category,
required this.categoryLabel,
required this.status,
required this.createdAt,
required this.updatedAt,
required this.lastMessageAt,
required this.lastMessagePreview,
});
final String id;
final int userId;
final String username;
final String category;
final String categoryLabel;
final String status;
final DateTime createdAt;
final DateTime updatedAt;
final DateTime lastMessageAt;
final String lastMessagePreview;
bool get isClosed => status == 'closed';
String get displayCategory =>
categoryLabel.isNotEmpty ? categoryLabel : category;
String get statusLabel => isClosed ? 'Closed' : 'Open';
factory SupportTicket.fromJson(Map<String, dynamic> json) {
return SupportTicket(
id: json['id'] as String,
userId: (json['userId'] as num).toInt(),
username: json['username'] as String? ?? '',
category: json['category'] as String? ?? '',
categoryLabel: json['categoryLabel'] as String? ?? '',
status: json['status'] as String? ?? 'open',
createdAt: DateTime.parse(json['createdAt'] as String),
updatedAt: DateTime.parse(json['updatedAt'] as String),
lastMessageAt: DateTime.parse(json['lastMessageAt'] as String),
lastMessagePreview: json['lastMessagePreview'] as String? ?? '',
);
}
}