You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
2.5 KiB
Dart
97 lines
2.5 KiB
Dart
import 'package:mc_common_app/classes/app_state.dart';
|
|
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
import 'package:mc_common_app/utils/enums.dart';
|
|
|
|
class ChatMessageModel {
|
|
int? id;
|
|
String? senderUserID;
|
|
String? senderName;
|
|
int? messageType;
|
|
ChatMessageTypeEnum? chatMessageTypeEnum;
|
|
String? chatText;
|
|
int? requestID;
|
|
int? reqOfferID;
|
|
int? serviceProviderID;
|
|
int? offerStatus;
|
|
ReqOffer? reqOffer;
|
|
bool? isRead;
|
|
String? readOn;
|
|
bool? isMyMessage;
|
|
|
|
ChatMessageModel({
|
|
this.id,
|
|
this.senderUserID,
|
|
this.senderName,
|
|
this.messageType,
|
|
this.chatMessageTypeEnum,
|
|
this.chatText,
|
|
this.requestID,
|
|
this.reqOfferID,
|
|
this.serviceProviderID,
|
|
this.offerStatus,
|
|
this.reqOffer,
|
|
this.isRead,
|
|
this.readOn,
|
|
this.isMyMessage,
|
|
});
|
|
|
|
ChatMessageModel.fromJson(Map<String, dynamic> json) {
|
|
final myUserId = AppState().getUser.data!.userInfo!.userId.toString();
|
|
id = json['id'];
|
|
senderUserID = json['senderUserID'];
|
|
senderName = json['senderName'];
|
|
messageType = json['messageType'];
|
|
chatMessageTypeEnum = (json['messageType'] as int).toChatMessageTypeEnum();
|
|
chatText = json['chatText'];
|
|
requestID = json['requestID'];
|
|
reqOfferID = json['reqOfferID'];
|
|
serviceProviderID = json['serviceProviderID'];
|
|
offerStatus = json['offerStatus'];
|
|
reqOffer = json['reqOffer'] != null ? ReqOffer.fromJson(json['reqOffer']) : null;
|
|
isRead = json['isRead'];
|
|
readOn = json['readOn'];
|
|
isMyMessage = (json['senderUserId']).toString() == myUserId;
|
|
}
|
|
}
|
|
|
|
class ReqOffer {
|
|
int? id;
|
|
int? requestID;
|
|
int? serviceProviderID;
|
|
int? offerStatus;
|
|
String? offerStatusText;
|
|
String? comment;
|
|
double? price;
|
|
RequestOfferStatusEnum? requestOfferStatusEnum;
|
|
|
|
ReqOffer({
|
|
this.id,
|
|
this.requestID,
|
|
this.serviceProviderID,
|
|
this.offerStatus,
|
|
this.offerStatusText,
|
|
this.comment,
|
|
this.price,
|
|
this.requestOfferStatusEnum,
|
|
});
|
|
|
|
ReqOffer.fromJson(Map<String, dynamic> json) {
|
|
id = json['id'];
|
|
requestID = json['requestID'];
|
|
serviceProviderID = json['serviceProviderID'];
|
|
offerStatus = json['offerStatus'];
|
|
offerStatusText = json['offerStatusText'];
|
|
comment = json['comment'];
|
|
price = json['price'];
|
|
requestOfferStatusEnum = ((json['offerStatus']) as int).toRequestOfferStatusEnum();
|
|
}
|
|
}
|
|
|
|
class OfferRequestCommentModel {
|
|
int? index;
|
|
String? title;
|
|
bool? isSelected;
|
|
|
|
OfferRequestCommentModel({this.index, this.title, this.isSelected});
|
|
}
|