import 'package:fis_jsonrpc/utils.dart'; enum NotificationTypeEnum { placeHolder_0, ChatMsgNotification, TokenReplacedNotification, DisconnectNotification, ConnectionNotification, ExamRecordsFinishedNotification, RejectApplyConsultationNotification, CancelInvitingInLiveConsultationNotification, InviteInLiveConsultationNotification, ConsultationRemindNotification, PasswordExpiredWarningNotification, InviteLiveConsultationNotification, AcceptLiveConsultationNotification, RejectLiveConsultationNotification, InviteLiveConsultationToDeviceNotification, CancelLiveConsultationNotification, CloseLiveConsultationNotification, JoinLiveConsultationNotification, NetworkErrConsultationNotification, LeaveConsultationNotification, JoinInLiveConsultationNotification, RejectInviteLiveConsultationNotification, ApplyConsultationNotification, ApprovalApplyConsultationNotification, InviteeConsultationNotification, InviteeApproveApplyConsultationNotification, InviteeRejectApplyConsultationNotification, MuteLiveConsultationNotification, SwitchLiveConsultationVideoNotification, HeartRateJoinConsultationNotification, HeartRateLeaveConsultationNotification, CloseLiveConsultationToDeviceNotification, CancelLiveConsultationToDeviceNotification, } enum ChatCmdEnum { Txt, Image, MP4, Voice, Cases, ShareLive, VideoCall, VoiceCall, } class ChatMsgNotification { NotificationTypeEnum notificationType; String? userCode; ChatCmdEnum chatCmd; DateTime? sendTime; String? message; ChatMsgNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.userCode, this.chatCmd = ChatCmdEnum.Txt, this.sendTime, this.message, }); factory ChatMsgNotification.fromJson(Map map) { return ChatMsgNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), userCode: map['UserCode'], chatCmd: ChatCmdEnum.values.firstWhere((e) => e.index == map['ChatCmd']), sendTime: map['SendTime'] != null ? DateTime.parse(map['SendTime']) : null, message: map['Message'], ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(userCode != null) map['UserCode'] = userCode; map['ChatCmd'] = chatCmd.index; if(sendTime != null) map['SendTime'] = JsonRpcUtils.dateFormat(sendTime!); if(message != null) map['Message'] = message; return map; } } class ConnectionNotification { NotificationTypeEnum notificationType; ConnectionNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, }); factory ConnectionNotification.fromJson(Map map) { return ConnectionNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; return map; } } class DisconnectNotification { NotificationTypeEnum notificationType; DisconnectNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, }); factory DisconnectNotification.fromJson(Map map) { return DisconnectNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; return map; } } class ExamRecordsFinishedNotification { NotificationTypeEnum notificationType; List? codes; ExamRecordsFinishedNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.codes, }); factory ExamRecordsFinishedNotification.fromJson(Map map) { return ExamRecordsFinishedNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), codes: map['Codes'] != null ? map['Codes'].cast().toList() : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(codes != null) map['Codes'] = codes; return map; } } class PasswordExpiredWarningNotification { NotificationTypeEnum notificationType; double surplusTime; PasswordExpiredWarningNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.surplusTime = 0, }); factory PasswordExpiredWarningNotification.fromJson(Map map) { return PasswordExpiredWarningNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), surplusTime: double.parse(map['SurplusTime'].toString()), ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; map['SurplusTime'] = surplusTime; return map; } } class TokenReplacedNotification { NotificationTypeEnum notificationType; String? userCode; TokenReplacedNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.userCode, }); factory TokenReplacedNotification.fromJson(Map map) { return TokenReplacedNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), userCode: map['UserCode'], ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(userCode != null) map['UserCode'] = userCode; return map; } } class ApplyConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; String? operatorName; String? patientName; DateTime? applicationTime; String? applyOrganizationName; DateTime? consultationTime; ApplyConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.operatorName, this.patientName, this.applicationTime, this.applyOrganizationName, this.consultationTime, }); factory ApplyConsultationNotification.fromJson(Map map) { return ApplyConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], operatorName: map['OperatorName'], patientName: map['PatientName'], applicationTime: map['ApplicationTime'] != null ? DateTime.parse(map['ApplicationTime']) : null, applyOrganizationName: map['ApplyOrganizationName'], consultationTime: map['ConsultationTime'] != null ? DateTime.parse(map['ConsultationTime']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(operatorName != null) map['OperatorName'] = operatorName; if(patientName != null) map['PatientName'] = patientName; if(applicationTime != null) map['ApplicationTime'] = JsonRpcUtils.dateFormat(applicationTime!); if(applyOrganizationName != null) map['ApplyOrganizationName'] = applyOrganizationName; if(consultationTime != null) map['ConsultationTime'] = JsonRpcUtils.dateFormat(consultationTime!); return map; } } class ApprovalApplyConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; String? operatorName; String? patientName; DateTime? consultationTime; DateTime? consultationTimeEnd; ApprovalApplyConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.operatorName, this.patientName, this.consultationTime, this.consultationTimeEnd, }); factory ApprovalApplyConsultationNotification.fromJson(Map map) { return ApprovalApplyConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], operatorName: map['OperatorName'], patientName: map['PatientName'], consultationTime: map['ConsultationTime'] != null ? DateTime.parse(map['ConsultationTime']) : null, consultationTimeEnd: map['ConsultationTimeEnd'] != null ? DateTime.parse(map['ConsultationTimeEnd']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(operatorName != null) map['OperatorName'] = operatorName; if(patientName != null) map['PatientName'] = patientName; if(consultationTime != null) map['ConsultationTime'] = JsonRpcUtils.dateFormat(consultationTime!); if(consultationTimeEnd != null) map['ConsultationTimeEnd'] = JsonRpcUtils.dateFormat(consultationTimeEnd!); return map; } } class ConsultationRemindNotification { NotificationTypeEnum notificationType; String? consultationCode; int countdownTime; String? patientName; DateTime? consultationTime; DateTime? consultationTimeEnd; String? expertName; ConsultationRemindNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.countdownTime = 0, this.patientName, this.consultationTime, this.consultationTimeEnd, this.expertName, }); factory ConsultationRemindNotification.fromJson(Map map) { return ConsultationRemindNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], countdownTime: map['CountdownTime'], patientName: map['PatientName'], consultationTime: map['ConsultationTime'] != null ? DateTime.parse(map['ConsultationTime']) : null, consultationTimeEnd: map['ConsultationTimeEnd'] != null ? DateTime.parse(map['ConsultationTimeEnd']) : null, expertName: map['ExpertName'], ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; map['CountdownTime'] = countdownTime; if(patientName != null) map['PatientName'] = patientName; if(consultationTime != null) map['ConsultationTime'] = JsonRpcUtils.dateFormat(consultationTime!); if(consultationTimeEnd != null) map['ConsultationTimeEnd'] = JsonRpcUtils.dateFormat(consultationTimeEnd!); if(expertName != null) map['ExpertName'] = expertName; return map; } } class InviteeApproveApplyConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; String? operatorName; String? patientName; DateTime? consultationTime; DateTime? consultationTimeEnd; InviteeApproveApplyConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.operatorName, this.patientName, this.consultationTime, this.consultationTimeEnd, }); factory InviteeApproveApplyConsultationNotification.fromJson(Map map) { return InviteeApproveApplyConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], operatorName: map['OperatorName'], patientName: map['PatientName'], consultationTime: map['ConsultationTime'] != null ? DateTime.parse(map['ConsultationTime']) : null, consultationTimeEnd: map['ConsultationTimeEnd'] != null ? DateTime.parse(map['ConsultationTimeEnd']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(operatorName != null) map['OperatorName'] = operatorName; if(patientName != null) map['PatientName'] = patientName; if(consultationTime != null) map['ConsultationTime'] = JsonRpcUtils.dateFormat(consultationTime!); if(consultationTimeEnd != null) map['ConsultationTimeEnd'] = JsonRpcUtils.dateFormat(consultationTimeEnd!); return map; } } class InviteeConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; String? operatorName; String? patientName; DateTime? consultationTime; DateTime? consultationTimeEnd; InviteeConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.operatorName, this.patientName, this.consultationTime, this.consultationTimeEnd, }); factory InviteeConsultationNotification.fromJson(Map map) { return InviteeConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], operatorName: map['OperatorName'], patientName: map['PatientName'], consultationTime: map['ConsultationTime'] != null ? DateTime.parse(map['ConsultationTime']) : null, consultationTimeEnd: map['ConsultationTimeEnd'] != null ? DateTime.parse(map['ConsultationTimeEnd']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(operatorName != null) map['OperatorName'] = operatorName; if(patientName != null) map['PatientName'] = patientName; if(consultationTime != null) map['ConsultationTime'] = JsonRpcUtils.dateFormat(consultationTime!); if(consultationTimeEnd != null) map['ConsultationTimeEnd'] = JsonRpcUtils.dateFormat(consultationTimeEnd!); return map; } } class InviteeRejectApplyConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; String? operatorName; String? patientName; DateTime? consultationTime; DateTime? consultationTimeEnd; String? rejectReason; InviteeRejectApplyConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.operatorName, this.patientName, this.consultationTime, this.consultationTimeEnd, this.rejectReason, }); factory InviteeRejectApplyConsultationNotification.fromJson(Map map) { return InviteeRejectApplyConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], operatorName: map['OperatorName'], patientName: map['PatientName'], consultationTime: map['ConsultationTime'] != null ? DateTime.parse(map['ConsultationTime']) : null, consultationTimeEnd: map['ConsultationTimeEnd'] != null ? DateTime.parse(map['ConsultationTimeEnd']) : null, rejectReason: map['RejectReason'], ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(operatorName != null) map['OperatorName'] = operatorName; if(patientName != null) map['PatientName'] = patientName; if(consultationTime != null) map['ConsultationTime'] = JsonRpcUtils.dateFormat(consultationTime!); if(consultationTimeEnd != null) map['ConsultationTimeEnd'] = JsonRpcUtils.dateFormat(consultationTimeEnd!); if(rejectReason != null) map['RejectReason'] = rejectReason; return map; } } class RejectApplyConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; String? patientName; String? operatorName; String? rejectReason; RejectApplyConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.patientName, this.operatorName, this.rejectReason, }); factory RejectApplyConsultationNotification.fromJson(Map map) { return RejectApplyConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], patientName: map['PatientName'], operatorName: map['OperatorName'], rejectReason: map['RejectReason'], ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(patientName != null) map['PatientName'] = patientName; if(operatorName != null) map['OperatorName'] = operatorName; if(rejectReason != null) map['RejectReason'] = rejectReason; return map; } } class LiveConsultationMemberInfo { String? id; String? name; String? headImageUrl; LiveConsultationMemberInfo({ this.id, this.name, this.headImageUrl, }); factory LiveConsultationMemberInfo.fromJson(Map map) { return LiveConsultationMemberInfo( id: map['Id'], name: map['Name'], headImageUrl: map['HeadImageUrl'], ); } Map toJson() { final map = Map(); if(id != null) map['Id'] = id; if(name != null) map['Name'] = name; if(headImageUrl != null) map['HeadImageUrl'] = headImageUrl; return map; } } enum LoginSource { PC, Mobile, Pad, Web, US, } class LiveData { int height; int width; String? rtmpPushUrl; String? rtmpPullUrl; String? httpPullUrl; String? hlsPullUrl; LiveData({ this.height = 0, this.width = 0, this.rtmpPushUrl, this.rtmpPullUrl, this.httpPullUrl, this.hlsPullUrl, }); factory LiveData.fromJson(Map map) { return LiveData( height: map['Height'], width: map['Width'], rtmpPushUrl: map['RtmpPushUrl'], rtmpPullUrl: map['RtmpPullUrl'], httpPullUrl: map['HttpPullUrl'], hlsPullUrl: map['HlsPullUrl'], ); } Map toJson() { final map = Map(); map['Height'] = height; map['Width'] = width; if(rtmpPushUrl != null) map['RtmpPushUrl'] = rtmpPushUrl; if(rtmpPullUrl != null) map['RtmpPullUrl'] = rtmpPullUrl; if(httpPullUrl != null) map['HttpPullUrl'] = httpPullUrl; if(hlsPullUrl != null) map['HlsPullUrl'] = hlsPullUrl; return map; } } class LiveConsultatioAccepterInfo extends LiveConsultationMemberInfo{ bool isOnline; bool mute; LoginSource loginSource; LiveData? liveData; LiveConsultatioAccepterInfo({ this.isOnline = false, this.mute = false, this.loginSource = LoginSource.PC, this.liveData, String? id, String? name, String? headImageUrl, }) : super( id: id, name: name, headImageUrl: headImageUrl, ); factory LiveConsultatioAccepterInfo.fromJson(Map map) { return LiveConsultatioAccepterInfo( isOnline: map['IsOnline'], mute: map['Mute'], loginSource: LoginSource.values.firstWhere((e) => e.index == map['LoginSource']), liveData: map['LiveData'] != null ? LiveData.fromJson(map['LiveData']) : null, id: map['Id'], name: map['Name'], headImageUrl: map['HeadImageUrl'], ); } Map toJson() { final map = super.toJson(); map['IsOnline'] = isOnline; map['Mute'] = mute; map['LoginSource'] = loginSource.index; if(liveData != null) map['LiveData'] = liveData; return map; } } class AcceptLiveConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; LiveConsultatioAccepterInfo? accepter; AcceptLiveConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.accepter, }); factory AcceptLiveConsultationNotification.fromJson(Map map) { return AcceptLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], accepter: map['Accepter'] != null ? LiveConsultatioAccepterInfo.fromJson(map['Accepter']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(accepter != null) map['Accepter'] = accepter; return map; } } class CancelInvitingInLiveConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; CancelInvitingInLiveConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, }); factory CancelInvitingInLiveConsultationNotification.fromJson(Map map) { return CancelInvitingInLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; return map; } } class CancelLiveConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; String? initiatorCode; CancelLiveConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.initiatorCode, }); factory CancelLiveConsultationNotification.fromJson(Map map) { return CancelLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], initiatorCode: map['InitiatorCode'], ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(initiatorCode != null) map['InitiatorCode'] = initiatorCode; return map; } } class CloseLiveConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; String? initiatorCode; CloseLiveConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.initiatorCode, }); factory CloseLiveConsultationNotification.fromJson(Map map) { return CloseLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], initiatorCode: map['InitiatorCode'], ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(initiatorCode != null) map['InitiatorCode'] = initiatorCode; return map; } } class CancelLiveConsultationToDeviceNotification { NotificationTypeEnum notificationType; String? consultationCode; String? initiatorCode; CancelLiveConsultationToDeviceNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.initiatorCode, }); factory CancelLiveConsultationToDeviceNotification.fromJson(Map map) { return CancelLiveConsultationToDeviceNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], initiatorCode: map['InitiatorCode'], ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(initiatorCode != null) map['InitiatorCode'] = initiatorCode; return map; } } class CloseLiveConsultationToDeviceNotification { NotificationTypeEnum notificationType; String? consultationCode; String? initiatorCode; CloseLiveConsultationToDeviceNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.initiatorCode, }); factory CloseLiveConsultationToDeviceNotification.fromJson(Map map) { return CloseLiveConsultationToDeviceNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], initiatorCode: map['InitiatorCode'], ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(initiatorCode != null) map['InitiatorCode'] = initiatorCode; return map; } } class LiveConsultationJoinerInfo extends LiveConsultationMemberInfo{ bool isOnline; bool mute; bool isInitiator; LoginSource loginSource; LiveData? liveData; LiveConsultationJoinerInfo({ this.isOnline = false, this.mute = false, this.isInitiator = false, this.loginSource = LoginSource.PC, this.liveData, String? id, String? name, String? headImageUrl, }) : super( id: id, name: name, headImageUrl: headImageUrl, ); factory LiveConsultationJoinerInfo.fromJson(Map map) { return LiveConsultationJoinerInfo( isOnline: map['IsOnline'], mute: map['Mute'], isInitiator: map['IsInitiator'], loginSource: LoginSource.values.firstWhere((e) => e.index == map['LoginSource']), liveData: map['LiveData'] != null ? LiveData.fromJson(map['LiveData']) : null, id: map['Id'], name: map['Name'], headImageUrl: map['HeadImageUrl'], ); } Map toJson() { final map = super.toJson(); map['IsOnline'] = isOnline; map['Mute'] = mute; map['IsInitiator'] = isInitiator; map['LoginSource'] = loginSource.index; if(liveData != null) map['LiveData'] = liveData; return map; } } class HeartRateJoinConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; LiveConsultationJoinerInfo? joiner; HeartRateJoinConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.joiner, }); factory HeartRateJoinConsultationNotification.fromJson(Map map) { return HeartRateJoinConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], joiner: map['Joiner'] != null ? LiveConsultationJoinerInfo.fromJson(map['Joiner']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(joiner != null) map['Joiner'] = joiner; return map; } } class LiveConsultationLeaverInfo extends LiveConsultationMemberInfo{ LiveConsultationLeaverInfo({ String? id, String? name, String? headImageUrl, }) : super( id: id, name: name, headImageUrl: headImageUrl, ); factory LiveConsultationLeaverInfo.fromJson(Map map) { return LiveConsultationLeaverInfo( id: map['Id'], name: map['Name'], headImageUrl: map['HeadImageUrl'], ); } Map toJson() { final map = super.toJson(); return map; } } class HeartRateLeaveConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; LiveConsultationLeaverInfo? leaverInfo; HeartRateLeaveConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.leaverInfo, }); factory HeartRateLeaveConsultationNotification.fromJson(Map map) { return HeartRateLeaveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], leaverInfo: map['LeaverInfo'] != null ? LiveConsultationLeaverInfo.fromJson(map['LeaverInfo']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(leaverInfo != null) map['LeaverInfo'] = leaverInfo; return map; } } enum LiveMemberEnum { placeHolder_0, User, Device, } enum LiveConsultationMemberStatus { Default, Accepted, Rejected, Joined, Left, } enum VideoDeviceSourceTypeEnum { Desktop, Camera, } class VideoDeviceOutputInfo { String? videoDeviceId; VideoDeviceSourceTypeEnum videoDeviceSourceType; int outputWidth; int outputHeight; String? videoDeviceSign; VideoDeviceOutputInfo({ this.videoDeviceId, this.videoDeviceSourceType = VideoDeviceSourceTypeEnum.Desktop, this.outputWidth = 0, this.outputHeight = 0, this.videoDeviceSign, }); factory VideoDeviceOutputInfo.fromJson(Map map) { return VideoDeviceOutputInfo( videoDeviceId: map['VideoDeviceId'], videoDeviceSourceType: VideoDeviceSourceTypeEnum.values.firstWhere((e) => e.index == map['VideoDeviceSourceType']), outputWidth: map['OutputWidth'], outputHeight: map['OutputHeight'], videoDeviceSign: map['VideoDeviceSign'], ); } Map toJson() { final map = Map(); if(videoDeviceId != null) map['VideoDeviceId'] = videoDeviceId; map['VideoDeviceSourceType'] = videoDeviceSourceType.index; map['OutputWidth'] = outputWidth; map['OutputHeight'] = outputHeight; if(videoDeviceSign != null) map['VideoDeviceSign'] = videoDeviceSign; return map; } } class LiveConsultationMember { String? id; String? name; LiveMemberEnum memberType; String? headImageToken; bool isOnline; bool mute; bool videoOpend; bool isInitiator; bool isBusy; LiveConsultationMemberStatus status; String? loginServerUrl; LoginSource loginSource; LiveData? liveData; bool mergedChannel; int mergedVideoOutputWidth; int mergedVideoOutputHeight; List? videoDeviceInfos; LiveConsultationMember({ this.id, this.name, this.memberType = LiveMemberEnum.User, this.headImageToken, this.isOnline = false, this.mute = false, this.videoOpend = false, this.isInitiator = false, this.isBusy = false, this.status = LiveConsultationMemberStatus.Default, this.loginServerUrl, this.loginSource = LoginSource.PC, this.liveData, this.mergedChannel = false, this.mergedVideoOutputWidth = 0, this.mergedVideoOutputHeight = 0, this.videoDeviceInfos, }); factory LiveConsultationMember.fromJson(Map map) { return LiveConsultationMember( id: map['Id'], name: map['Name'], memberType: LiveMemberEnum.values.firstWhere((e) => e.index == map['MemberType']), headImageToken: map['HeadImageToken'], isOnline: map['IsOnline'], mute: map['Mute'], videoOpend: map['VideoOpend'], isInitiator: map['IsInitiator'], isBusy: map['IsBusy'], status: LiveConsultationMemberStatus.values.firstWhere((e) => e.index == map['Status']), loginServerUrl: map['LoginServerUrl'], loginSource: LoginSource.values.firstWhere((e) => e.index == map['LoginSource']), liveData: map['LiveData'] != null ? LiveData.fromJson(map['LiveData']) : null, mergedChannel: map['MergedChannel'], mergedVideoOutputWidth: map['MergedVideoOutputWidth'], mergedVideoOutputHeight: map['MergedVideoOutputHeight'], videoDeviceInfos: map['VideoDeviceInfos'] != null ? (map['VideoDeviceInfos'] as List).map((e)=>VideoDeviceOutputInfo.fromJson(e as Map)).toList() : null, ); } Map toJson() { final map = Map(); if(id != null) map['Id'] = id; if(name != null) map['Name'] = name; map['MemberType'] = memberType.index; if(headImageToken != null) map['HeadImageToken'] = headImageToken; map['IsOnline'] = isOnline; map['Mute'] = mute; map['VideoOpend'] = videoOpend; map['IsInitiator'] = isInitiator; map['IsBusy'] = isBusy; map['Status'] = status.index; if(loginServerUrl != null) map['LoginServerUrl'] = loginServerUrl; map['LoginSource'] = loginSource.index; if(liveData != null) map['LiveData'] = liveData; map['MergedChannel'] = mergedChannel; map['MergedVideoOutputWidth'] = mergedVideoOutputWidth; map['MergedVideoOutputHeight'] = mergedVideoOutputHeight; if(videoDeviceInfos != null) map['VideoDeviceInfos'] = videoDeviceInfos; return map; } } class InviteLiveConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; int roomNo; LiveConsultationMember? initiator; InviteLiveConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.roomNo = 0, this.initiator, }); factory InviteLiveConsultationNotification.fromJson(Map map) { return InviteLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], roomNo: map['RoomNo'], initiator: map['Initiator'] != null ? LiveConsultationMember.fromJson(map['Initiator']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; map['RoomNo'] = roomNo; if(initiator != null) map['Initiator'] = initiator; return map; } } class InviteInLiveConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; int roomNo; LiveConsultationMember? operator; List? memberLiveDatas; InviteInLiveConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.roomNo = 0, this.operator, this.memberLiveDatas, }); factory InviteInLiveConsultationNotification.fromJson(Map map) { return InviteInLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], roomNo: map['RoomNo'], operator: map['Operator'] != null ? LiveConsultationMember.fromJson(map['Operator']) : null, memberLiveDatas: map['MemberLiveDatas'] != null ? (map['MemberLiveDatas'] as List).map((e)=>LiveConsultationMember.fromJson(e as Map)).toList() : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; map['RoomNo'] = roomNo; if(operator != null) map['Operator'] = operator; if(memberLiveDatas != null) map['MemberLiveDatas'] = memberLiveDatas; return map; } } class JoinInLiveConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; LiveConsultationJoinerInfo? joiner; JoinInLiveConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.joiner, }); factory JoinInLiveConsultationNotification.fromJson(Map map) { return JoinInLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], joiner: map['Joiner'] != null ? LiveConsultationJoinerInfo.fromJson(map['Joiner']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(joiner != null) map['Joiner'] = joiner; return map; } } class LiveConsultationRejecterInfo extends LiveConsultationMemberInfo{ LiveConsultationRejecterInfo({ String? id, String? name, String? headImageUrl, }) : super( id: id, name: name, headImageUrl: headImageUrl, ); factory LiveConsultationRejecterInfo.fromJson(Map map) { return LiveConsultationRejecterInfo( id: map['Id'], name: map['Name'], headImageUrl: map['HeadImageUrl'], ); } Map toJson() { final map = super.toJson(); return map; } } class RejectInviteLiveConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; LiveConsultationRejecterInfo? rejecter; RejectInviteLiveConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.rejecter, }); factory RejectInviteLiveConsultationNotification.fromJson(Map map) { return RejectInviteLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], rejecter: map['Rejecter'] != null ? LiveConsultationRejecterInfo.fromJson(map['Rejecter']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(rejecter != null) map['Rejecter'] = rejecter; return map; } } class InviteLiveConsultationToDeviceNotification { NotificationTypeEnum notificationType; String? consultationCode; int roomNo; String? deviceCode; int appId; String? userSign; bool mergedChannel; int mergedVideoOutputWidth; int mergedVideoOutputHeight; List? videoDeviceOutputInfo; InviteLiveConsultationToDeviceNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.roomNo = 0, this.deviceCode, this.appId = 0, this.userSign, this.mergedChannel = false, this.mergedVideoOutputWidth = 0, this.mergedVideoOutputHeight = 0, this.videoDeviceOutputInfo, }); factory InviteLiveConsultationToDeviceNotification.fromJson(Map map) { return InviteLiveConsultationToDeviceNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], roomNo: map['RoomNo'], deviceCode: map['DeviceCode'], appId: map['AppId'], userSign: map['UserSign'], mergedChannel: map['MergedChannel'], mergedVideoOutputWidth: map['MergedVideoOutputWidth'], mergedVideoOutputHeight: map['MergedVideoOutputHeight'], videoDeviceOutputInfo: map['VideoDeviceOutputInfo'] != null ? (map['VideoDeviceOutputInfo'] as List).map((e)=>VideoDeviceOutputInfo.fromJson(e as Map)).toList() : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; map['RoomNo'] = roomNo; if(deviceCode != null) map['DeviceCode'] = deviceCode; map['AppId'] = appId; if(userSign != null) map['UserSign'] = userSign; map['MergedChannel'] = mergedChannel; map['MergedVideoOutputWidth'] = mergedVideoOutputWidth; map['MergedVideoOutputHeight'] = mergedVideoOutputHeight; if(videoDeviceOutputInfo != null) map['VideoDeviceOutputInfo'] = videoDeviceOutputInfo; return map; } } class JoinLiveConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; LiveConsultationJoinerInfo? joiner; JoinLiveConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.joiner, }); factory JoinLiveConsultationNotification.fromJson(Map map) { return JoinLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], joiner: map['Joiner'] != null ? LiveConsultationJoinerInfo.fromJson(map['Joiner']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(joiner != null) map['Joiner'] = joiner; return map; } } class LeaveLiveConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; LiveConsultationLeaverInfo? leaverInfo; LeaveLiveConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.leaverInfo, }); factory LeaveLiveConsultationNotification.fromJson(Map map) { return LeaveLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], leaverInfo: map['LeaverInfo'] != null ? LiveConsultationLeaverInfo.fromJson(map['LeaverInfo']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(leaverInfo != null) map['LeaverInfo'] = leaverInfo; return map; } } class LiveConsultationMuterInfo extends LiveConsultationMemberInfo{ LiveConsultationMuterInfo({ String? id, String? name, String? headImageUrl, }) : super( id: id, name: name, headImageUrl: headImageUrl, ); factory LiveConsultationMuterInfo.fromJson(Map map) { return LiveConsultationMuterInfo( id: map['Id'], name: map['Name'], headImageUrl: map['HeadImageUrl'], ); } Map toJson() { final map = super.toJson(); return map; } } class MuteLiveConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; bool mute; LiveConsultationMuterInfo? muterInfo; MuteLiveConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.mute = false, this.muterInfo, }); factory MuteLiveConsultationNotification.fromJson(Map map) { return MuteLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], mute: map['Mute'], muterInfo: map['MuterInfo'] != null ? LiveConsultationMuterInfo.fromJson(map['MuterInfo']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; map['Mute'] = mute; if(muterInfo != null) map['MuterInfo'] = muterInfo; return map; } } class LiveConsultationNetworkErrMemberInfo extends LiveConsultationMemberInfo{ LiveConsultationNetworkErrMemberInfo({ String? id, String? name, String? headImageUrl, }) : super( id: id, name: name, headImageUrl: headImageUrl, ); factory LiveConsultationNetworkErrMemberInfo.fromJson(Map map) { return LiveConsultationNetworkErrMemberInfo( id: map['Id'], name: map['Name'], headImageUrl: map['HeadImageUrl'], ); } Map toJson() { final map = super.toJson(); return map; } } class NetworkErrConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; LiveConsultationNetworkErrMemberInfo? networkErrMemberInfo; NetworkErrConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.networkErrMemberInfo, }); factory NetworkErrConsultationNotification.fromJson(Map map) { return NetworkErrConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], networkErrMemberInfo: map['NetworkErrMemberInfo'] != null ? LiveConsultationNetworkErrMemberInfo.fromJson(map['NetworkErrMemberInfo']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(networkErrMemberInfo != null) map['NetworkErrMemberInfo'] = networkErrMemberInfo; return map; } } class RejectLiveConsultationNotification { NotificationTypeEnum notificationType; String? consultationCode; LiveConsultationRejecterInfo? rejecter; RejectLiveConsultationNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.rejecter, }); factory RejectLiveConsultationNotification.fromJson(Map map) { return RejectLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], rejecter: map['Rejecter'] != null ? LiveConsultationRejecterInfo.fromJson(map['Rejecter']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(rejecter != null) map['Rejecter'] = rejecter; return map; } } class LiveConsultationSwitcherInfo extends LiveConsultationMemberInfo{ LiveConsultationSwitcherInfo({ String? id, String? name, String? headImageUrl, }) : super( id: id, name: name, headImageUrl: headImageUrl, ); factory LiveConsultationSwitcherInfo.fromJson(Map map) { return LiveConsultationSwitcherInfo( id: map['Id'], name: map['Name'], headImageUrl: map['HeadImageUrl'], ); } Map toJson() { final map = super.toJson(); return map; } } class SwitchLiveConsultationVideoNotification { NotificationTypeEnum notificationType; String? consultationCode; bool opened; LiveConsultationSwitcherInfo? switcherInfo; SwitchLiveConsultationVideoNotification({ this.notificationType = NotificationTypeEnum.ChatMsgNotification, this.consultationCode, this.opened = false, this.switcherInfo, }); factory SwitchLiveConsultationVideoNotification.fromJson(Map map) { return SwitchLiveConsultationVideoNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], opened: map['Opened'], switcherInfo: map['SwitcherInfo'] != null ? LiveConsultationSwitcherInfo.fromJson(map['SwitcherInfo']) : null, ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(consultationCode != null) map['ConsultationCode'] = consultationCode; map['Opened'] = opened; if(switcherInfo != null) map['SwitcherInfo'] = switcherInfo; return map; } }