import 'package:fis_jsonrpc/utils.dart'; enum NotificationTypeEnum { Unknown, 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, AnnouncementPublishNotification, } class NotificationDTO { NotificationTypeEnum notificationType; String? code; bool isResponse; NotificationDTO({ this.notificationType = NotificationTypeEnum.Unknown, this.code, this.isResponse = false, }); factory NotificationDTO.fromJson(Map map) { return NotificationDTO( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = Map(); map['NotificationType'] = notificationType.index; if(code != null) map['Code'] = code; map['IsResponse'] = isResponse; return map; } } enum AnnouncementTypeEnum { placeHolder_0, Broadcast, Maintenance, } class AnnouncementNotification extends NotificationDTO{ AnnouncementTypeEnum announcementType; AnnouncementNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.announcementType = AnnouncementTypeEnum.Broadcast, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); factory AnnouncementNotification.fromJson(Map map) { return AnnouncementNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), announcementType: AnnouncementTypeEnum.values.firstWhere((e) => e.index == map['AnnouncementType']), code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); map['AnnouncementType'] = announcementType.index; return map; } } enum ChatCmdEnum { Txt, Image, MP4, Voice, Cases, ShareLive, VideoCall, VoiceCall, } class ChatMsgNotification extends NotificationDTO{ String? userCode; ChatCmdEnum chatCmd; DateTime? sendTime; String? message; ChatMsgNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.userCode, this.chatCmd = ChatCmdEnum.Txt, this.sendTime, this.message, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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'], code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ ConnectionNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); factory ConnectionNotification.fromJson(Map map) { return ConnectionNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); return map; } } class DisconnectNotification extends NotificationDTO{ DisconnectNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); factory DisconnectNotification.fromJson(Map map) { return DisconnectNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); return map; } } class ExamRecordsFinishedNotification extends NotificationDTO{ List? codes; ExamRecordsFinishedNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.codes, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); if(codes != null) map['Codes'] = codes; return map; } } class PasswordExpiredWarningNotification extends NotificationDTO{ double surplusTime; PasswordExpiredWarningNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.surplusTime = 0, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); factory PasswordExpiredWarningNotification.fromJson(Map map) { return PasswordExpiredWarningNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), surplusTime: double.parse(map['SurplusTime'].toString()), code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); map['SurplusTime'] = surplusTime; return map; } } class TokenReplacedNotification extends NotificationDTO{ String? userCode; TokenReplacedNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.userCode, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); factory TokenReplacedNotification.fromJson(Map map) { return TokenReplacedNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), userCode: map['UserCode'], code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); if(userCode != null) map['UserCode'] = userCode; return map; } } class ApplyConsultationNotification extends NotificationDTO{ String? consultationCode; String? operatorName; String? patientName; DateTime? applicationTime; String? applyOrganizationName; DateTime? consultationTime; ApplyConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.operatorName, this.patientName, this.applicationTime, this.applyOrganizationName, this.consultationTime, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; String? operatorName; String? patientName; DateTime? consultationTime; DateTime? consultationTimeEnd; ApprovalApplyConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.operatorName, this.patientName, this.consultationTime, this.consultationTimeEnd, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; int countdownTime; String? patientName; DateTime? consultationTime; DateTime? consultationTimeEnd; String? expertName; ConsultationRemindNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.countdownTime = 0, this.patientName, this.consultationTime, this.consultationTimeEnd, this.expertName, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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'], code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; String? operatorName; String? patientName; DateTime? consultationTime; DateTime? consultationTimeEnd; InviteeApproveApplyConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.operatorName, this.patientName, this.consultationTime, this.consultationTimeEnd, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; String? operatorName; String? patientName; DateTime? consultationTime; DateTime? consultationTimeEnd; InviteeConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.operatorName, this.patientName, this.consultationTime, this.consultationTimeEnd, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; String? operatorName; String? patientName; DateTime? consultationTime; DateTime? consultationTimeEnd; String? rejectReason; InviteeRejectApplyConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.operatorName, this.patientName, this.consultationTime, this.consultationTimeEnd, this.rejectReason, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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'], code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; String? patientName; String? operatorName; String? rejectReason; RejectApplyConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.patientName, this.operatorName, this.rejectReason, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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'], code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; LiveConsultatioAccepterInfo? accepter; AcceptLiveConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.accepter, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(accepter != null) map['Accepter'] = accepter; return map; } } class CancelInvitingInLiveConsultationNotification extends NotificationDTO{ String? consultationCode; CancelInvitingInLiveConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); factory CancelInvitingInLiveConsultationNotification.fromJson(Map map) { return CancelInvitingInLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); if(consultationCode != null) map['ConsultationCode'] = consultationCode; return map; } } class CancelLiveConsultationNotification extends NotificationDTO{ String? consultationCode; String? initiatorCode; CancelLiveConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.initiatorCode, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); factory CancelLiveConsultationNotification.fromJson(Map map) { return CancelLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], initiatorCode: map['InitiatorCode'], code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(initiatorCode != null) map['InitiatorCode'] = initiatorCode; return map; } } class CloseLiveConsultationNotification extends NotificationDTO{ String? consultationCode; String? initiatorCode; CloseLiveConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.initiatorCode, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); factory CloseLiveConsultationNotification.fromJson(Map map) { return CloseLiveConsultationNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], initiatorCode: map['InitiatorCode'], code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(initiatorCode != null) map['InitiatorCode'] = initiatorCode; return map; } } class CancelLiveConsultationToDeviceNotification extends NotificationDTO{ String? consultationCode; String? initiatorCode; CancelLiveConsultationToDeviceNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.initiatorCode, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); factory CancelLiveConsultationToDeviceNotification.fromJson(Map map) { return CancelLiveConsultationToDeviceNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], initiatorCode: map['InitiatorCode'], code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(initiatorCode != null) map['InitiatorCode'] = initiatorCode; return map; } } class CloseLiveConsultationToDeviceNotification extends NotificationDTO{ String? consultationCode; String? initiatorCode; CloseLiveConsultationToDeviceNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.initiatorCode, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); factory CloseLiveConsultationToDeviceNotification.fromJson(Map map) { return CloseLiveConsultationToDeviceNotification( notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']), consultationCode: map['ConsultationCode'], initiatorCode: map['InitiatorCode'], code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; LiveConsultationJoinerInfo? joiner; HeartRateJoinConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.joiner, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; LiveConsultationLeaverInfo? leaverInfo; HeartRateLeaveConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.leaverInfo, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; int roomNo; LiveConsultationMember? initiator; InviteLiveConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.roomNo = 0, this.initiator, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); if(consultationCode != null) map['ConsultationCode'] = consultationCode; map['RoomNo'] = roomNo; if(initiator != null) map['Initiator'] = initiator; return map; } } class InviteInLiveConsultationNotification extends NotificationDTO{ String? consultationCode; int roomNo; LiveConsultationMember? operator; List? memberLiveDatas; InviteInLiveConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.roomNo = 0, this.operator, this.memberLiveDatas, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; LiveConsultationJoinerInfo? joiner; JoinInLiveConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.joiner, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; LiveConsultationRejecterInfo? rejecter; RejectInviteLiveConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.rejecter, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(rejecter != null) map['Rejecter'] = rejecter; return map; } } class InviteLiveConsultationToDeviceNotification extends NotificationDTO{ String? consultationCode; int roomNo; String? deviceCode; int appId; String? userSign; bool mergedChannel; int mergedVideoOutputWidth; int mergedVideoOutputHeight; List? videoDeviceOutputInfo; InviteLiveConsultationToDeviceNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.roomNo = 0, this.deviceCode, this.appId = 0, this.userSign, this.mergedChannel = false, this.mergedVideoOutputWidth = 0, this.mergedVideoOutputHeight = 0, this.videoDeviceOutputInfo, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; LiveConsultationJoinerInfo? joiner; JoinLiveConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.joiner, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(joiner != null) map['Joiner'] = joiner; return map; } } class LeaveLiveConsultationNotification extends NotificationDTO{ String? consultationCode; LiveConsultationLeaverInfo? leaverInfo; LeaveLiveConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.leaverInfo, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; bool mute; LiveConsultationMuterInfo? muterInfo; MuteLiveConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.mute = false, this.muterInfo, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; LiveConsultationNetworkErrMemberInfo? networkErrMemberInfo; NetworkErrConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.networkErrMemberInfo, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); if(consultationCode != null) map['ConsultationCode'] = consultationCode; if(networkErrMemberInfo != null) map['NetworkErrMemberInfo'] = networkErrMemberInfo; return map; } } class RejectLiveConsultationNotification extends NotificationDTO{ String? consultationCode; LiveConsultationRejecterInfo? rejecter; RejectLiveConsultationNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.rejecter, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); 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 extends NotificationDTO{ String? consultationCode; bool opened; LiveConsultationSwitcherInfo? switcherInfo; SwitchLiveConsultationVideoNotification({ NotificationTypeEnum notificationType = NotificationTypeEnum.Unknown, this.consultationCode, this.opened = false, this.switcherInfo, String? code, bool isResponse = false, }) : super( notificationType: notificationType, code: code, isResponse: isResponse, ); 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, code: map['Code'], isResponse: map['IsResponse'], ); } Map toJson() { final map = super.toJson(); if(consultationCode != null) map['ConsultationCode'] = consultationCode; map['Opened'] = opened; if(switcherInfo != null) map['SwitcherInfo'] = switcherInfo; return map; } }