class DirectoryCommentResponse { final bool success; final String message; final List data; final int statusCode; final String? timestamp; DirectoryCommentResponse({ required this.success, required this.message, required this.data, required this.statusCode, this.timestamp, }); factory DirectoryCommentResponse.fromJson(Map json) { return DirectoryCommentResponse( success: json['success'] ?? false, message: json['message'] ?? '', data: (json['data'] as List?) ?.map((e) => DirectoryComment.fromJson(e)) .toList() ?? [], statusCode: json['statusCode'] ?? 0, timestamp: json['timestamp'], ); } } class DirectoryComment { final String id; final String note; final String contactName; final String organizationName; final DateTime createdAt; final CommentUser createdBy; final DateTime? updatedAt; final CommentUser? updatedBy; final String contactId; final bool isActive; DirectoryComment({ required this.id, required this.note, required this.contactName, required this.organizationName, required this.createdAt, required this.createdBy, this.updatedAt, this.updatedBy, required this.contactId, required this.isActive, }); factory DirectoryComment.fromJson(Map json) { return DirectoryComment( id: json['id'] ?? '', note: json['note'] ?? '', contactName: json['contactName'] ?? '', organizationName: json['organizationName'] ?? '', createdAt: DateTime.parse(json['createdAt']), createdBy: CommentUser.fromJson(json['createdBy']), updatedAt: json['updatedAt'] != null ? DateTime.parse(json['updatedAt']) : null, updatedBy: json['updatedBy'] != null ? CommentUser.fromJson(json['updatedBy']) : null, contactId: json['contactId'] ?? '', isActive: json['isActive'] ?? true, ); } DirectoryComment copyWith({ String? id, String? note, String? contactName, String? organizationName, DateTime? createdAt, CommentUser? createdBy, DateTime? updatedAt, CommentUser? updatedBy, String? contactId, bool? isActive, }) { return DirectoryComment( id: id ?? this.id, note: note ?? this.note, contactName: contactName ?? this.contactName, organizationName: organizationName ?? this.organizationName, createdAt: createdAt ?? this.createdAt, createdBy: createdBy ?? this.createdBy, updatedAt: updatedAt ?? this.updatedAt, updatedBy: updatedBy ?? this.updatedBy, contactId: contactId ?? this.contactId, isActive: isActive ?? this.isActive, ); } } class CommentUser { final String id; final String firstName; final String lastName; final String? photo; final String jobRoleId; final String jobRoleName; CommentUser({ required this.id, required this.firstName, required this.lastName, this.photo, required this.jobRoleId, required this.jobRoleName, }); factory CommentUser.fromJson(Map json) { return CommentUser( id: json['id'] ?? '', firstName: json['firstName'] ?? '', lastName: json['lastName'] ?? '', photo: json['photo'], jobRoleId: json['jobRoleId'] ?? '', jobRoleName: json['jobRoleName'] ?? '', ); } CommentUser copyWith({ String? id, String? firstName, String? lastName, String? photo, String? jobRoleId, String? jobRoleName, }) { return CommentUser( id: id ?? this.id, firstName: firstName ?? this.firstName, lastName: lastName ?? this.lastName, photo: photo ?? this.photo, jobRoleId: jobRoleId ?? this.jobRoleId, jobRoleName: jobRoleName ?? this.jobRoleName, ); } }