@fatehan/tsrp 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1634 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.7.0
5
+ // protoc v3.21.12
6
+ // source: notifies/notify.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.Notification_DataEntry = exports.Notification = exports.Notify_DataEntry = exports.Notify = exports.Receiver = exports.UserDeviceAlertList = exports.UserDeviceAlert_ConditionEntry = exports.UserDeviceAlert_ConditionList = exports.UserDeviceAlert_Condition = exports.UserDeviceAlert = exports.NotifyJob = exports.NotifyJob_Priority = exports.ObjectType = exports.Via = exports.protobufPackage = void 0;
9
+ exports.viaFromJSON = viaFromJSON;
10
+ exports.viaToJSON = viaToJSON;
11
+ exports.objectTypeFromJSON = objectTypeFromJSON;
12
+ exports.objectTypeToJSON = objectTypeToJSON;
13
+ exports.notifyJob_PriorityFromJSON = notifyJob_PriorityFromJSON;
14
+ exports.notifyJob_PriorityToJSON = notifyJob_PriorityToJSON;
15
+ /* eslint-disable */
16
+ const wire_1 = require("@bufbuild/protobuf/wire");
17
+ const timestamp_1 = require("../google/protobuf/timestamp");
18
+ const dataModel_1 = require("../packets/dataModel");
19
+ exports.protobufPackage = "fatehan";
20
+ var Via;
21
+ (function (Via) {
22
+ Via[Via["NONE"] = 0] = "NONE";
23
+ Via[Via["SMS"] = 1] = "SMS";
24
+ Via[Via["FCM"] = 2] = "FCM";
25
+ Via[Via["EMAIL"] = 3] = "EMAIL";
26
+ Via[Via["DATABASE"] = 4] = "DATABASE";
27
+ Via[Via["CALL"] = 5] = "CALL";
28
+ Via[Via["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
29
+ })(Via || (exports.Via = Via = {}));
30
+ function viaFromJSON(object) {
31
+ switch (object) {
32
+ case 0:
33
+ case "NONE":
34
+ return Via.NONE;
35
+ case 1:
36
+ case "SMS":
37
+ return Via.SMS;
38
+ case 2:
39
+ case "FCM":
40
+ return Via.FCM;
41
+ case 3:
42
+ case "EMAIL":
43
+ return Via.EMAIL;
44
+ case 4:
45
+ case "DATABASE":
46
+ return Via.DATABASE;
47
+ case 5:
48
+ case "CALL":
49
+ return Via.CALL;
50
+ case -1:
51
+ case "UNRECOGNIZED":
52
+ default:
53
+ return Via.UNRECOGNIZED;
54
+ }
55
+ }
56
+ function viaToJSON(object) {
57
+ switch (object) {
58
+ case Via.NONE:
59
+ return "NONE";
60
+ case Via.SMS:
61
+ return "SMS";
62
+ case Via.FCM:
63
+ return "FCM";
64
+ case Via.EMAIL:
65
+ return "EMAIL";
66
+ case Via.DATABASE:
67
+ return "DATABASE";
68
+ case Via.CALL:
69
+ return "CALL";
70
+ case Via.UNRECOGNIZED:
71
+ default:
72
+ return "UNRECOGNIZED";
73
+ }
74
+ }
75
+ var ObjectType;
76
+ (function (ObjectType) {
77
+ ObjectType[ObjectType["UNKNOWN"] = 0] = "UNKNOWN";
78
+ ObjectType[ObjectType["DEVICE"] = 1] = "DEVICE";
79
+ ObjectType[ObjectType["USER"] = 2] = "USER";
80
+ ObjectType[ObjectType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
81
+ })(ObjectType || (exports.ObjectType = ObjectType = {}));
82
+ function objectTypeFromJSON(object) {
83
+ switch (object) {
84
+ case 0:
85
+ case "UNKNOWN":
86
+ return ObjectType.UNKNOWN;
87
+ case 1:
88
+ case "DEVICE":
89
+ return ObjectType.DEVICE;
90
+ case 2:
91
+ case "USER":
92
+ return ObjectType.USER;
93
+ case -1:
94
+ case "UNRECOGNIZED":
95
+ default:
96
+ return ObjectType.UNRECOGNIZED;
97
+ }
98
+ }
99
+ function objectTypeToJSON(object) {
100
+ switch (object) {
101
+ case ObjectType.UNKNOWN:
102
+ return "UNKNOWN";
103
+ case ObjectType.DEVICE:
104
+ return "DEVICE";
105
+ case ObjectType.USER:
106
+ return "USER";
107
+ case ObjectType.UNRECOGNIZED:
108
+ default:
109
+ return "UNRECOGNIZED";
110
+ }
111
+ }
112
+ var NotifyJob_Priority;
113
+ (function (NotifyJob_Priority) {
114
+ NotifyJob_Priority[NotifyJob_Priority["LOW"] = 0] = "LOW";
115
+ NotifyJob_Priority[NotifyJob_Priority["MEDIUM"] = 1] = "MEDIUM";
116
+ NotifyJob_Priority[NotifyJob_Priority["HIGH"] = 2] = "HIGH";
117
+ NotifyJob_Priority[NotifyJob_Priority["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
118
+ })(NotifyJob_Priority || (exports.NotifyJob_Priority = NotifyJob_Priority = {}));
119
+ function notifyJob_PriorityFromJSON(object) {
120
+ switch (object) {
121
+ case 0:
122
+ case "LOW":
123
+ return NotifyJob_Priority.LOW;
124
+ case 1:
125
+ case "MEDIUM":
126
+ return NotifyJob_Priority.MEDIUM;
127
+ case 2:
128
+ case "HIGH":
129
+ return NotifyJob_Priority.HIGH;
130
+ case -1:
131
+ case "UNRECOGNIZED":
132
+ default:
133
+ return NotifyJob_Priority.UNRECOGNIZED;
134
+ }
135
+ }
136
+ function notifyJob_PriorityToJSON(object) {
137
+ switch (object) {
138
+ case NotifyJob_Priority.LOW:
139
+ return "LOW";
140
+ case NotifyJob_Priority.MEDIUM:
141
+ return "MEDIUM";
142
+ case NotifyJob_Priority.HIGH:
143
+ return "HIGH";
144
+ case NotifyJob_Priority.UNRECOGNIZED:
145
+ default:
146
+ return "UNRECOGNIZED";
147
+ }
148
+ }
149
+ function createBaseNotifyJob() {
150
+ return { id: 0, userId: 0, alertId: 0, alertType: 0, retries: 0, priority: 0, notify: undefined, via: [] };
151
+ }
152
+ exports.NotifyJob = {
153
+ encode(message, writer = new wire_1.BinaryWriter()) {
154
+ if (message.id !== 0) {
155
+ writer.uint32(8).uint64(message.id);
156
+ }
157
+ if (message.userId !== 0) {
158
+ writer.uint32(16).uint64(message.userId);
159
+ }
160
+ if (message.alertId !== 0) {
161
+ writer.uint32(24).uint64(message.alertId);
162
+ }
163
+ if (message.alertType !== 0) {
164
+ writer.uint32(32).int32(message.alertType);
165
+ }
166
+ if (message.retries !== 0) {
167
+ writer.uint32(40).uint32(message.retries);
168
+ }
169
+ if (message.priority !== 0) {
170
+ writer.uint32(48).int32(message.priority);
171
+ }
172
+ if (message.notify !== undefined) {
173
+ exports.Notify.encode(message.notify, writer.uint32(58).fork()).join();
174
+ }
175
+ writer.uint32(66).fork();
176
+ for (const v of message.via) {
177
+ writer.int32(v);
178
+ }
179
+ writer.join();
180
+ return writer;
181
+ },
182
+ decode(input, length) {
183
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
184
+ let end = length === undefined ? reader.len : reader.pos + length;
185
+ const message = createBaseNotifyJob();
186
+ while (reader.pos < end) {
187
+ const tag = reader.uint32();
188
+ switch (tag >>> 3) {
189
+ case 1: {
190
+ if (tag !== 8) {
191
+ break;
192
+ }
193
+ message.id = longToNumber(reader.uint64());
194
+ continue;
195
+ }
196
+ case 2: {
197
+ if (tag !== 16) {
198
+ break;
199
+ }
200
+ message.userId = longToNumber(reader.uint64());
201
+ continue;
202
+ }
203
+ case 3: {
204
+ if (tag !== 24) {
205
+ break;
206
+ }
207
+ message.alertId = longToNumber(reader.uint64());
208
+ continue;
209
+ }
210
+ case 4: {
211
+ if (tag !== 32) {
212
+ break;
213
+ }
214
+ message.alertType = reader.int32();
215
+ continue;
216
+ }
217
+ case 5: {
218
+ if (tag !== 40) {
219
+ break;
220
+ }
221
+ message.retries = reader.uint32();
222
+ continue;
223
+ }
224
+ case 6: {
225
+ if (tag !== 48) {
226
+ break;
227
+ }
228
+ message.priority = reader.int32();
229
+ continue;
230
+ }
231
+ case 7: {
232
+ if (tag !== 58) {
233
+ break;
234
+ }
235
+ message.notify = exports.Notify.decode(reader, reader.uint32());
236
+ continue;
237
+ }
238
+ case 8: {
239
+ if (tag === 64) {
240
+ message.via.push(reader.int32());
241
+ continue;
242
+ }
243
+ if (tag === 66) {
244
+ const end2 = reader.uint32() + reader.pos;
245
+ while (reader.pos < end2) {
246
+ message.via.push(reader.int32());
247
+ }
248
+ continue;
249
+ }
250
+ break;
251
+ }
252
+ }
253
+ if ((tag & 7) === 4 || tag === 0) {
254
+ break;
255
+ }
256
+ reader.skip(tag & 7);
257
+ }
258
+ return message;
259
+ },
260
+ fromJSON(object) {
261
+ return {
262
+ id: isSet(object.id) ? globalThis.Number(object.id) : 0,
263
+ userId: isSet(object.user_id) ? globalThis.Number(object.user_id) : 0,
264
+ alertId: isSet(object.alert_id) ? globalThis.Number(object.alert_id) : 0,
265
+ alertType: isSet(object.alert_type) ? (0, dataModel_1.alertFromJSON)(object.alert_type) : 0,
266
+ retries: isSet(object.retries) ? globalThis.Number(object.retries) : 0,
267
+ priority: isSet(object.priority) ? notifyJob_PriorityFromJSON(object.priority) : 0,
268
+ notify: isSet(object.notify) ? exports.Notify.fromJSON(object.notify) : undefined,
269
+ via: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.via) ? object.via.map((e) => viaFromJSON(e)) : [],
270
+ };
271
+ },
272
+ toJSON(message) {
273
+ var _a;
274
+ const obj = {};
275
+ if (message.id !== 0) {
276
+ obj.id = Math.round(message.id);
277
+ }
278
+ if (message.userId !== 0) {
279
+ obj.user_id = Math.round(message.userId);
280
+ }
281
+ if (message.alertId !== 0) {
282
+ obj.alert_id = Math.round(message.alertId);
283
+ }
284
+ if (message.alertType !== 0) {
285
+ obj.alert_type = (0, dataModel_1.alertToJSON)(message.alertType);
286
+ }
287
+ if (message.retries !== 0) {
288
+ obj.retries = Math.round(message.retries);
289
+ }
290
+ if (message.priority !== 0) {
291
+ obj.priority = notifyJob_PriorityToJSON(message.priority);
292
+ }
293
+ if (message.notify !== undefined) {
294
+ obj.notify = exports.Notify.toJSON(message.notify);
295
+ }
296
+ if ((_a = message.via) === null || _a === void 0 ? void 0 : _a.length) {
297
+ obj.via = message.via.map((e) => viaToJSON(e));
298
+ }
299
+ return obj;
300
+ },
301
+ create(base) {
302
+ return exports.NotifyJob.fromPartial(base !== null && base !== void 0 ? base : {});
303
+ },
304
+ fromPartial(object) {
305
+ var _a, _b, _c, _d, _e, _f, _g;
306
+ const message = createBaseNotifyJob();
307
+ message.id = (_a = object.id) !== null && _a !== void 0 ? _a : 0;
308
+ message.userId = (_b = object.userId) !== null && _b !== void 0 ? _b : 0;
309
+ message.alertId = (_c = object.alertId) !== null && _c !== void 0 ? _c : 0;
310
+ message.alertType = (_d = object.alertType) !== null && _d !== void 0 ? _d : 0;
311
+ message.retries = (_e = object.retries) !== null && _e !== void 0 ? _e : 0;
312
+ message.priority = (_f = object.priority) !== null && _f !== void 0 ? _f : 0;
313
+ message.notify = (object.notify !== undefined && object.notify !== null)
314
+ ? exports.Notify.fromPartial(object.notify)
315
+ : undefined;
316
+ message.via = ((_g = object.via) === null || _g === void 0 ? void 0 : _g.map((e) => e)) || [];
317
+ return message;
318
+ },
319
+ };
320
+ function createBaseUserDeviceAlert() {
321
+ return {
322
+ id: 0,
323
+ userId: 0,
324
+ deviceId: 0,
325
+ alertId: 0,
326
+ condition: {},
327
+ status: false,
328
+ format: "",
329
+ alert: 0,
330
+ unit: undefined,
331
+ };
332
+ }
333
+ exports.UserDeviceAlert = {
334
+ encode(message, writer = new wire_1.BinaryWriter()) {
335
+ if (message.id !== 0) {
336
+ writer.uint32(8).uint64(message.id);
337
+ }
338
+ if (message.userId !== 0) {
339
+ writer.uint32(16).uint64(message.userId);
340
+ }
341
+ if (message.deviceId !== 0) {
342
+ writer.uint32(32).uint64(message.deviceId);
343
+ }
344
+ if (message.alertId !== 0) {
345
+ writer.uint32(40).uint64(message.alertId);
346
+ }
347
+ Object.entries(message.condition).forEach(([key, value]) => {
348
+ exports.UserDeviceAlert_ConditionEntry.encode({ key: key, value }, writer.uint32(50).fork()).join();
349
+ });
350
+ if (message.status !== false) {
351
+ writer.uint32(56).bool(message.status);
352
+ }
353
+ if (message.format !== "") {
354
+ writer.uint32(66).string(message.format);
355
+ }
356
+ if (message.alert !== 0) {
357
+ writer.uint32(72).int32(message.alert);
358
+ }
359
+ if (message.unit !== undefined) {
360
+ writer.uint32(82).string(message.unit);
361
+ }
362
+ return writer;
363
+ },
364
+ decode(input, length) {
365
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
366
+ let end = length === undefined ? reader.len : reader.pos + length;
367
+ const message = createBaseUserDeviceAlert();
368
+ while (reader.pos < end) {
369
+ const tag = reader.uint32();
370
+ switch (tag >>> 3) {
371
+ case 1: {
372
+ if (tag !== 8) {
373
+ break;
374
+ }
375
+ message.id = longToNumber(reader.uint64());
376
+ continue;
377
+ }
378
+ case 2: {
379
+ if (tag !== 16) {
380
+ break;
381
+ }
382
+ message.userId = longToNumber(reader.uint64());
383
+ continue;
384
+ }
385
+ case 4: {
386
+ if (tag !== 32) {
387
+ break;
388
+ }
389
+ message.deviceId = longToNumber(reader.uint64());
390
+ continue;
391
+ }
392
+ case 5: {
393
+ if (tag !== 40) {
394
+ break;
395
+ }
396
+ message.alertId = longToNumber(reader.uint64());
397
+ continue;
398
+ }
399
+ case 6: {
400
+ if (tag !== 50) {
401
+ break;
402
+ }
403
+ const entry6 = exports.UserDeviceAlert_ConditionEntry.decode(reader, reader.uint32());
404
+ if (entry6.value !== undefined) {
405
+ message.condition[entry6.key] = entry6.value;
406
+ }
407
+ continue;
408
+ }
409
+ case 7: {
410
+ if (tag !== 56) {
411
+ break;
412
+ }
413
+ message.status = reader.bool();
414
+ continue;
415
+ }
416
+ case 8: {
417
+ if (tag !== 66) {
418
+ break;
419
+ }
420
+ message.format = reader.string();
421
+ continue;
422
+ }
423
+ case 9: {
424
+ if (tag !== 72) {
425
+ break;
426
+ }
427
+ message.alert = reader.int32();
428
+ continue;
429
+ }
430
+ case 10: {
431
+ if (tag !== 82) {
432
+ break;
433
+ }
434
+ message.unit = reader.string();
435
+ continue;
436
+ }
437
+ }
438
+ if ((tag & 7) === 4 || tag === 0) {
439
+ break;
440
+ }
441
+ reader.skip(tag & 7);
442
+ }
443
+ return message;
444
+ },
445
+ fromJSON(object) {
446
+ return {
447
+ id: isSet(object.id) ? globalThis.Number(object.id) : 0,
448
+ userId: isSet(object.user_id) ? globalThis.Number(object.user_id) : 0,
449
+ deviceId: isSet(object.device_id) ? globalThis.Number(object.device_id) : 0,
450
+ alertId: isSet(object.alert_id) ? globalThis.Number(object.alert_id) : 0,
451
+ condition: isObject(object.condition)
452
+ ? Object.entries(object.condition).reduce((acc, [key, value]) => {
453
+ acc[globalThis.Number(key)] = exports.UserDeviceAlert_ConditionList.fromJSON(value);
454
+ return acc;
455
+ }, {})
456
+ : {},
457
+ status: isSet(object.status) ? globalThis.Boolean(object.status) : false,
458
+ format: isSet(object.format) ? globalThis.String(object.format) : "",
459
+ alert: isSet(object.alert) ? (0, dataModel_1.alertFromJSON)(object.alert) : 0,
460
+ unit: isSet(object.unit) ? globalThis.String(object.unit) : undefined,
461
+ };
462
+ },
463
+ toJSON(message) {
464
+ const obj = {};
465
+ if (message.id !== 0) {
466
+ obj.id = Math.round(message.id);
467
+ }
468
+ if (message.userId !== 0) {
469
+ obj.user_id = Math.round(message.userId);
470
+ }
471
+ if (message.deviceId !== 0) {
472
+ obj.device_id = Math.round(message.deviceId);
473
+ }
474
+ if (message.alertId !== 0) {
475
+ obj.alert_id = Math.round(message.alertId);
476
+ }
477
+ if (message.condition) {
478
+ const entries = Object.entries(message.condition);
479
+ if (entries.length > 0) {
480
+ obj.condition = {};
481
+ entries.forEach(([k, v]) => {
482
+ obj.condition[k] = exports.UserDeviceAlert_ConditionList.toJSON(v);
483
+ });
484
+ }
485
+ }
486
+ if (message.status !== false) {
487
+ obj.status = message.status;
488
+ }
489
+ if (message.format !== "") {
490
+ obj.format = message.format;
491
+ }
492
+ if (message.alert !== 0) {
493
+ obj.alert = (0, dataModel_1.alertToJSON)(message.alert);
494
+ }
495
+ if (message.unit !== undefined) {
496
+ obj.unit = message.unit;
497
+ }
498
+ return obj;
499
+ },
500
+ create(base) {
501
+ return exports.UserDeviceAlert.fromPartial(base !== null && base !== void 0 ? base : {});
502
+ },
503
+ fromPartial(object) {
504
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
505
+ const message = createBaseUserDeviceAlert();
506
+ message.id = (_a = object.id) !== null && _a !== void 0 ? _a : 0;
507
+ message.userId = (_b = object.userId) !== null && _b !== void 0 ? _b : 0;
508
+ message.deviceId = (_c = object.deviceId) !== null && _c !== void 0 ? _c : 0;
509
+ message.alertId = (_d = object.alertId) !== null && _d !== void 0 ? _d : 0;
510
+ message.condition = Object.entries((_e = object.condition) !== null && _e !== void 0 ? _e : {}).reduce((acc, [key, value]) => {
511
+ if (value !== undefined) {
512
+ acc[globalThis.Number(key)] = exports.UserDeviceAlert_ConditionList.fromPartial(value);
513
+ }
514
+ return acc;
515
+ }, {});
516
+ message.status = (_f = object.status) !== null && _f !== void 0 ? _f : false;
517
+ message.format = (_g = object.format) !== null && _g !== void 0 ? _g : "";
518
+ message.alert = (_h = object.alert) !== null && _h !== void 0 ? _h : 0;
519
+ message.unit = (_j = object.unit) !== null && _j !== void 0 ? _j : undefined;
520
+ return message;
521
+ },
522
+ };
523
+ function createBaseUserDeviceAlert_Condition() {
524
+ return { fromTime: undefined, toTime: undefined, soundId: undefined, text: undefined, value: undefined, type: [] };
525
+ }
526
+ exports.UserDeviceAlert_Condition = {
527
+ encode(message, writer = new wire_1.BinaryWriter()) {
528
+ if (message.fromTime !== undefined) {
529
+ writer.uint32(10).string(message.fromTime);
530
+ }
531
+ if (message.toTime !== undefined) {
532
+ writer.uint32(18).string(message.toTime);
533
+ }
534
+ if (message.soundId !== undefined) {
535
+ writer.uint32(24).uint64(message.soundId);
536
+ }
537
+ if (message.text !== undefined) {
538
+ writer.uint32(34).string(message.text);
539
+ }
540
+ if (message.value !== undefined) {
541
+ writer.uint32(42).string(message.value);
542
+ }
543
+ writer.uint32(50).fork();
544
+ for (const v of message.type) {
545
+ writer.int32(v);
546
+ }
547
+ writer.join();
548
+ return writer;
549
+ },
550
+ decode(input, length) {
551
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
552
+ let end = length === undefined ? reader.len : reader.pos + length;
553
+ const message = createBaseUserDeviceAlert_Condition();
554
+ while (reader.pos < end) {
555
+ const tag = reader.uint32();
556
+ switch (tag >>> 3) {
557
+ case 1: {
558
+ if (tag !== 10) {
559
+ break;
560
+ }
561
+ message.fromTime = reader.string();
562
+ continue;
563
+ }
564
+ case 2: {
565
+ if (tag !== 18) {
566
+ break;
567
+ }
568
+ message.toTime = reader.string();
569
+ continue;
570
+ }
571
+ case 3: {
572
+ if (tag !== 24) {
573
+ break;
574
+ }
575
+ message.soundId = longToNumber(reader.uint64());
576
+ continue;
577
+ }
578
+ case 4: {
579
+ if (tag !== 34) {
580
+ break;
581
+ }
582
+ message.text = reader.string();
583
+ continue;
584
+ }
585
+ case 5: {
586
+ if (tag !== 42) {
587
+ break;
588
+ }
589
+ message.value = reader.string();
590
+ continue;
591
+ }
592
+ case 6: {
593
+ if (tag === 48) {
594
+ message.type.push(reader.int32());
595
+ continue;
596
+ }
597
+ if (tag === 50) {
598
+ const end2 = reader.uint32() + reader.pos;
599
+ while (reader.pos < end2) {
600
+ message.type.push(reader.int32());
601
+ }
602
+ continue;
603
+ }
604
+ break;
605
+ }
606
+ }
607
+ if ((tag & 7) === 4 || tag === 0) {
608
+ break;
609
+ }
610
+ reader.skip(tag & 7);
611
+ }
612
+ return message;
613
+ },
614
+ fromJSON(object) {
615
+ return {
616
+ fromTime: isSet(object.from_time) ? globalThis.String(object.from_time) : undefined,
617
+ toTime: isSet(object.to_time) ? globalThis.String(object.to_time) : undefined,
618
+ soundId: isSet(object.sound_id) ? globalThis.Number(object.sound_id) : undefined,
619
+ text: isSet(object.text) ? globalThis.String(object.text) : undefined,
620
+ value: isSet(object.value) ? globalThis.String(object.value) : undefined,
621
+ type: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.type) ? object.type.map((e) => viaFromJSON(e)) : [],
622
+ };
623
+ },
624
+ toJSON(message) {
625
+ var _a;
626
+ const obj = {};
627
+ if (message.fromTime !== undefined) {
628
+ obj.from_time = message.fromTime;
629
+ }
630
+ if (message.toTime !== undefined) {
631
+ obj.to_time = message.toTime;
632
+ }
633
+ if (message.soundId !== undefined) {
634
+ obj.sound_id = Math.round(message.soundId);
635
+ }
636
+ if (message.text !== undefined) {
637
+ obj.text = message.text;
638
+ }
639
+ if (message.value !== undefined) {
640
+ obj.value = message.value;
641
+ }
642
+ if ((_a = message.type) === null || _a === void 0 ? void 0 : _a.length) {
643
+ obj.type = message.type.map((e) => viaToJSON(e));
644
+ }
645
+ return obj;
646
+ },
647
+ create(base) {
648
+ return exports.UserDeviceAlert_Condition.fromPartial(base !== null && base !== void 0 ? base : {});
649
+ },
650
+ fromPartial(object) {
651
+ var _a, _b, _c, _d, _e, _f;
652
+ const message = createBaseUserDeviceAlert_Condition();
653
+ message.fromTime = (_a = object.fromTime) !== null && _a !== void 0 ? _a : undefined;
654
+ message.toTime = (_b = object.toTime) !== null && _b !== void 0 ? _b : undefined;
655
+ message.soundId = (_c = object.soundId) !== null && _c !== void 0 ? _c : undefined;
656
+ message.text = (_d = object.text) !== null && _d !== void 0 ? _d : undefined;
657
+ message.value = (_e = object.value) !== null && _e !== void 0 ? _e : undefined;
658
+ message.type = ((_f = object.type) === null || _f === void 0 ? void 0 : _f.map((e) => e)) || [];
659
+ return message;
660
+ },
661
+ };
662
+ function createBaseUserDeviceAlert_ConditionList() {
663
+ return { condition: [] };
664
+ }
665
+ exports.UserDeviceAlert_ConditionList = {
666
+ encode(message, writer = new wire_1.BinaryWriter()) {
667
+ for (const v of message.condition) {
668
+ exports.UserDeviceAlert_Condition.encode(v, writer.uint32(10).fork()).join();
669
+ }
670
+ return writer;
671
+ },
672
+ decode(input, length) {
673
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
674
+ let end = length === undefined ? reader.len : reader.pos + length;
675
+ const message = createBaseUserDeviceAlert_ConditionList();
676
+ while (reader.pos < end) {
677
+ const tag = reader.uint32();
678
+ switch (tag >>> 3) {
679
+ case 1: {
680
+ if (tag !== 10) {
681
+ break;
682
+ }
683
+ message.condition.push(exports.UserDeviceAlert_Condition.decode(reader, reader.uint32()));
684
+ continue;
685
+ }
686
+ }
687
+ if ((tag & 7) === 4 || tag === 0) {
688
+ break;
689
+ }
690
+ reader.skip(tag & 7);
691
+ }
692
+ return message;
693
+ },
694
+ fromJSON(object) {
695
+ return {
696
+ condition: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.condition_list)
697
+ ? object.condition_list.map((e) => exports.UserDeviceAlert_Condition.fromJSON(e))
698
+ : [],
699
+ };
700
+ },
701
+ toJSON(message) {
702
+ var _a;
703
+ const obj = {};
704
+ if ((_a = message.condition) === null || _a === void 0 ? void 0 : _a.length) {
705
+ obj.condition_list = message.condition.map((e) => exports.UserDeviceAlert_Condition.toJSON(e));
706
+ }
707
+ return obj;
708
+ },
709
+ create(base) {
710
+ return exports.UserDeviceAlert_ConditionList.fromPartial(base !== null && base !== void 0 ? base : {});
711
+ },
712
+ fromPartial(object) {
713
+ var _a;
714
+ const message = createBaseUserDeviceAlert_ConditionList();
715
+ message.condition = ((_a = object.condition) === null || _a === void 0 ? void 0 : _a.map((e) => exports.UserDeviceAlert_Condition.fromPartial(e))) || [];
716
+ return message;
717
+ },
718
+ };
719
+ function createBaseUserDeviceAlert_ConditionEntry() {
720
+ return { key: 0, value: undefined };
721
+ }
722
+ exports.UserDeviceAlert_ConditionEntry = {
723
+ encode(message, writer = new wire_1.BinaryWriter()) {
724
+ if (message.key !== 0) {
725
+ writer.uint32(8).uint32(message.key);
726
+ }
727
+ if (message.value !== undefined) {
728
+ exports.UserDeviceAlert_ConditionList.encode(message.value, writer.uint32(18).fork()).join();
729
+ }
730
+ return writer;
731
+ },
732
+ decode(input, length) {
733
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
734
+ let end = length === undefined ? reader.len : reader.pos + length;
735
+ const message = createBaseUserDeviceAlert_ConditionEntry();
736
+ while (reader.pos < end) {
737
+ const tag = reader.uint32();
738
+ switch (tag >>> 3) {
739
+ case 1: {
740
+ if (tag !== 8) {
741
+ break;
742
+ }
743
+ message.key = reader.uint32();
744
+ continue;
745
+ }
746
+ case 2: {
747
+ if (tag !== 18) {
748
+ break;
749
+ }
750
+ message.value = exports.UserDeviceAlert_ConditionList.decode(reader, reader.uint32());
751
+ continue;
752
+ }
753
+ }
754
+ if ((tag & 7) === 4 || tag === 0) {
755
+ break;
756
+ }
757
+ reader.skip(tag & 7);
758
+ }
759
+ return message;
760
+ },
761
+ fromJSON(object) {
762
+ return {
763
+ key: isSet(object.key) ? globalThis.Number(object.key) : 0,
764
+ value: isSet(object.value) ? exports.UserDeviceAlert_ConditionList.fromJSON(object.value) : undefined,
765
+ };
766
+ },
767
+ toJSON(message) {
768
+ const obj = {};
769
+ if (message.key !== 0) {
770
+ obj.key = Math.round(message.key);
771
+ }
772
+ if (message.value !== undefined) {
773
+ obj.value = exports.UserDeviceAlert_ConditionList.toJSON(message.value);
774
+ }
775
+ return obj;
776
+ },
777
+ create(base) {
778
+ return exports.UserDeviceAlert_ConditionEntry.fromPartial(base !== null && base !== void 0 ? base : {});
779
+ },
780
+ fromPartial(object) {
781
+ var _a;
782
+ const message = createBaseUserDeviceAlert_ConditionEntry();
783
+ message.key = (_a = object.key) !== null && _a !== void 0 ? _a : 0;
784
+ message.value = (object.value !== undefined && object.value !== null)
785
+ ? exports.UserDeviceAlert_ConditionList.fromPartial(object.value)
786
+ : undefined;
787
+ return message;
788
+ },
789
+ };
790
+ function createBaseUserDeviceAlertList() {
791
+ return { list: [] };
792
+ }
793
+ exports.UserDeviceAlertList = {
794
+ encode(message, writer = new wire_1.BinaryWriter()) {
795
+ for (const v of message.list) {
796
+ exports.UserDeviceAlert.encode(v, writer.uint32(10).fork()).join();
797
+ }
798
+ return writer;
799
+ },
800
+ decode(input, length) {
801
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
802
+ let end = length === undefined ? reader.len : reader.pos + length;
803
+ const message = createBaseUserDeviceAlertList();
804
+ while (reader.pos < end) {
805
+ const tag = reader.uint32();
806
+ switch (tag >>> 3) {
807
+ case 1: {
808
+ if (tag !== 10) {
809
+ break;
810
+ }
811
+ message.list.push(exports.UserDeviceAlert.decode(reader, reader.uint32()));
812
+ continue;
813
+ }
814
+ }
815
+ if ((tag & 7) === 4 || tag === 0) {
816
+ break;
817
+ }
818
+ reader.skip(tag & 7);
819
+ }
820
+ return message;
821
+ },
822
+ fromJSON(object) {
823
+ return {
824
+ list: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.list) ? object.list.map((e) => exports.UserDeviceAlert.fromJSON(e)) : [],
825
+ };
826
+ },
827
+ toJSON(message) {
828
+ var _a;
829
+ const obj = {};
830
+ if ((_a = message.list) === null || _a === void 0 ? void 0 : _a.length) {
831
+ obj.list = message.list.map((e) => exports.UserDeviceAlert.toJSON(e));
832
+ }
833
+ return obj;
834
+ },
835
+ create(base) {
836
+ return exports.UserDeviceAlertList.fromPartial(base !== null && base !== void 0 ? base : {});
837
+ },
838
+ fromPartial(object) {
839
+ var _a;
840
+ const message = createBaseUserDeviceAlertList();
841
+ message.list = ((_a = object.list) === null || _a === void 0 ? void 0 : _a.map((e) => exports.UserDeviceAlert.fromPartial(e))) || [];
842
+ return message;
843
+ },
844
+ };
845
+ function createBaseReceiver() {
846
+ return { phone: undefined, email: undefined, token: [] };
847
+ }
848
+ exports.Receiver = {
849
+ encode(message, writer = new wire_1.BinaryWriter()) {
850
+ if (message.phone !== undefined) {
851
+ writer.uint32(8).uint64(message.phone);
852
+ }
853
+ if (message.email !== undefined) {
854
+ writer.uint32(18).string(message.email);
855
+ }
856
+ for (const v of message.token) {
857
+ writer.uint32(26).string(v);
858
+ }
859
+ return writer;
860
+ },
861
+ decode(input, length) {
862
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
863
+ let end = length === undefined ? reader.len : reader.pos + length;
864
+ const message = createBaseReceiver();
865
+ while (reader.pos < end) {
866
+ const tag = reader.uint32();
867
+ switch (tag >>> 3) {
868
+ case 1: {
869
+ if (tag !== 8) {
870
+ break;
871
+ }
872
+ message.phone = longToNumber(reader.uint64());
873
+ continue;
874
+ }
875
+ case 2: {
876
+ if (tag !== 18) {
877
+ break;
878
+ }
879
+ message.email = reader.string();
880
+ continue;
881
+ }
882
+ case 3: {
883
+ if (tag !== 26) {
884
+ break;
885
+ }
886
+ message.token.push(reader.string());
887
+ continue;
888
+ }
889
+ }
890
+ if ((tag & 7) === 4 || tag === 0) {
891
+ break;
892
+ }
893
+ reader.skip(tag & 7);
894
+ }
895
+ return message;
896
+ },
897
+ fromJSON(object) {
898
+ return {
899
+ phone: isSet(object.phone) ? globalThis.Number(object.phone) : undefined,
900
+ email: isSet(object.email) ? globalThis.String(object.email) : undefined,
901
+ token: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.token) ? object.token.map((e) => globalThis.String(e)) : [],
902
+ };
903
+ },
904
+ toJSON(message) {
905
+ var _a;
906
+ const obj = {};
907
+ if (message.phone !== undefined) {
908
+ obj.phone = Math.round(message.phone);
909
+ }
910
+ if (message.email !== undefined) {
911
+ obj.email = message.email;
912
+ }
913
+ if ((_a = message.token) === null || _a === void 0 ? void 0 : _a.length) {
914
+ obj.token = message.token;
915
+ }
916
+ return obj;
917
+ },
918
+ create(base) {
919
+ return exports.Receiver.fromPartial(base !== null && base !== void 0 ? base : {});
920
+ },
921
+ fromPartial(object) {
922
+ var _a, _b, _c;
923
+ const message = createBaseReceiver();
924
+ message.phone = (_a = object.phone) !== null && _a !== void 0 ? _a : undefined;
925
+ message.email = (_b = object.email) !== null && _b !== void 0 ? _b : undefined;
926
+ message.token = ((_c = object.token) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || [];
927
+ return message;
928
+ },
929
+ };
930
+ function createBaseNotify() {
931
+ return {
932
+ title: "",
933
+ body: "",
934
+ sound: undefined,
935
+ image: undefined,
936
+ icon: undefined,
937
+ receiver: undefined,
938
+ objectId: undefined,
939
+ objectType: 0,
940
+ timestamp: undefined,
941
+ data: {},
942
+ };
943
+ }
944
+ exports.Notify = {
945
+ encode(message, writer = new wire_1.BinaryWriter()) {
946
+ if (message.title !== "") {
947
+ writer.uint32(10).string(message.title);
948
+ }
949
+ if (message.body !== "") {
950
+ writer.uint32(18).string(message.body);
951
+ }
952
+ if (message.sound !== undefined) {
953
+ writer.uint32(24).uint64(message.sound);
954
+ }
955
+ if (message.image !== undefined) {
956
+ writer.uint32(34).string(message.image);
957
+ }
958
+ if (message.icon !== undefined) {
959
+ writer.uint32(42).string(message.icon);
960
+ }
961
+ if (message.receiver !== undefined) {
962
+ exports.Receiver.encode(message.receiver, writer.uint32(50).fork()).join();
963
+ }
964
+ if (message.objectId !== undefined) {
965
+ writer.uint32(56).uint64(message.objectId);
966
+ }
967
+ if (message.objectType !== 0) {
968
+ writer.uint32(64).int32(message.objectType);
969
+ }
970
+ if (message.timestamp !== undefined) {
971
+ timestamp_1.Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(74).fork()).join();
972
+ }
973
+ Object.entries(message.data).forEach(([key, value]) => {
974
+ exports.Notify_DataEntry.encode({ key: key, value }, writer.uint32(82).fork()).join();
975
+ });
976
+ return writer;
977
+ },
978
+ decode(input, length) {
979
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
980
+ let end = length === undefined ? reader.len : reader.pos + length;
981
+ const message = createBaseNotify();
982
+ while (reader.pos < end) {
983
+ const tag = reader.uint32();
984
+ switch (tag >>> 3) {
985
+ case 1: {
986
+ if (tag !== 10) {
987
+ break;
988
+ }
989
+ message.title = reader.string();
990
+ continue;
991
+ }
992
+ case 2: {
993
+ if (tag !== 18) {
994
+ break;
995
+ }
996
+ message.body = reader.string();
997
+ continue;
998
+ }
999
+ case 3: {
1000
+ if (tag !== 24) {
1001
+ break;
1002
+ }
1003
+ message.sound = longToNumber(reader.uint64());
1004
+ continue;
1005
+ }
1006
+ case 4: {
1007
+ if (tag !== 34) {
1008
+ break;
1009
+ }
1010
+ message.image = reader.string();
1011
+ continue;
1012
+ }
1013
+ case 5: {
1014
+ if (tag !== 42) {
1015
+ break;
1016
+ }
1017
+ message.icon = reader.string();
1018
+ continue;
1019
+ }
1020
+ case 6: {
1021
+ if (tag !== 50) {
1022
+ break;
1023
+ }
1024
+ message.receiver = exports.Receiver.decode(reader, reader.uint32());
1025
+ continue;
1026
+ }
1027
+ case 7: {
1028
+ if (tag !== 56) {
1029
+ break;
1030
+ }
1031
+ message.objectId = longToNumber(reader.uint64());
1032
+ continue;
1033
+ }
1034
+ case 8: {
1035
+ if (tag !== 64) {
1036
+ break;
1037
+ }
1038
+ message.objectType = reader.int32();
1039
+ continue;
1040
+ }
1041
+ case 9: {
1042
+ if (tag !== 74) {
1043
+ break;
1044
+ }
1045
+ message.timestamp = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
1046
+ continue;
1047
+ }
1048
+ case 10: {
1049
+ if (tag !== 82) {
1050
+ break;
1051
+ }
1052
+ const entry10 = exports.Notify_DataEntry.decode(reader, reader.uint32());
1053
+ if (entry10.value !== undefined) {
1054
+ message.data[entry10.key] = entry10.value;
1055
+ }
1056
+ continue;
1057
+ }
1058
+ }
1059
+ if ((tag & 7) === 4 || tag === 0) {
1060
+ break;
1061
+ }
1062
+ reader.skip(tag & 7);
1063
+ }
1064
+ return message;
1065
+ },
1066
+ fromJSON(object) {
1067
+ return {
1068
+ title: isSet(object.title) ? globalThis.String(object.title) : "",
1069
+ body: isSet(object.body) ? globalThis.String(object.body) : "",
1070
+ sound: isSet(object.sound) ? globalThis.Number(object.sound) : undefined,
1071
+ image: isSet(object.image) ? globalThis.String(object.image) : undefined,
1072
+ icon: isSet(object.icon) ? globalThis.String(object.icon) : undefined,
1073
+ receiver: isSet(object.receiver) ? exports.Receiver.fromJSON(object.receiver) : undefined,
1074
+ objectId: isSet(object.object_id) ? globalThis.Number(object.object_id) : undefined,
1075
+ objectType: isSet(object.object_type) ? objectTypeFromJSON(object.object_type) : 0,
1076
+ timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
1077
+ data: isObject(object.data)
1078
+ ? Object.entries(object.data).reduce((acc, [key, value]) => {
1079
+ acc[key] = String(value);
1080
+ return acc;
1081
+ }, {})
1082
+ : {},
1083
+ };
1084
+ },
1085
+ toJSON(message) {
1086
+ const obj = {};
1087
+ if (message.title !== "") {
1088
+ obj.title = message.title;
1089
+ }
1090
+ if (message.body !== "") {
1091
+ obj.body = message.body;
1092
+ }
1093
+ if (message.sound !== undefined) {
1094
+ obj.sound = Math.round(message.sound);
1095
+ }
1096
+ if (message.image !== undefined) {
1097
+ obj.image = message.image;
1098
+ }
1099
+ if (message.icon !== undefined) {
1100
+ obj.icon = message.icon;
1101
+ }
1102
+ if (message.receiver !== undefined) {
1103
+ obj.receiver = exports.Receiver.toJSON(message.receiver);
1104
+ }
1105
+ if (message.objectId !== undefined) {
1106
+ obj.object_id = Math.round(message.objectId);
1107
+ }
1108
+ if (message.objectType !== 0) {
1109
+ obj.object_type = objectTypeToJSON(message.objectType);
1110
+ }
1111
+ if (message.timestamp !== undefined) {
1112
+ obj.timestamp = message.timestamp.toISOString();
1113
+ }
1114
+ if (message.data) {
1115
+ const entries = Object.entries(message.data);
1116
+ if (entries.length > 0) {
1117
+ obj.data = {};
1118
+ entries.forEach(([k, v]) => {
1119
+ obj.data[k] = v;
1120
+ });
1121
+ }
1122
+ }
1123
+ return obj;
1124
+ },
1125
+ create(base) {
1126
+ return exports.Notify.fromPartial(base !== null && base !== void 0 ? base : {});
1127
+ },
1128
+ fromPartial(object) {
1129
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1130
+ const message = createBaseNotify();
1131
+ message.title = (_a = object.title) !== null && _a !== void 0 ? _a : "";
1132
+ message.body = (_b = object.body) !== null && _b !== void 0 ? _b : "";
1133
+ message.sound = (_c = object.sound) !== null && _c !== void 0 ? _c : undefined;
1134
+ message.image = (_d = object.image) !== null && _d !== void 0 ? _d : undefined;
1135
+ message.icon = (_e = object.icon) !== null && _e !== void 0 ? _e : undefined;
1136
+ message.receiver = (object.receiver !== undefined && object.receiver !== null)
1137
+ ? exports.Receiver.fromPartial(object.receiver)
1138
+ : undefined;
1139
+ message.objectId = (_f = object.objectId) !== null && _f !== void 0 ? _f : undefined;
1140
+ message.objectType = (_g = object.objectType) !== null && _g !== void 0 ? _g : 0;
1141
+ message.timestamp = (_h = object.timestamp) !== null && _h !== void 0 ? _h : undefined;
1142
+ message.data = Object.entries((_j = object.data) !== null && _j !== void 0 ? _j : {}).reduce((acc, [key, value]) => {
1143
+ if (value !== undefined) {
1144
+ acc[key] = globalThis.String(value);
1145
+ }
1146
+ return acc;
1147
+ }, {});
1148
+ return message;
1149
+ },
1150
+ };
1151
+ function createBaseNotify_DataEntry() {
1152
+ return { key: "", value: "" };
1153
+ }
1154
+ exports.Notify_DataEntry = {
1155
+ encode(message, writer = new wire_1.BinaryWriter()) {
1156
+ if (message.key !== "") {
1157
+ writer.uint32(10).string(message.key);
1158
+ }
1159
+ if (message.value !== "") {
1160
+ writer.uint32(18).string(message.value);
1161
+ }
1162
+ return writer;
1163
+ },
1164
+ decode(input, length) {
1165
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1166
+ let end = length === undefined ? reader.len : reader.pos + length;
1167
+ const message = createBaseNotify_DataEntry();
1168
+ while (reader.pos < end) {
1169
+ const tag = reader.uint32();
1170
+ switch (tag >>> 3) {
1171
+ case 1: {
1172
+ if (tag !== 10) {
1173
+ break;
1174
+ }
1175
+ message.key = reader.string();
1176
+ continue;
1177
+ }
1178
+ case 2: {
1179
+ if (tag !== 18) {
1180
+ break;
1181
+ }
1182
+ message.value = reader.string();
1183
+ continue;
1184
+ }
1185
+ }
1186
+ if ((tag & 7) === 4 || tag === 0) {
1187
+ break;
1188
+ }
1189
+ reader.skip(tag & 7);
1190
+ }
1191
+ return message;
1192
+ },
1193
+ fromJSON(object) {
1194
+ return {
1195
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
1196
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
1197
+ };
1198
+ },
1199
+ toJSON(message) {
1200
+ const obj = {};
1201
+ if (message.key !== "") {
1202
+ obj.key = message.key;
1203
+ }
1204
+ if (message.value !== "") {
1205
+ obj.value = message.value;
1206
+ }
1207
+ return obj;
1208
+ },
1209
+ create(base) {
1210
+ return exports.Notify_DataEntry.fromPartial(base !== null && base !== void 0 ? base : {});
1211
+ },
1212
+ fromPartial(object) {
1213
+ var _a, _b;
1214
+ const message = createBaseNotify_DataEntry();
1215
+ message.key = (_a = object.key) !== null && _a !== void 0 ? _a : "";
1216
+ message.value = (_b = object.value) !== null && _b !== void 0 ? _b : "";
1217
+ return message;
1218
+ },
1219
+ };
1220
+ function createBaseNotification() {
1221
+ return {
1222
+ uuid: "",
1223
+ userId: 0,
1224
+ objectId: undefined,
1225
+ objectType: 0,
1226
+ title: "",
1227
+ body: undefined,
1228
+ alertId: 0,
1229
+ alertType: 0,
1230
+ via: [],
1231
+ data: {},
1232
+ image: undefined,
1233
+ icon: undefined,
1234
+ sound: undefined,
1235
+ createdAt: undefined,
1236
+ readAt: undefined,
1237
+ };
1238
+ }
1239
+ exports.Notification = {
1240
+ encode(message, writer = new wire_1.BinaryWriter()) {
1241
+ if (message.uuid !== "") {
1242
+ writer.uint32(10).string(message.uuid);
1243
+ }
1244
+ if (message.userId !== 0) {
1245
+ writer.uint32(16).uint64(message.userId);
1246
+ }
1247
+ if (message.objectId !== undefined) {
1248
+ writer.uint32(24).uint64(message.objectId);
1249
+ }
1250
+ if (message.objectType !== 0) {
1251
+ writer.uint32(32).int32(message.objectType);
1252
+ }
1253
+ if (message.title !== "") {
1254
+ writer.uint32(42).string(message.title);
1255
+ }
1256
+ if (message.body !== undefined) {
1257
+ writer.uint32(50).string(message.body);
1258
+ }
1259
+ if (message.alertId !== 0) {
1260
+ writer.uint32(56).uint64(message.alertId);
1261
+ }
1262
+ if (message.alertType !== 0) {
1263
+ writer.uint32(64).int32(message.alertType);
1264
+ }
1265
+ writer.uint32(74).fork();
1266
+ for (const v of message.via) {
1267
+ writer.int32(v);
1268
+ }
1269
+ writer.join();
1270
+ Object.entries(message.data).forEach(([key, value]) => {
1271
+ exports.Notification_DataEntry.encode({ key: key, value }, writer.uint32(82).fork()).join();
1272
+ });
1273
+ if (message.image !== undefined) {
1274
+ writer.uint32(90).string(message.image);
1275
+ }
1276
+ if (message.icon !== undefined) {
1277
+ writer.uint32(98).string(message.icon);
1278
+ }
1279
+ if (message.sound !== undefined) {
1280
+ writer.uint32(104).uint64(message.sound);
1281
+ }
1282
+ if (message.createdAt !== undefined) {
1283
+ timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(114).fork()).join();
1284
+ }
1285
+ if (message.readAt !== undefined) {
1286
+ timestamp_1.Timestamp.encode(toTimestamp(message.readAt), writer.uint32(122).fork()).join();
1287
+ }
1288
+ return writer;
1289
+ },
1290
+ decode(input, length) {
1291
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1292
+ let end = length === undefined ? reader.len : reader.pos + length;
1293
+ const message = createBaseNotification();
1294
+ while (reader.pos < end) {
1295
+ const tag = reader.uint32();
1296
+ switch (tag >>> 3) {
1297
+ case 1: {
1298
+ if (tag !== 10) {
1299
+ break;
1300
+ }
1301
+ message.uuid = reader.string();
1302
+ continue;
1303
+ }
1304
+ case 2: {
1305
+ if (tag !== 16) {
1306
+ break;
1307
+ }
1308
+ message.userId = longToNumber(reader.uint64());
1309
+ continue;
1310
+ }
1311
+ case 3: {
1312
+ if (tag !== 24) {
1313
+ break;
1314
+ }
1315
+ message.objectId = longToNumber(reader.uint64());
1316
+ continue;
1317
+ }
1318
+ case 4: {
1319
+ if (tag !== 32) {
1320
+ break;
1321
+ }
1322
+ message.objectType = reader.int32();
1323
+ continue;
1324
+ }
1325
+ case 5: {
1326
+ if (tag !== 42) {
1327
+ break;
1328
+ }
1329
+ message.title = reader.string();
1330
+ continue;
1331
+ }
1332
+ case 6: {
1333
+ if (tag !== 50) {
1334
+ break;
1335
+ }
1336
+ message.body = reader.string();
1337
+ continue;
1338
+ }
1339
+ case 7: {
1340
+ if (tag !== 56) {
1341
+ break;
1342
+ }
1343
+ message.alertId = longToNumber(reader.uint64());
1344
+ continue;
1345
+ }
1346
+ case 8: {
1347
+ if (tag !== 64) {
1348
+ break;
1349
+ }
1350
+ message.alertType = reader.int32();
1351
+ continue;
1352
+ }
1353
+ case 9: {
1354
+ if (tag === 72) {
1355
+ message.via.push(reader.int32());
1356
+ continue;
1357
+ }
1358
+ if (tag === 74) {
1359
+ const end2 = reader.uint32() + reader.pos;
1360
+ while (reader.pos < end2) {
1361
+ message.via.push(reader.int32());
1362
+ }
1363
+ continue;
1364
+ }
1365
+ break;
1366
+ }
1367
+ case 10: {
1368
+ if (tag !== 82) {
1369
+ break;
1370
+ }
1371
+ const entry10 = exports.Notification_DataEntry.decode(reader, reader.uint32());
1372
+ if (entry10.value !== undefined) {
1373
+ message.data[entry10.key] = entry10.value;
1374
+ }
1375
+ continue;
1376
+ }
1377
+ case 11: {
1378
+ if (tag !== 90) {
1379
+ break;
1380
+ }
1381
+ message.image = reader.string();
1382
+ continue;
1383
+ }
1384
+ case 12: {
1385
+ if (tag !== 98) {
1386
+ break;
1387
+ }
1388
+ message.icon = reader.string();
1389
+ continue;
1390
+ }
1391
+ case 13: {
1392
+ if (tag !== 104) {
1393
+ break;
1394
+ }
1395
+ message.sound = longToNumber(reader.uint64());
1396
+ continue;
1397
+ }
1398
+ case 14: {
1399
+ if (tag !== 114) {
1400
+ break;
1401
+ }
1402
+ message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
1403
+ continue;
1404
+ }
1405
+ case 15: {
1406
+ if (tag !== 122) {
1407
+ break;
1408
+ }
1409
+ message.readAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
1410
+ continue;
1411
+ }
1412
+ }
1413
+ if ((tag & 7) === 4 || tag === 0) {
1414
+ break;
1415
+ }
1416
+ reader.skip(tag & 7);
1417
+ }
1418
+ return message;
1419
+ },
1420
+ fromJSON(object) {
1421
+ return {
1422
+ uuid: isSet(object.uuid) ? globalThis.String(object.uuid) : "",
1423
+ userId: isSet(object.user_id) ? globalThis.Number(object.user_id) : 0,
1424
+ objectId: isSet(object.object_id) ? globalThis.Number(object.object_id) : undefined,
1425
+ objectType: isSet(object.object_type) ? objectTypeFromJSON(object.object_type) : 0,
1426
+ title: isSet(object.title) ? globalThis.String(object.title) : "",
1427
+ body: isSet(object.body) ? globalThis.String(object.body) : undefined,
1428
+ alertId: isSet(object.alert_id) ? globalThis.Number(object.alert_id) : 0,
1429
+ alertType: isSet(object.alert_type) ? globalThis.Number(object.alert_type) : 0,
1430
+ via: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.via) ? object.via.map((e) => viaFromJSON(e)) : [],
1431
+ data: isObject(object.data)
1432
+ ? Object.entries(object.data).reduce((acc, [key, value]) => {
1433
+ acc[key] = String(value);
1434
+ return acc;
1435
+ }, {})
1436
+ : {},
1437
+ image: isSet(object.image) ? globalThis.String(object.image) : undefined,
1438
+ icon: isSet(object.image) ? globalThis.String(object.image) : undefined,
1439
+ sound: isSet(object.image) ? globalThis.Number(object.image) : undefined,
1440
+ createdAt: isSet(object.created_at) ? fromJsonTimestamp(object.created_at) : undefined,
1441
+ readAt: isSet(object.read_at) ? fromJsonTimestamp(object.read_at) : undefined,
1442
+ };
1443
+ },
1444
+ toJSON(message) {
1445
+ var _a;
1446
+ const obj = {};
1447
+ if (message.uuid !== "") {
1448
+ obj.uuid = message.uuid;
1449
+ }
1450
+ if (message.userId !== 0) {
1451
+ obj.user_id = Math.round(message.userId);
1452
+ }
1453
+ if (message.objectId !== undefined) {
1454
+ obj.object_id = Math.round(message.objectId);
1455
+ }
1456
+ if (message.objectType !== 0) {
1457
+ obj.object_type = objectTypeToJSON(message.objectType);
1458
+ }
1459
+ if (message.title !== "") {
1460
+ obj.title = message.title;
1461
+ }
1462
+ if (message.body !== undefined) {
1463
+ obj.body = message.body;
1464
+ }
1465
+ if (message.alertId !== 0) {
1466
+ obj.alert_id = Math.round(message.alertId);
1467
+ }
1468
+ if (message.alertType !== 0) {
1469
+ obj.alert_type = Math.round(message.alertType);
1470
+ }
1471
+ if ((_a = message.via) === null || _a === void 0 ? void 0 : _a.length) {
1472
+ obj.via = message.via.map((e) => viaToJSON(e));
1473
+ }
1474
+ if (message.data) {
1475
+ const entries = Object.entries(message.data);
1476
+ if (entries.length > 0) {
1477
+ obj.data = {};
1478
+ entries.forEach(([k, v]) => {
1479
+ obj.data[k] = v;
1480
+ });
1481
+ }
1482
+ }
1483
+ if (message.image !== undefined) {
1484
+ obj.image = message.image;
1485
+ }
1486
+ if (message.icon !== undefined) {
1487
+ obj.image = message.icon;
1488
+ }
1489
+ if (message.sound !== undefined) {
1490
+ obj.image = Math.round(message.sound);
1491
+ }
1492
+ if (message.createdAt !== undefined) {
1493
+ obj.created_at = message.createdAt.toISOString();
1494
+ }
1495
+ if (message.readAt !== undefined) {
1496
+ obj.read_at = message.readAt.toISOString();
1497
+ }
1498
+ return obj;
1499
+ },
1500
+ create(base) {
1501
+ return exports.Notification.fromPartial(base !== null && base !== void 0 ? base : {});
1502
+ },
1503
+ fromPartial(object) {
1504
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
1505
+ const message = createBaseNotification();
1506
+ message.uuid = (_a = object.uuid) !== null && _a !== void 0 ? _a : "";
1507
+ message.userId = (_b = object.userId) !== null && _b !== void 0 ? _b : 0;
1508
+ message.objectId = (_c = object.objectId) !== null && _c !== void 0 ? _c : undefined;
1509
+ message.objectType = (_d = object.objectType) !== null && _d !== void 0 ? _d : 0;
1510
+ message.title = (_e = object.title) !== null && _e !== void 0 ? _e : "";
1511
+ message.body = (_f = object.body) !== null && _f !== void 0 ? _f : undefined;
1512
+ message.alertId = (_g = object.alertId) !== null && _g !== void 0 ? _g : 0;
1513
+ message.alertType = (_h = object.alertType) !== null && _h !== void 0 ? _h : 0;
1514
+ message.via = ((_j = object.via) === null || _j === void 0 ? void 0 : _j.map((e) => e)) || [];
1515
+ message.data = Object.entries((_k = object.data) !== null && _k !== void 0 ? _k : {}).reduce((acc, [key, value]) => {
1516
+ if (value !== undefined) {
1517
+ acc[key] = globalThis.String(value);
1518
+ }
1519
+ return acc;
1520
+ }, {});
1521
+ message.image = (_l = object.image) !== null && _l !== void 0 ? _l : undefined;
1522
+ message.icon = (_m = object.icon) !== null && _m !== void 0 ? _m : undefined;
1523
+ message.sound = (_o = object.sound) !== null && _o !== void 0 ? _o : undefined;
1524
+ message.createdAt = (_p = object.createdAt) !== null && _p !== void 0 ? _p : undefined;
1525
+ message.readAt = (_q = object.readAt) !== null && _q !== void 0 ? _q : undefined;
1526
+ return message;
1527
+ },
1528
+ };
1529
+ function createBaseNotification_DataEntry() {
1530
+ return { key: "", value: "" };
1531
+ }
1532
+ exports.Notification_DataEntry = {
1533
+ encode(message, writer = new wire_1.BinaryWriter()) {
1534
+ if (message.key !== "") {
1535
+ writer.uint32(10).string(message.key);
1536
+ }
1537
+ if (message.value !== "") {
1538
+ writer.uint32(18).string(message.value);
1539
+ }
1540
+ return writer;
1541
+ },
1542
+ decode(input, length) {
1543
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1544
+ let end = length === undefined ? reader.len : reader.pos + length;
1545
+ const message = createBaseNotification_DataEntry();
1546
+ while (reader.pos < end) {
1547
+ const tag = reader.uint32();
1548
+ switch (tag >>> 3) {
1549
+ case 1: {
1550
+ if (tag !== 10) {
1551
+ break;
1552
+ }
1553
+ message.key = reader.string();
1554
+ continue;
1555
+ }
1556
+ case 2: {
1557
+ if (tag !== 18) {
1558
+ break;
1559
+ }
1560
+ message.value = reader.string();
1561
+ continue;
1562
+ }
1563
+ }
1564
+ if ((tag & 7) === 4 || tag === 0) {
1565
+ break;
1566
+ }
1567
+ reader.skip(tag & 7);
1568
+ }
1569
+ return message;
1570
+ },
1571
+ fromJSON(object) {
1572
+ return {
1573
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
1574
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
1575
+ };
1576
+ },
1577
+ toJSON(message) {
1578
+ const obj = {};
1579
+ if (message.key !== "") {
1580
+ obj.key = message.key;
1581
+ }
1582
+ if (message.value !== "") {
1583
+ obj.value = message.value;
1584
+ }
1585
+ return obj;
1586
+ },
1587
+ create(base) {
1588
+ return exports.Notification_DataEntry.fromPartial(base !== null && base !== void 0 ? base : {});
1589
+ },
1590
+ fromPartial(object) {
1591
+ var _a, _b;
1592
+ const message = createBaseNotification_DataEntry();
1593
+ message.key = (_a = object.key) !== null && _a !== void 0 ? _a : "";
1594
+ message.value = (_b = object.value) !== null && _b !== void 0 ? _b : "";
1595
+ return message;
1596
+ },
1597
+ };
1598
+ function toTimestamp(date) {
1599
+ const seconds = Math.trunc(date.getTime() / 1000);
1600
+ const nanos = (date.getTime() % 1000) * 1000000;
1601
+ return { seconds, nanos };
1602
+ }
1603
+ function fromTimestamp(t) {
1604
+ let millis = (t.seconds || 0) * 1000;
1605
+ millis += (t.nanos || 0) / 1000000;
1606
+ return new globalThis.Date(millis);
1607
+ }
1608
+ function fromJsonTimestamp(o) {
1609
+ if (o instanceof globalThis.Date) {
1610
+ return o;
1611
+ }
1612
+ else if (typeof o === "string") {
1613
+ return new globalThis.Date(o);
1614
+ }
1615
+ else {
1616
+ return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
1617
+ }
1618
+ }
1619
+ function longToNumber(int64) {
1620
+ const num = globalThis.Number(int64.toString());
1621
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
1622
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
1623
+ }
1624
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
1625
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
1626
+ }
1627
+ return num;
1628
+ }
1629
+ function isObject(value) {
1630
+ return typeof value === "object" && value !== null;
1631
+ }
1632
+ function isSet(value) {
1633
+ return value !== null && value !== undefined;
1634
+ }