notification.m.dart 52 KB

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