import 'notification.m.dart'; import 'liveConsultation.m.dart'; import 'package:fis_jsonrpc/utils.dart'; class ChatMessagesDTO extends BaseDTO{ String? code; ChatCmdEnum chatCmdType; String? content; String? relevanceCode; TransactionTypeEnum transactionType; String? visitor; String? userCode; String? displayName; String? headImg; ChatMessagesDTO({ this.code, this.chatCmdType = ChatCmdEnum.Txt, this.content, this.relevanceCode, this.transactionType = TransactionTypeEnum.Consultion, this.visitor, this.userCode, this.displayName, this.headImg, DateTime? createTime, DateTime? updateTime, }) : super( createTime: createTime, updateTime: updateTime, ); factory ChatMessagesDTO.fromJson(Map map) { return ChatMessagesDTO( code: map['Code'], chatCmdType: ChatCmdEnum.values.firstWhere((e) => e.index == map['ChatCmdType']), content: map['Content'], relevanceCode: map['RelevanceCode'], transactionType: TransactionTypeEnum.values.firstWhere((e) => e.index == map['TransactionType']), visitor: map['Visitor'], userCode: map['UserCode'], displayName: map['DisplayName'], headImg: map['HeadImg'], createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null, updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null, ); } Map toJson() { final map = super.toJson(); if (code != null) map['Code'] = code; map['ChatCmdType'] = chatCmdType.index; if (content != null) map['Content'] = content; if (relevanceCode != null) map['RelevanceCode'] = relevanceCode; map['TransactionType'] = transactionType.index; if (visitor != null) map['Visitor'] = visitor; if (userCode != null) map['UserCode'] = userCode; if (displayName != null) map['DisplayName'] = displayName; if (headImg != null) map['HeadImg'] = headImg; return map; } } class GetChatMessagePageRequest extends PageRequest{ String? relevanceCode; GetChatMessagePageRequest({ this.relevanceCode, int pageIndex = 0, int pageSize = 0, String? token, }) : super( pageIndex: pageIndex, pageSize: pageSize, token: token, ); factory GetChatMessagePageRequest.fromJson(Map map) { return GetChatMessagePageRequest( relevanceCode: map['RelevanceCode'], pageIndex: map['PageIndex'], pageSize: map['PageSize'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (relevanceCode != null) map['RelevanceCode'] = relevanceCode; return map; } } class PageNoTokenRequest { int pageIndex; int pageSize; PageNoTokenRequest({ this.pageIndex = 0, this.pageSize = 0, }); factory PageNoTokenRequest.fromJson(Map map) { return PageNoTokenRequest( pageIndex: map['PageIndex'], pageSize: map['PageSize'], ); } Map toJson() { final map = Map(); map['PageIndex'] = pageIndex; map['PageSize'] = pageSize; return map; } } class GetChatMessagePageVisitorRequest extends PageNoTokenRequest{ String? relevanceCode; GetChatMessagePageVisitorRequest({ this.relevanceCode, int pageIndex = 0, int pageSize = 0, }) : super( pageIndex: pageIndex, pageSize: pageSize, ); factory GetChatMessagePageVisitorRequest.fromJson(Map map) { return GetChatMessagePageVisitorRequest( relevanceCode: map['RelevanceCode'], pageIndex: map['PageIndex'], pageSize: map['PageSize'], ); } Map toJson() { final map = super.toJson(); if (relevanceCode != null) map['RelevanceCode'] = relevanceCode; return map; } } class SendChatMessageRequest extends TokenRequest{ ChatCmdEnum chatCmdType; String? content; String? relevanceCode; TransactionTypeEnum transactionType; DateTime? createTime; SendChatMessageRequest({ this.chatCmdType = ChatCmdEnum.Txt, this.content, this.relevanceCode, this.transactionType = TransactionTypeEnum.Consultion, this.createTime, String? token, }) : super( token: token, ); factory SendChatMessageRequest.fromJson(Map map) { return SendChatMessageRequest( chatCmdType: ChatCmdEnum.values.firstWhere((e) => e.index == map['ChatCmdType']), content: map['Content'], relevanceCode: map['RelevanceCode'], transactionType: TransactionTypeEnum.values.firstWhere((e) => e.index == map['TransactionType']), createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null, token: map['Token'], ); } Map toJson() { final map = super.toJson(); map['ChatCmdType'] = chatCmdType.index; if (content != null) map['Content'] = content; if (relevanceCode != null) map['RelevanceCode'] = relevanceCode; map['TransactionType'] = transactionType.index; if (createTime != null) map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!); return map; } } class SendVisitChatMessageRequest { ChatCmdEnum chatCmdType; String? content; String? relevanceCode; TransactionTypeEnum transactionType; String? visitor; String? userName; DateTime? createTime; SendVisitChatMessageRequest({ this.chatCmdType = ChatCmdEnum.Txt, this.content, this.relevanceCode, this.transactionType = TransactionTypeEnum.Consultion, this.visitor, this.userName, this.createTime, }); factory SendVisitChatMessageRequest.fromJson(Map map) { return SendVisitChatMessageRequest( chatCmdType: ChatCmdEnum.values.firstWhere((e) => e.index == map['ChatCmdType']), content: map['Content'], relevanceCode: map['RelevanceCode'], transactionType: TransactionTypeEnum.values.firstWhere((e) => e.index == map['TransactionType']), visitor: map['Visitor'], userName: map['UserName'], createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null, ); } Map toJson() { final map = Map(); map['ChatCmdType'] = chatCmdType.index; if (content != null) { map['Content'] = content; } if (relevanceCode != null) { map['RelevanceCode'] = relevanceCode; } map['TransactionType'] = transactionType.index; if (visitor != null) { map['Visitor'] = visitor; } if (userName != null) { map['UserName'] = userName; } if (createTime != null) { map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!); } return map; } }