notification.m.dart 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593
  1. import 'package:fis_jsonrpc/utils.dart';
  2. enum NotificationTypeEnum {
  3. placeHolder_0,
  4. ChatMsgNotification,
  5. TokenReplacedNotification,
  6. DisconnectNotification,
  7. ConnectionNotification,
  8. ExamRecordsFinishedNotification,
  9. RejectApplyConsultationNotification,
  10. CancelInvitingInLiveConsultationNotification,
  11. InviteInLiveConsultationNotification,
  12. ConsultationRemindNotification,
  13. PasswordExpiredWarningNotification,
  14. InviteLiveConsultationNotification,
  15. AcceptLiveConsultationNotification,
  16. RejectLiveConsultationNotification,
  17. InviteLiveConsultationToDeviceNotification,
  18. CancelLiveConsultationNotification,
  19. CloseLiveConsultationNotification,
  20. JoinLiveConsultationNotification,
  21. NetworkErrConsultationNotification,
  22. LeaveConsultationNotification,
  23. JoinInLiveConsultationNotification,
  24. RejectInviteLiveConsultationNotification,
  25. ApplyConsultationNotification,
  26. ApprovalApplyConsultationNotification,
  27. InviteeConsultationNotification,
  28. InviteeApproveApplyConsultationNotification,
  29. InviteeRejectApplyConsultationNotification,
  30. MuteLiveConsultationNotification,
  31. SwitchLiveConsultationVideoNotification,
  32. HeartRateJoinConsultationNotification,
  33. HeartRateLeaveConsultationNotification,
  34. CloseLiveConsultationToDeviceNotification,
  35. CancelLiveConsultationToDeviceNotification,
  36. }
  37. enum ChatCmdEnum {
  38. Txt,
  39. Image,
  40. MP4,
  41. Voice,
  42. Cases,
  43. ShareLive,
  44. VideoCall,
  45. VoiceCall,
  46. }
  47. class ChatMsgNotification {
  48. NotificationTypeEnum notificationType;
  49. String? userCode;
  50. ChatCmdEnum chatCmd;
  51. DateTime? sendTime;
  52. String? message;
  53. ChatMsgNotification({
  54. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  55. this.userCode,
  56. this.chatCmd = ChatCmdEnum.Txt,
  57. this.sendTime,
  58. this.message,
  59. });
  60. factory ChatMsgNotification.fromJson(Map<String, dynamic> map) {
  61. return ChatMsgNotification(
  62. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  63. userCode: map['UserCode'],
  64. chatCmd: ChatCmdEnum.values.firstWhere((e) => e.index == map['ChatCmd']),
  65. sendTime: map['SendTime'] != null ? DateTime.parse(map['SendTime']) : null,
  66. message: map['Message'],
  67. );
  68. }
  69. Map<String, dynamic> toJson() {
  70. final map = Map<String, dynamic>();
  71. map['NotificationType'] = notificationType.index;
  72. if(userCode != null)
  73. map['UserCode'] = userCode;
  74. map['ChatCmd'] = chatCmd.index;
  75. if(sendTime != null)
  76. map['SendTime'] = JsonRpcUtils.dateFormat(sendTime!);
  77. if(message != null)
  78. map['Message'] = message;
  79. return map;
  80. }
  81. }
  82. class ConnectionNotification {
  83. NotificationTypeEnum notificationType;
  84. ConnectionNotification({
  85. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  86. });
  87. factory ConnectionNotification.fromJson(Map<String, dynamic> map) {
  88. return ConnectionNotification(
  89. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  90. );
  91. }
  92. Map<String, dynamic> toJson() {
  93. final map = Map<String, dynamic>();
  94. map['NotificationType'] = notificationType.index;
  95. return map;
  96. }
  97. }
  98. class DisconnectNotification {
  99. NotificationTypeEnum notificationType;
  100. DisconnectNotification({
  101. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  102. });
  103. factory DisconnectNotification.fromJson(Map<String, dynamic> map) {
  104. return DisconnectNotification(
  105. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  106. );
  107. }
  108. Map<String, dynamic> toJson() {
  109. final map = Map<String, dynamic>();
  110. map['NotificationType'] = notificationType.index;
  111. return map;
  112. }
  113. }
  114. class ExamRecordsFinishedNotification {
  115. NotificationTypeEnum notificationType;
  116. List<String >? codes;
  117. ExamRecordsFinishedNotification({
  118. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  119. this.codes,
  120. });
  121. factory ExamRecordsFinishedNotification.fromJson(Map<String, dynamic> map) {
  122. return ExamRecordsFinishedNotification(
  123. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  124. codes: map['Codes'] != null ? map['Codes'].cast<String>().toList() : null,
  125. );
  126. }
  127. Map<String, dynamic> toJson() {
  128. final map = Map<String, dynamic>();
  129. map['NotificationType'] = notificationType.index;
  130. if(codes != null)
  131. map['Codes'] = codes;
  132. return map;
  133. }
  134. }
  135. class PasswordExpiredWarningNotification {
  136. NotificationTypeEnum notificationType;
  137. double surplusTime;
  138. PasswordExpiredWarningNotification({
  139. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  140. this.surplusTime = 0,
  141. });
  142. factory PasswordExpiredWarningNotification.fromJson(Map<String, dynamic> map) {
  143. return PasswordExpiredWarningNotification(
  144. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  145. surplusTime: double.parse(map['SurplusTime'].toString()),
  146. );
  147. }
  148. Map<String, dynamic> toJson() {
  149. final map = Map<String, dynamic>();
  150. map['NotificationType'] = notificationType.index;
  151. map['SurplusTime'] = surplusTime;
  152. return map;
  153. }
  154. }
  155. class TokenReplacedNotification {
  156. NotificationTypeEnum notificationType;
  157. String? userCode;
  158. TokenReplacedNotification({
  159. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  160. this.userCode,
  161. });
  162. factory TokenReplacedNotification.fromJson(Map<String, dynamic> map) {
  163. return TokenReplacedNotification(
  164. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  165. userCode: map['UserCode'],
  166. );
  167. }
  168. Map<String, dynamic> toJson() {
  169. final map = Map<String, dynamic>();
  170. map['NotificationType'] = notificationType.index;
  171. if(userCode != null)
  172. map['UserCode'] = userCode;
  173. return map;
  174. }
  175. }
  176. class ApplyConsultationNotification {
  177. NotificationTypeEnum notificationType;
  178. String? consultationCode;
  179. String? operatorName;
  180. String? patientName;
  181. DateTime? applicationTime;
  182. String? applyOrganizationName;
  183. DateTime? consultationTime;
  184. ApplyConsultationNotification({
  185. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  186. this.consultationCode,
  187. this.operatorName,
  188. this.patientName,
  189. this.applicationTime,
  190. this.applyOrganizationName,
  191. this.consultationTime,
  192. });
  193. factory ApplyConsultationNotification.fromJson(Map<String, dynamic> map) {
  194. return ApplyConsultationNotification(
  195. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  196. consultationCode: map['ConsultationCode'],
  197. operatorName: map['OperatorName'],
  198. patientName: map['PatientName'],
  199. applicationTime: map['ApplicationTime'] != null ? DateTime.parse(map['ApplicationTime']) : null,
  200. applyOrganizationName: map['ApplyOrganizationName'],
  201. consultationTime: map['ConsultationTime'] != null ? DateTime.parse(map['ConsultationTime']) : null,
  202. );
  203. }
  204. Map<String, dynamic> toJson() {
  205. final map = Map<String, dynamic>();
  206. map['NotificationType'] = notificationType.index;
  207. if(consultationCode != null)
  208. map['ConsultationCode'] = consultationCode;
  209. if(operatorName != null)
  210. map['OperatorName'] = operatorName;
  211. if(patientName != null)
  212. map['PatientName'] = patientName;
  213. if(applicationTime != null)
  214. map['ApplicationTime'] = JsonRpcUtils.dateFormat(applicationTime!);
  215. if(applyOrganizationName != null)
  216. map['ApplyOrganizationName'] = applyOrganizationName;
  217. if(consultationTime != null)
  218. map['ConsultationTime'] = JsonRpcUtils.dateFormat(consultationTime!);
  219. return map;
  220. }
  221. }
  222. class ApprovalApplyConsultationNotification {
  223. NotificationTypeEnum notificationType;
  224. String? consultationCode;
  225. String? operatorName;
  226. String? patientName;
  227. DateTime? consultationTime;
  228. DateTime? consultationTimeEnd;
  229. ApprovalApplyConsultationNotification({
  230. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  231. this.consultationCode,
  232. this.operatorName,
  233. this.patientName,
  234. this.consultationTime,
  235. this.consultationTimeEnd,
  236. });
  237. factory ApprovalApplyConsultationNotification.fromJson(Map<String, dynamic> map) {
  238. return ApprovalApplyConsultationNotification(
  239. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  240. consultationCode: map['ConsultationCode'],
  241. operatorName: map['OperatorName'],
  242. patientName: map['PatientName'],
  243. consultationTime: map['ConsultationTime'] != null ? DateTime.parse(map['ConsultationTime']) : null,
  244. consultationTimeEnd: map['ConsultationTimeEnd'] != null ? DateTime.parse(map['ConsultationTimeEnd']) : null,
  245. );
  246. }
  247. Map<String, dynamic> toJson() {
  248. final map = Map<String, dynamic>();
  249. map['NotificationType'] = notificationType.index;
  250. if(consultationCode != null)
  251. map['ConsultationCode'] = consultationCode;
  252. if(operatorName != null)
  253. map['OperatorName'] = operatorName;
  254. if(patientName != null)
  255. map['PatientName'] = patientName;
  256. if(consultationTime != null)
  257. map['ConsultationTime'] = JsonRpcUtils.dateFormat(consultationTime!);
  258. if(consultationTimeEnd != null)
  259. map['ConsultationTimeEnd'] = JsonRpcUtils.dateFormat(consultationTimeEnd!);
  260. return map;
  261. }
  262. }
  263. class ConsultationRemindNotification {
  264. NotificationTypeEnum notificationType;
  265. String? consultationCode;
  266. int countdownTime;
  267. String? patientName;
  268. DateTime? consultationTime;
  269. DateTime? consultationTimeEnd;
  270. String? expertName;
  271. ConsultationRemindNotification({
  272. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  273. this.consultationCode,
  274. this.countdownTime = 0,
  275. this.patientName,
  276. this.consultationTime,
  277. this.consultationTimeEnd,
  278. this.expertName,
  279. });
  280. factory ConsultationRemindNotification.fromJson(Map<String, dynamic> map) {
  281. return ConsultationRemindNotification(
  282. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  283. consultationCode: map['ConsultationCode'],
  284. countdownTime: map['CountdownTime'],
  285. patientName: map['PatientName'],
  286. consultationTime: map['ConsultationTime'] != null ? DateTime.parse(map['ConsultationTime']) : null,
  287. consultationTimeEnd: map['ConsultationTimeEnd'] != null ? DateTime.parse(map['ConsultationTimeEnd']) : null,
  288. expertName: map['ExpertName'],
  289. );
  290. }
  291. Map<String, dynamic> toJson() {
  292. final map = Map<String, dynamic>();
  293. map['NotificationType'] = notificationType.index;
  294. if(consultationCode != null)
  295. map['ConsultationCode'] = consultationCode;
  296. map['CountdownTime'] = countdownTime;
  297. if(patientName != null)
  298. map['PatientName'] = patientName;
  299. if(consultationTime != null)
  300. map['ConsultationTime'] = JsonRpcUtils.dateFormat(consultationTime!);
  301. if(consultationTimeEnd != null)
  302. map['ConsultationTimeEnd'] = JsonRpcUtils.dateFormat(consultationTimeEnd!);
  303. if(expertName != null)
  304. map['ExpertName'] = expertName;
  305. return map;
  306. }
  307. }
  308. class InviteeApproveApplyConsultationNotification {
  309. NotificationTypeEnum notificationType;
  310. String? consultationCode;
  311. String? operatorName;
  312. String? patientName;
  313. DateTime? consultationTime;
  314. DateTime? consultationTimeEnd;
  315. InviteeApproveApplyConsultationNotification({
  316. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  317. this.consultationCode,
  318. this.operatorName,
  319. this.patientName,
  320. this.consultationTime,
  321. this.consultationTimeEnd,
  322. });
  323. factory InviteeApproveApplyConsultationNotification.fromJson(Map<String, dynamic> map) {
  324. return InviteeApproveApplyConsultationNotification(
  325. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  326. consultationCode: map['ConsultationCode'],
  327. operatorName: map['OperatorName'],
  328. patientName: map['PatientName'],
  329. consultationTime: map['ConsultationTime'] != null ? DateTime.parse(map['ConsultationTime']) : null,
  330. consultationTimeEnd: map['ConsultationTimeEnd'] != null ? DateTime.parse(map['ConsultationTimeEnd']) : null,
  331. );
  332. }
  333. Map<String, dynamic> toJson() {
  334. final map = Map<String, dynamic>();
  335. map['NotificationType'] = notificationType.index;
  336. if(consultationCode != null)
  337. map['ConsultationCode'] = consultationCode;
  338. if(operatorName != null)
  339. map['OperatorName'] = operatorName;
  340. if(patientName != null)
  341. map['PatientName'] = patientName;
  342. if(consultationTime != null)
  343. map['ConsultationTime'] = JsonRpcUtils.dateFormat(consultationTime!);
  344. if(consultationTimeEnd != null)
  345. map['ConsultationTimeEnd'] = JsonRpcUtils.dateFormat(consultationTimeEnd!);
  346. return map;
  347. }
  348. }
  349. class InviteeConsultationNotification {
  350. NotificationTypeEnum notificationType;
  351. String? consultationCode;
  352. String? operatorName;
  353. String? patientName;
  354. DateTime? consultationTime;
  355. DateTime? consultationTimeEnd;
  356. InviteeConsultationNotification({
  357. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  358. this.consultationCode,
  359. this.operatorName,
  360. this.patientName,
  361. this.consultationTime,
  362. this.consultationTimeEnd,
  363. });
  364. factory InviteeConsultationNotification.fromJson(Map<String, dynamic> map) {
  365. return InviteeConsultationNotification(
  366. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  367. consultationCode: map['ConsultationCode'],
  368. operatorName: map['OperatorName'],
  369. patientName: map['PatientName'],
  370. consultationTime: map['ConsultationTime'] != null ? DateTime.parse(map['ConsultationTime']) : null,
  371. consultationTimeEnd: map['ConsultationTimeEnd'] != null ? DateTime.parse(map['ConsultationTimeEnd']) : null,
  372. );
  373. }
  374. Map<String, dynamic> toJson() {
  375. final map = Map<String, dynamic>();
  376. map['NotificationType'] = notificationType.index;
  377. if(consultationCode != null)
  378. map['ConsultationCode'] = consultationCode;
  379. if(operatorName != null)
  380. map['OperatorName'] = operatorName;
  381. if(patientName != null)
  382. map['PatientName'] = patientName;
  383. if(consultationTime != null)
  384. map['ConsultationTime'] = JsonRpcUtils.dateFormat(consultationTime!);
  385. if(consultationTimeEnd != null)
  386. map['ConsultationTimeEnd'] = JsonRpcUtils.dateFormat(consultationTimeEnd!);
  387. return map;
  388. }
  389. }
  390. class InviteeRejectApplyConsultationNotification {
  391. NotificationTypeEnum notificationType;
  392. String? consultationCode;
  393. String? operatorName;
  394. String? patientName;
  395. DateTime? consultationTime;
  396. DateTime? consultationTimeEnd;
  397. String? rejectReason;
  398. InviteeRejectApplyConsultationNotification({
  399. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  400. this.consultationCode,
  401. this.operatorName,
  402. this.patientName,
  403. this.consultationTime,
  404. this.consultationTimeEnd,
  405. this.rejectReason,
  406. });
  407. factory InviteeRejectApplyConsultationNotification.fromJson(Map<String, dynamic> map) {
  408. return InviteeRejectApplyConsultationNotification(
  409. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  410. consultationCode: map['ConsultationCode'],
  411. operatorName: map['OperatorName'],
  412. patientName: map['PatientName'],
  413. consultationTime: map['ConsultationTime'] != null ? DateTime.parse(map['ConsultationTime']) : null,
  414. consultationTimeEnd: map['ConsultationTimeEnd'] != null ? DateTime.parse(map['ConsultationTimeEnd']) : null,
  415. rejectReason: map['RejectReason'],
  416. );
  417. }
  418. Map<String, dynamic> toJson() {
  419. final map = Map<String, dynamic>();
  420. map['NotificationType'] = notificationType.index;
  421. if(consultationCode != null)
  422. map['ConsultationCode'] = consultationCode;
  423. if(operatorName != null)
  424. map['OperatorName'] = operatorName;
  425. if(patientName != null)
  426. map['PatientName'] = patientName;
  427. if(consultationTime != null)
  428. map['ConsultationTime'] = JsonRpcUtils.dateFormat(consultationTime!);
  429. if(consultationTimeEnd != null)
  430. map['ConsultationTimeEnd'] = JsonRpcUtils.dateFormat(consultationTimeEnd!);
  431. if(rejectReason != null)
  432. map['RejectReason'] = rejectReason;
  433. return map;
  434. }
  435. }
  436. class RejectApplyConsultationNotification {
  437. NotificationTypeEnum notificationType;
  438. String? consultationCode;
  439. String? patientName;
  440. String? operatorName;
  441. String? rejectReason;
  442. RejectApplyConsultationNotification({
  443. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  444. this.consultationCode,
  445. this.patientName,
  446. this.operatorName,
  447. this.rejectReason,
  448. });
  449. factory RejectApplyConsultationNotification.fromJson(Map<String, dynamic> map) {
  450. return RejectApplyConsultationNotification(
  451. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  452. consultationCode: map['ConsultationCode'],
  453. patientName: map['PatientName'],
  454. operatorName: map['OperatorName'],
  455. rejectReason: map['RejectReason'],
  456. );
  457. }
  458. Map<String, dynamic> toJson() {
  459. final map = Map<String, dynamic>();
  460. map['NotificationType'] = notificationType.index;
  461. if(consultationCode != null)
  462. map['ConsultationCode'] = consultationCode;
  463. if(patientName != null)
  464. map['PatientName'] = patientName;
  465. if(operatorName != null)
  466. map['OperatorName'] = operatorName;
  467. if(rejectReason != null)
  468. map['RejectReason'] = rejectReason;
  469. return map;
  470. }
  471. }
  472. class LiveConsultationMemberInfo {
  473. String? id;
  474. String? name;
  475. String? headImageUrl;
  476. LiveConsultationMemberInfo({
  477. this.id,
  478. this.name,
  479. this.headImageUrl,
  480. });
  481. factory LiveConsultationMemberInfo.fromJson(Map<String, dynamic> map) {
  482. return LiveConsultationMemberInfo(
  483. id: map['Id'],
  484. name: map['Name'],
  485. headImageUrl: map['HeadImageUrl'],
  486. );
  487. }
  488. Map<String, dynamic> toJson() {
  489. final map = Map<String, dynamic>();
  490. if(id != null)
  491. map['Id'] = id;
  492. if(name != null)
  493. map['Name'] = name;
  494. if(headImageUrl != null)
  495. map['HeadImageUrl'] = headImageUrl;
  496. return map;
  497. }
  498. }
  499. enum LoginSource {
  500. PC,
  501. Mobile,
  502. Pad,
  503. Web,
  504. US,
  505. }
  506. class LiveData {
  507. int height;
  508. int width;
  509. String? rtmpPushUrl;
  510. String? rtmpPullUrl;
  511. String? httpPullUrl;
  512. String? hlsPullUrl;
  513. LiveData({
  514. this.height = 0,
  515. this.width = 0,
  516. this.rtmpPushUrl,
  517. this.rtmpPullUrl,
  518. this.httpPullUrl,
  519. this.hlsPullUrl,
  520. });
  521. factory LiveData.fromJson(Map<String, dynamic> map) {
  522. return LiveData(
  523. height: map['Height'],
  524. width: map['Width'],
  525. rtmpPushUrl: map['RtmpPushUrl'],
  526. rtmpPullUrl: map['RtmpPullUrl'],
  527. httpPullUrl: map['HttpPullUrl'],
  528. hlsPullUrl: map['HlsPullUrl'],
  529. );
  530. }
  531. Map<String, dynamic> toJson() {
  532. final map = Map<String, dynamic>();
  533. map['Height'] = height;
  534. map['Width'] = width;
  535. if(rtmpPushUrl != null)
  536. map['RtmpPushUrl'] = rtmpPushUrl;
  537. if(rtmpPullUrl != null)
  538. map['RtmpPullUrl'] = rtmpPullUrl;
  539. if(httpPullUrl != null)
  540. map['HttpPullUrl'] = httpPullUrl;
  541. if(hlsPullUrl != null)
  542. map['HlsPullUrl'] = hlsPullUrl;
  543. return map;
  544. }
  545. }
  546. class LiveConsultatioAccepterInfo extends LiveConsultationMemberInfo{
  547. bool isOnline;
  548. bool mute;
  549. LoginSource loginSource;
  550. LiveData? liveData;
  551. LiveConsultatioAccepterInfo({
  552. this.isOnline = false,
  553. this.mute = false,
  554. this.loginSource = LoginSource.PC,
  555. this.liveData,
  556. String? id,
  557. String? name,
  558. String? headImageUrl,
  559. }) : super(
  560. id: id,
  561. name: name,
  562. headImageUrl: headImageUrl,
  563. );
  564. factory LiveConsultatioAccepterInfo.fromJson(Map<String, dynamic> map) {
  565. return LiveConsultatioAccepterInfo(
  566. isOnline: map['IsOnline'],
  567. mute: map['Mute'],
  568. loginSource: LoginSource.values.firstWhere((e) => e.index == map['LoginSource']),
  569. liveData: map['LiveData'] != null ? LiveData.fromJson(map['LiveData']) : null,
  570. id: map['Id'],
  571. name: map['Name'],
  572. headImageUrl: map['HeadImageUrl'],
  573. );
  574. }
  575. Map<String, dynamic> toJson() {
  576. final map = super.toJson();
  577. map['IsOnline'] = isOnline;
  578. map['Mute'] = mute;
  579. map['LoginSource'] = loginSource.index;
  580. if(liveData != null)
  581. map['LiveData'] = liveData;
  582. return map;
  583. }
  584. }
  585. class AcceptLiveConsultationNotification {
  586. NotificationTypeEnum notificationType;
  587. String? consultationCode;
  588. LiveConsultatioAccepterInfo? accepter;
  589. AcceptLiveConsultationNotification({
  590. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  591. this.consultationCode,
  592. this.accepter,
  593. });
  594. factory AcceptLiveConsultationNotification.fromJson(Map<String, dynamic> map) {
  595. return AcceptLiveConsultationNotification(
  596. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  597. consultationCode: map['ConsultationCode'],
  598. accepter: map['Accepter'] != null ? LiveConsultatioAccepterInfo.fromJson(map['Accepter']) : null,
  599. );
  600. }
  601. Map<String, dynamic> toJson() {
  602. final map = Map<String, dynamic>();
  603. map['NotificationType'] = notificationType.index;
  604. if(consultationCode != null)
  605. map['ConsultationCode'] = consultationCode;
  606. if(accepter != null)
  607. map['Accepter'] = accepter;
  608. return map;
  609. }
  610. }
  611. class CancelInvitingInLiveConsultationNotification {
  612. NotificationTypeEnum notificationType;
  613. String? consultationCode;
  614. CancelInvitingInLiveConsultationNotification({
  615. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  616. this.consultationCode,
  617. });
  618. factory CancelInvitingInLiveConsultationNotification.fromJson(Map<String, dynamic> map) {
  619. return CancelInvitingInLiveConsultationNotification(
  620. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  621. consultationCode: map['ConsultationCode'],
  622. );
  623. }
  624. Map<String, dynamic> toJson() {
  625. final map = Map<String, dynamic>();
  626. map['NotificationType'] = notificationType.index;
  627. if(consultationCode != null)
  628. map['ConsultationCode'] = consultationCode;
  629. return map;
  630. }
  631. }
  632. class CancelLiveConsultationNotification {
  633. NotificationTypeEnum notificationType;
  634. String? consultationCode;
  635. String? initiatorCode;
  636. CancelLiveConsultationNotification({
  637. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  638. this.consultationCode,
  639. this.initiatorCode,
  640. });
  641. factory CancelLiveConsultationNotification.fromJson(Map<String, dynamic> map) {
  642. return CancelLiveConsultationNotification(
  643. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  644. consultationCode: map['ConsultationCode'],
  645. initiatorCode: map['InitiatorCode'],
  646. );
  647. }
  648. Map<String, dynamic> toJson() {
  649. final map = Map<String, dynamic>();
  650. map['NotificationType'] = notificationType.index;
  651. if(consultationCode != null)
  652. map['ConsultationCode'] = consultationCode;
  653. if(initiatorCode != null)
  654. map['InitiatorCode'] = initiatorCode;
  655. return map;
  656. }
  657. }
  658. class CloseLiveConsultationNotification {
  659. NotificationTypeEnum notificationType;
  660. String? consultationCode;
  661. String? initiatorCode;
  662. CloseLiveConsultationNotification({
  663. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  664. this.consultationCode,
  665. this.initiatorCode,
  666. });
  667. factory CloseLiveConsultationNotification.fromJson(Map<String, dynamic> map) {
  668. return CloseLiveConsultationNotification(
  669. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  670. consultationCode: map['ConsultationCode'],
  671. initiatorCode: map['InitiatorCode'],
  672. );
  673. }
  674. Map<String, dynamic> toJson() {
  675. final map = Map<String, dynamic>();
  676. map['NotificationType'] = notificationType.index;
  677. if(consultationCode != null)
  678. map['ConsultationCode'] = consultationCode;
  679. if(initiatorCode != null)
  680. map['InitiatorCode'] = initiatorCode;
  681. return map;
  682. }
  683. }
  684. class CancelLiveConsultationToDeviceNotification {
  685. NotificationTypeEnum notificationType;
  686. String? consultationCode;
  687. String? initiatorCode;
  688. CancelLiveConsultationToDeviceNotification({
  689. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  690. this.consultationCode,
  691. this.initiatorCode,
  692. });
  693. factory CancelLiveConsultationToDeviceNotification.fromJson(Map<String, dynamic> map) {
  694. return CancelLiveConsultationToDeviceNotification(
  695. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  696. consultationCode: map['ConsultationCode'],
  697. initiatorCode: map['InitiatorCode'],
  698. );
  699. }
  700. Map<String, dynamic> toJson() {
  701. final map = Map<String, dynamic>();
  702. map['NotificationType'] = notificationType.index;
  703. if(consultationCode != null)
  704. map['ConsultationCode'] = consultationCode;
  705. if(initiatorCode != null)
  706. map['InitiatorCode'] = initiatorCode;
  707. return map;
  708. }
  709. }
  710. class CloseLiveConsultationToDeviceNotification {
  711. NotificationTypeEnum notificationType;
  712. String? consultationCode;
  713. String? initiatorCode;
  714. CloseLiveConsultationToDeviceNotification({
  715. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  716. this.consultationCode,
  717. this.initiatorCode,
  718. });
  719. factory CloseLiveConsultationToDeviceNotification.fromJson(Map<String, dynamic> map) {
  720. return CloseLiveConsultationToDeviceNotification(
  721. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  722. consultationCode: map['ConsultationCode'],
  723. initiatorCode: map['InitiatorCode'],
  724. );
  725. }
  726. Map<String, dynamic> toJson() {
  727. final map = Map<String, dynamic>();
  728. map['NotificationType'] = notificationType.index;
  729. if(consultationCode != null)
  730. map['ConsultationCode'] = consultationCode;
  731. if(initiatorCode != null)
  732. map['InitiatorCode'] = initiatorCode;
  733. return map;
  734. }
  735. }
  736. class LiveConsultationJoinerInfo extends LiveConsultationMemberInfo{
  737. bool isOnline;
  738. bool mute;
  739. bool isInitiator;
  740. LoginSource loginSource;
  741. LiveData? liveData;
  742. LiveConsultationJoinerInfo({
  743. this.isOnline = false,
  744. this.mute = false,
  745. this.isInitiator = false,
  746. this.loginSource = LoginSource.PC,
  747. this.liveData,
  748. String? id,
  749. String? name,
  750. String? headImageUrl,
  751. }) : super(
  752. id: id,
  753. name: name,
  754. headImageUrl: headImageUrl,
  755. );
  756. factory LiveConsultationJoinerInfo.fromJson(Map<String, dynamic> map) {
  757. return LiveConsultationJoinerInfo(
  758. isOnline: map['IsOnline'],
  759. mute: map['Mute'],
  760. isInitiator: map['IsInitiator'],
  761. loginSource: LoginSource.values.firstWhere((e) => e.index == map['LoginSource']),
  762. liveData: map['LiveData'] != null ? LiveData.fromJson(map['LiveData']) : null,
  763. id: map['Id'],
  764. name: map['Name'],
  765. headImageUrl: map['HeadImageUrl'],
  766. );
  767. }
  768. Map<String, dynamic> toJson() {
  769. final map = super.toJson();
  770. map['IsOnline'] = isOnline;
  771. map['Mute'] = mute;
  772. map['IsInitiator'] = isInitiator;
  773. map['LoginSource'] = loginSource.index;
  774. if(liveData != null)
  775. map['LiveData'] = liveData;
  776. return map;
  777. }
  778. }
  779. class HeartRateJoinConsultationNotification {
  780. NotificationTypeEnum notificationType;
  781. String? consultationCode;
  782. LiveConsultationJoinerInfo? joiner;
  783. HeartRateJoinConsultationNotification({
  784. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  785. this.consultationCode,
  786. this.joiner,
  787. });
  788. factory HeartRateJoinConsultationNotification.fromJson(Map<String, dynamic> map) {
  789. return HeartRateJoinConsultationNotification(
  790. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  791. consultationCode: map['ConsultationCode'],
  792. joiner: map['Joiner'] != null ? LiveConsultationJoinerInfo.fromJson(map['Joiner']) : null,
  793. );
  794. }
  795. Map<String, dynamic> toJson() {
  796. final map = Map<String, dynamic>();
  797. map['NotificationType'] = notificationType.index;
  798. if(consultationCode != null)
  799. map['ConsultationCode'] = consultationCode;
  800. if(joiner != null)
  801. map['Joiner'] = joiner;
  802. return map;
  803. }
  804. }
  805. class LiveConsultationLeaverInfo extends LiveConsultationMemberInfo{
  806. LiveConsultationLeaverInfo({
  807. String? id,
  808. String? name,
  809. String? headImageUrl,
  810. }) : super(
  811. id: id,
  812. name: name,
  813. headImageUrl: headImageUrl,
  814. );
  815. factory LiveConsultationLeaverInfo.fromJson(Map<String, dynamic> map) {
  816. return LiveConsultationLeaverInfo(
  817. id: map['Id'],
  818. name: map['Name'],
  819. headImageUrl: map['HeadImageUrl'],
  820. );
  821. }
  822. Map<String, dynamic> toJson() {
  823. final map = super.toJson();
  824. return map;
  825. }
  826. }
  827. class HeartRateLeaveConsultationNotification {
  828. NotificationTypeEnum notificationType;
  829. String? consultationCode;
  830. LiveConsultationLeaverInfo? leaverInfo;
  831. HeartRateLeaveConsultationNotification({
  832. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  833. this.consultationCode,
  834. this.leaverInfo,
  835. });
  836. factory HeartRateLeaveConsultationNotification.fromJson(Map<String, dynamic> map) {
  837. return HeartRateLeaveConsultationNotification(
  838. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  839. consultationCode: map['ConsultationCode'],
  840. leaverInfo: map['LeaverInfo'] != null ? LiveConsultationLeaverInfo.fromJson(map['LeaverInfo']) : null,
  841. );
  842. }
  843. Map<String, dynamic> toJson() {
  844. final map = Map<String, dynamic>();
  845. map['NotificationType'] = notificationType.index;
  846. if(consultationCode != null)
  847. map['ConsultationCode'] = consultationCode;
  848. if(leaverInfo != null)
  849. map['LeaverInfo'] = leaverInfo;
  850. return map;
  851. }
  852. }
  853. enum LiveMemberEnum {
  854. placeHolder_0,
  855. User,
  856. Device,
  857. }
  858. enum LiveConsultationMemberStatus {
  859. Default,
  860. Accepted,
  861. Rejected,
  862. Joined,
  863. Left,
  864. }
  865. enum VideoDeviceSourceTypeEnum {
  866. Desktop,
  867. Camera,
  868. }
  869. class VideoDeviceOutputInfo {
  870. String? videoDeviceId;
  871. VideoDeviceSourceTypeEnum videoDeviceSourceType;
  872. int outputWidth;
  873. int outputHeight;
  874. String? videoDeviceSign;
  875. VideoDeviceOutputInfo({
  876. this.videoDeviceId,
  877. this.videoDeviceSourceType = VideoDeviceSourceTypeEnum.Desktop,
  878. this.outputWidth = 0,
  879. this.outputHeight = 0,
  880. this.videoDeviceSign,
  881. });
  882. factory VideoDeviceOutputInfo.fromJson(Map<String, dynamic> map) {
  883. return VideoDeviceOutputInfo(
  884. videoDeviceId: map['VideoDeviceId'],
  885. videoDeviceSourceType: VideoDeviceSourceTypeEnum.values.firstWhere((e) => e.index == map['VideoDeviceSourceType']),
  886. outputWidth: map['OutputWidth'],
  887. outputHeight: map['OutputHeight'],
  888. videoDeviceSign: map['VideoDeviceSign'],
  889. );
  890. }
  891. Map<String, dynamic> toJson() {
  892. final map = Map<String, dynamic>();
  893. if(videoDeviceId != null)
  894. map['VideoDeviceId'] = videoDeviceId;
  895. map['VideoDeviceSourceType'] = videoDeviceSourceType.index;
  896. map['OutputWidth'] = outputWidth;
  897. map['OutputHeight'] = outputHeight;
  898. if(videoDeviceSign != null)
  899. map['VideoDeviceSign'] = videoDeviceSign;
  900. return map;
  901. }
  902. }
  903. class LiveConsultationMember {
  904. String? id;
  905. String? name;
  906. LiveMemberEnum memberType;
  907. String? headImageToken;
  908. bool isOnline;
  909. bool mute;
  910. bool videoOpend;
  911. bool isInitiator;
  912. bool isBusy;
  913. LiveConsultationMemberStatus status;
  914. String? loginServerUrl;
  915. LoginSource loginSource;
  916. LiveData? liveData;
  917. bool mergedChannel;
  918. int mergedVideoOutputWidth;
  919. int mergedVideoOutputHeight;
  920. List<VideoDeviceOutputInfo >? videoDeviceInfos;
  921. LiveConsultationMember({
  922. this.id,
  923. this.name,
  924. this.memberType = LiveMemberEnum.User,
  925. this.headImageToken,
  926. this.isOnline = false,
  927. this.mute = false,
  928. this.videoOpend = false,
  929. this.isInitiator = false,
  930. this.isBusy = false,
  931. this.status = LiveConsultationMemberStatus.Default,
  932. this.loginServerUrl,
  933. this.loginSource = LoginSource.PC,
  934. this.liveData,
  935. this.mergedChannel = false,
  936. this.mergedVideoOutputWidth = 0,
  937. this.mergedVideoOutputHeight = 0,
  938. this.videoDeviceInfos,
  939. });
  940. factory LiveConsultationMember.fromJson(Map<String, dynamic> map) {
  941. return LiveConsultationMember(
  942. id: map['Id'],
  943. name: map['Name'],
  944. memberType: LiveMemberEnum.values.firstWhere((e) => e.index == map['MemberType']),
  945. headImageToken: map['HeadImageToken'],
  946. isOnline: map['IsOnline'],
  947. mute: map['Mute'],
  948. videoOpend: map['VideoOpend'],
  949. isInitiator: map['IsInitiator'],
  950. isBusy: map['IsBusy'],
  951. status: LiveConsultationMemberStatus.values.firstWhere((e) => e.index == map['Status']),
  952. loginServerUrl: map['LoginServerUrl'],
  953. loginSource: LoginSource.values.firstWhere((e) => e.index == map['LoginSource']),
  954. liveData: map['LiveData'] != null ? LiveData.fromJson(map['LiveData']) : null,
  955. mergedChannel: map['MergedChannel'],
  956. mergedVideoOutputWidth: map['MergedVideoOutputWidth'],
  957. mergedVideoOutputHeight: map['MergedVideoOutputHeight'],
  958. videoDeviceInfos: map['VideoDeviceInfos'] != null ? (map['VideoDeviceInfos'] as List).map((e)=>VideoDeviceOutputInfo.fromJson(e as Map<String,dynamic>)).toList() : null,
  959. );
  960. }
  961. Map<String, dynamic> toJson() {
  962. final map = Map<String, dynamic>();
  963. if(id != null)
  964. map['Id'] = id;
  965. if(name != null)
  966. map['Name'] = name;
  967. map['MemberType'] = memberType.index;
  968. if(headImageToken != null)
  969. map['HeadImageToken'] = headImageToken;
  970. map['IsOnline'] = isOnline;
  971. map['Mute'] = mute;
  972. map['VideoOpend'] = videoOpend;
  973. map['IsInitiator'] = isInitiator;
  974. map['IsBusy'] = isBusy;
  975. map['Status'] = status.index;
  976. if(loginServerUrl != null)
  977. map['LoginServerUrl'] = loginServerUrl;
  978. map['LoginSource'] = loginSource.index;
  979. if(liveData != null)
  980. map['LiveData'] = liveData;
  981. map['MergedChannel'] = mergedChannel;
  982. map['MergedVideoOutputWidth'] = mergedVideoOutputWidth;
  983. map['MergedVideoOutputHeight'] = mergedVideoOutputHeight;
  984. if(videoDeviceInfos != null)
  985. map['VideoDeviceInfos'] = videoDeviceInfos;
  986. return map;
  987. }
  988. }
  989. class InviteLiveConsultationNotification {
  990. NotificationTypeEnum notificationType;
  991. String? consultationCode;
  992. int roomNo;
  993. LiveConsultationMember? initiator;
  994. InviteLiveConsultationNotification({
  995. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  996. this.consultationCode,
  997. this.roomNo = 0,
  998. this.initiator,
  999. });
  1000. factory InviteLiveConsultationNotification.fromJson(Map<String, dynamic> map) {
  1001. return InviteLiveConsultationNotification(
  1002. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  1003. consultationCode: map['ConsultationCode'],
  1004. roomNo: map['RoomNo'],
  1005. initiator: map['Initiator'] != null ? LiveConsultationMember.fromJson(map['Initiator']) : null,
  1006. );
  1007. }
  1008. Map<String, dynamic> toJson() {
  1009. final map = Map<String, dynamic>();
  1010. map['NotificationType'] = notificationType.index;
  1011. if(consultationCode != null)
  1012. map['ConsultationCode'] = consultationCode;
  1013. map['RoomNo'] = roomNo;
  1014. if(initiator != null)
  1015. map['Initiator'] = initiator;
  1016. return map;
  1017. }
  1018. }
  1019. class InviteInLiveConsultationNotification {
  1020. NotificationTypeEnum notificationType;
  1021. String? consultationCode;
  1022. int roomNo;
  1023. LiveConsultationMember? operator;
  1024. List<LiveConsultationMember >? memberLiveDatas;
  1025. InviteInLiveConsultationNotification({
  1026. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  1027. this.consultationCode,
  1028. this.roomNo = 0,
  1029. this.operator,
  1030. this.memberLiveDatas,
  1031. });
  1032. factory InviteInLiveConsultationNotification.fromJson(Map<String, dynamic> map) {
  1033. return InviteInLiveConsultationNotification(
  1034. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  1035. consultationCode: map['ConsultationCode'],
  1036. roomNo: map['RoomNo'],
  1037. operator: map['Operator'] != null ? LiveConsultationMember.fromJson(map['Operator']) : null,
  1038. memberLiveDatas: map['MemberLiveDatas'] != null ? (map['MemberLiveDatas'] as List).map((e)=>LiveConsultationMember.fromJson(e as Map<String,dynamic>)).toList() : null,
  1039. );
  1040. }
  1041. Map<String, dynamic> toJson() {
  1042. final map = Map<String, dynamic>();
  1043. map['NotificationType'] = notificationType.index;
  1044. if(consultationCode != null)
  1045. map['ConsultationCode'] = consultationCode;
  1046. map['RoomNo'] = roomNo;
  1047. if(operator != null)
  1048. map['Operator'] = operator;
  1049. if(memberLiveDatas != null)
  1050. map['MemberLiveDatas'] = memberLiveDatas;
  1051. return map;
  1052. }
  1053. }
  1054. class JoinInLiveConsultationNotification {
  1055. NotificationTypeEnum notificationType;
  1056. String? consultationCode;
  1057. LiveConsultationJoinerInfo? joiner;
  1058. JoinInLiveConsultationNotification({
  1059. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  1060. this.consultationCode,
  1061. this.joiner,
  1062. });
  1063. factory JoinInLiveConsultationNotification.fromJson(Map<String, dynamic> map) {
  1064. return JoinInLiveConsultationNotification(
  1065. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  1066. consultationCode: map['ConsultationCode'],
  1067. joiner: map['Joiner'] != null ? LiveConsultationJoinerInfo.fromJson(map['Joiner']) : null,
  1068. );
  1069. }
  1070. Map<String, dynamic> toJson() {
  1071. final map = Map<String, dynamic>();
  1072. map['NotificationType'] = notificationType.index;
  1073. if(consultationCode != null)
  1074. map['ConsultationCode'] = consultationCode;
  1075. if(joiner != null)
  1076. map['Joiner'] = joiner;
  1077. return map;
  1078. }
  1079. }
  1080. class LiveConsultationRejecterInfo extends LiveConsultationMemberInfo{
  1081. LiveConsultationRejecterInfo({
  1082. String? id,
  1083. String? name,
  1084. String? headImageUrl,
  1085. }) : super(
  1086. id: id,
  1087. name: name,
  1088. headImageUrl: headImageUrl,
  1089. );
  1090. factory LiveConsultationRejecterInfo.fromJson(Map<String, dynamic> map) {
  1091. return LiveConsultationRejecterInfo(
  1092. id: map['Id'],
  1093. name: map['Name'],
  1094. headImageUrl: map['HeadImageUrl'],
  1095. );
  1096. }
  1097. Map<String, dynamic> toJson() {
  1098. final map = super.toJson();
  1099. return map;
  1100. }
  1101. }
  1102. class RejectInviteLiveConsultationNotification {
  1103. NotificationTypeEnum notificationType;
  1104. String? consultationCode;
  1105. LiveConsultationRejecterInfo? rejecter;
  1106. RejectInviteLiveConsultationNotification({
  1107. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  1108. this.consultationCode,
  1109. this.rejecter,
  1110. });
  1111. factory RejectInviteLiveConsultationNotification.fromJson(Map<String, dynamic> map) {
  1112. return RejectInviteLiveConsultationNotification(
  1113. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  1114. consultationCode: map['ConsultationCode'],
  1115. rejecter: map['Rejecter'] != null ? LiveConsultationRejecterInfo.fromJson(map['Rejecter']) : null,
  1116. );
  1117. }
  1118. Map<String, dynamic> toJson() {
  1119. final map = Map<String, dynamic>();
  1120. map['NotificationType'] = notificationType.index;
  1121. if(consultationCode != null)
  1122. map['ConsultationCode'] = consultationCode;
  1123. if(rejecter != null)
  1124. map['Rejecter'] = rejecter;
  1125. return map;
  1126. }
  1127. }
  1128. class InviteLiveConsultationToDeviceNotification {
  1129. NotificationTypeEnum notificationType;
  1130. String? consultationCode;
  1131. int roomNo;
  1132. String? deviceCode;
  1133. int appId;
  1134. String? userSign;
  1135. bool mergedChannel;
  1136. int mergedVideoOutputWidth;
  1137. int mergedVideoOutputHeight;
  1138. List<VideoDeviceOutputInfo >? videoDeviceOutputInfo;
  1139. InviteLiveConsultationToDeviceNotification({
  1140. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  1141. this.consultationCode,
  1142. this.roomNo = 0,
  1143. this.deviceCode,
  1144. this.appId = 0,
  1145. this.userSign,
  1146. this.mergedChannel = false,
  1147. this.mergedVideoOutputWidth = 0,
  1148. this.mergedVideoOutputHeight = 0,
  1149. this.videoDeviceOutputInfo,
  1150. });
  1151. factory InviteLiveConsultationToDeviceNotification.fromJson(Map<String, dynamic> map) {
  1152. return InviteLiveConsultationToDeviceNotification(
  1153. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  1154. consultationCode: map['ConsultationCode'],
  1155. roomNo: map['RoomNo'],
  1156. deviceCode: map['DeviceCode'],
  1157. appId: map['AppId'],
  1158. userSign: map['UserSign'],
  1159. mergedChannel: map['MergedChannel'],
  1160. mergedVideoOutputWidth: map['MergedVideoOutputWidth'],
  1161. mergedVideoOutputHeight: map['MergedVideoOutputHeight'],
  1162. videoDeviceOutputInfo: map['VideoDeviceOutputInfo'] != null ? (map['VideoDeviceOutputInfo'] as List).map((e)=>VideoDeviceOutputInfo.fromJson(e as Map<String,dynamic>)).toList() : null,
  1163. );
  1164. }
  1165. Map<String, dynamic> toJson() {
  1166. final map = Map<String, dynamic>();
  1167. map['NotificationType'] = notificationType.index;
  1168. if(consultationCode != null)
  1169. map['ConsultationCode'] = consultationCode;
  1170. map['RoomNo'] = roomNo;
  1171. if(deviceCode != null)
  1172. map['DeviceCode'] = deviceCode;
  1173. map['AppId'] = appId;
  1174. if(userSign != null)
  1175. map['UserSign'] = userSign;
  1176. map['MergedChannel'] = mergedChannel;
  1177. map['MergedVideoOutputWidth'] = mergedVideoOutputWidth;
  1178. map['MergedVideoOutputHeight'] = mergedVideoOutputHeight;
  1179. if(videoDeviceOutputInfo != null)
  1180. map['VideoDeviceOutputInfo'] = videoDeviceOutputInfo;
  1181. return map;
  1182. }
  1183. }
  1184. class JoinLiveConsultationNotification {
  1185. NotificationTypeEnum notificationType;
  1186. String? consultationCode;
  1187. LiveConsultationJoinerInfo? joiner;
  1188. JoinLiveConsultationNotification({
  1189. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  1190. this.consultationCode,
  1191. this.joiner,
  1192. });
  1193. factory JoinLiveConsultationNotification.fromJson(Map<String, dynamic> map) {
  1194. return JoinLiveConsultationNotification(
  1195. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  1196. consultationCode: map['ConsultationCode'],
  1197. joiner: map['Joiner'] != null ? LiveConsultationJoinerInfo.fromJson(map['Joiner']) : null,
  1198. );
  1199. }
  1200. Map<String, dynamic> toJson() {
  1201. final map = Map<String, dynamic>();
  1202. map['NotificationType'] = notificationType.index;
  1203. if(consultationCode != null)
  1204. map['ConsultationCode'] = consultationCode;
  1205. if(joiner != null)
  1206. map['Joiner'] = joiner;
  1207. return map;
  1208. }
  1209. }
  1210. class LeaveLiveConsultationNotification {
  1211. NotificationTypeEnum notificationType;
  1212. String? consultationCode;
  1213. LiveConsultationLeaverInfo? leaverInfo;
  1214. LeaveLiveConsultationNotification({
  1215. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  1216. this.consultationCode,
  1217. this.leaverInfo,
  1218. });
  1219. factory LeaveLiveConsultationNotification.fromJson(Map<String, dynamic> map) {
  1220. return LeaveLiveConsultationNotification(
  1221. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  1222. consultationCode: map['ConsultationCode'],
  1223. leaverInfo: map['LeaverInfo'] != null ? LiveConsultationLeaverInfo.fromJson(map['LeaverInfo']) : null,
  1224. );
  1225. }
  1226. Map<String, dynamic> toJson() {
  1227. final map = Map<String, dynamic>();
  1228. map['NotificationType'] = notificationType.index;
  1229. if(consultationCode != null)
  1230. map['ConsultationCode'] = consultationCode;
  1231. if(leaverInfo != null)
  1232. map['LeaverInfo'] = leaverInfo;
  1233. return map;
  1234. }
  1235. }
  1236. class LiveConsultationMuterInfo extends LiveConsultationMemberInfo{
  1237. LiveConsultationMuterInfo({
  1238. String? id,
  1239. String? name,
  1240. String? headImageUrl,
  1241. }) : super(
  1242. id: id,
  1243. name: name,
  1244. headImageUrl: headImageUrl,
  1245. );
  1246. factory LiveConsultationMuterInfo.fromJson(Map<String, dynamic> map) {
  1247. return LiveConsultationMuterInfo(
  1248. id: map['Id'],
  1249. name: map['Name'],
  1250. headImageUrl: map['HeadImageUrl'],
  1251. );
  1252. }
  1253. Map<String, dynamic> toJson() {
  1254. final map = super.toJson();
  1255. return map;
  1256. }
  1257. }
  1258. class MuteLiveConsultationNotification {
  1259. NotificationTypeEnum notificationType;
  1260. String? consultationCode;
  1261. bool mute;
  1262. LiveConsultationMuterInfo? muterInfo;
  1263. MuteLiveConsultationNotification({
  1264. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  1265. this.consultationCode,
  1266. this.mute = false,
  1267. this.muterInfo,
  1268. });
  1269. factory MuteLiveConsultationNotification.fromJson(Map<String, dynamic> map) {
  1270. return MuteLiveConsultationNotification(
  1271. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  1272. consultationCode: map['ConsultationCode'],
  1273. mute: map['Mute'],
  1274. muterInfo: map['MuterInfo'] != null ? LiveConsultationMuterInfo.fromJson(map['MuterInfo']) : null,
  1275. );
  1276. }
  1277. Map<String, dynamic> toJson() {
  1278. final map = Map<String, dynamic>();
  1279. map['NotificationType'] = notificationType.index;
  1280. if(consultationCode != null)
  1281. map['ConsultationCode'] = consultationCode;
  1282. map['Mute'] = mute;
  1283. if(muterInfo != null)
  1284. map['MuterInfo'] = muterInfo;
  1285. return map;
  1286. }
  1287. }
  1288. class LiveConsultationNetworkErrMemberInfo extends LiveConsultationMemberInfo{
  1289. LiveConsultationNetworkErrMemberInfo({
  1290. String? id,
  1291. String? name,
  1292. String? headImageUrl,
  1293. }) : super(
  1294. id: id,
  1295. name: name,
  1296. headImageUrl: headImageUrl,
  1297. );
  1298. factory LiveConsultationNetworkErrMemberInfo.fromJson(Map<String, dynamic> map) {
  1299. return LiveConsultationNetworkErrMemberInfo(
  1300. id: map['Id'],
  1301. name: map['Name'],
  1302. headImageUrl: map['HeadImageUrl'],
  1303. );
  1304. }
  1305. Map<String, dynamic> toJson() {
  1306. final map = super.toJson();
  1307. return map;
  1308. }
  1309. }
  1310. class NetworkErrConsultationNotification {
  1311. NotificationTypeEnum notificationType;
  1312. String? consultationCode;
  1313. LiveConsultationNetworkErrMemberInfo? networkErrMemberInfo;
  1314. NetworkErrConsultationNotification({
  1315. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  1316. this.consultationCode,
  1317. this.networkErrMemberInfo,
  1318. });
  1319. factory NetworkErrConsultationNotification.fromJson(Map<String, dynamic> map) {
  1320. return NetworkErrConsultationNotification(
  1321. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  1322. consultationCode: map['ConsultationCode'],
  1323. networkErrMemberInfo: map['NetworkErrMemberInfo'] != null ? LiveConsultationNetworkErrMemberInfo.fromJson(map['NetworkErrMemberInfo']) : null,
  1324. );
  1325. }
  1326. Map<String, dynamic> toJson() {
  1327. final map = Map<String, dynamic>();
  1328. map['NotificationType'] = notificationType.index;
  1329. if(consultationCode != null)
  1330. map['ConsultationCode'] = consultationCode;
  1331. if(networkErrMemberInfo != null)
  1332. map['NetworkErrMemberInfo'] = networkErrMemberInfo;
  1333. return map;
  1334. }
  1335. }
  1336. class RejectLiveConsultationNotification {
  1337. NotificationTypeEnum notificationType;
  1338. String? consultationCode;
  1339. LiveConsultationRejecterInfo? rejecter;
  1340. RejectLiveConsultationNotification({
  1341. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  1342. this.consultationCode,
  1343. this.rejecter,
  1344. });
  1345. factory RejectLiveConsultationNotification.fromJson(Map<String, dynamic> map) {
  1346. return RejectLiveConsultationNotification(
  1347. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  1348. consultationCode: map['ConsultationCode'],
  1349. rejecter: map['Rejecter'] != null ? LiveConsultationRejecterInfo.fromJson(map['Rejecter']) : null,
  1350. );
  1351. }
  1352. Map<String, dynamic> toJson() {
  1353. final map = Map<String, dynamic>();
  1354. map['NotificationType'] = notificationType.index;
  1355. if(consultationCode != null)
  1356. map['ConsultationCode'] = consultationCode;
  1357. if(rejecter != null)
  1358. map['Rejecter'] = rejecter;
  1359. return map;
  1360. }
  1361. }
  1362. class LiveConsultationSwitcherInfo extends LiveConsultationMemberInfo{
  1363. LiveConsultationSwitcherInfo({
  1364. String? id,
  1365. String? name,
  1366. String? headImageUrl,
  1367. }) : super(
  1368. id: id,
  1369. name: name,
  1370. headImageUrl: headImageUrl,
  1371. );
  1372. factory LiveConsultationSwitcherInfo.fromJson(Map<String, dynamic> map) {
  1373. return LiveConsultationSwitcherInfo(
  1374. id: map['Id'],
  1375. name: map['Name'],
  1376. headImageUrl: map['HeadImageUrl'],
  1377. );
  1378. }
  1379. Map<String, dynamic> toJson() {
  1380. final map = super.toJson();
  1381. return map;
  1382. }
  1383. }
  1384. class SwitchLiveConsultationVideoNotification {
  1385. NotificationTypeEnum notificationType;
  1386. String? consultationCode;
  1387. bool opened;
  1388. LiveConsultationSwitcherInfo? switcherInfo;
  1389. SwitchLiveConsultationVideoNotification({
  1390. this.notificationType = NotificationTypeEnum.ChatMsgNotification,
  1391. this.consultationCode,
  1392. this.opened = false,
  1393. this.switcherInfo,
  1394. });
  1395. factory SwitchLiveConsultationVideoNotification.fromJson(Map<String, dynamic> map) {
  1396. return SwitchLiveConsultationVideoNotification(
  1397. notificationType: NotificationTypeEnum.values.firstWhere((e) => e.index == map['NotificationType']),
  1398. consultationCode: map['ConsultationCode'],
  1399. opened: map['Opened'],
  1400. switcherInfo: map['SwitcherInfo'] != null ? LiveConsultationSwitcherInfo.fromJson(map['SwitcherInfo']) : null,
  1401. );
  1402. }
  1403. Map<String, dynamic> toJson() {
  1404. final map = Map<String, dynamic>();
  1405. map['NotificationType'] = notificationType.index;
  1406. if(consultationCode != null)
  1407. map['ConsultationCode'] = consultationCode;
  1408. map['Opened'] = opened;
  1409. if(switcherInfo != null)
  1410. map['SwitcherInfo'] = switcherInfo;
  1411. return map;
  1412. }
  1413. }