@regulaforensics/react-native-document-reader-api 9.11.946-rc → 9.11.947-rc

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,1965 @@
1
+ import DocumentReader
2
+ import UIKit
3
+
4
+ // MARK: - TransactionInfo
5
+
6
+ public extension RGLTransactionInfo {
7
+ static func decode(_ it: Any?) -> Self? {
8
+ guard let it = it as? [String: Any] else { return nil }
9
+ let result = Self.emptyInit() as Self
10
+ result.setValue(it["transactionId"] as? String, forKey: "transactionId")
11
+ result.setValue(it["tag"] as? String, forKey: "tag")
12
+ result.setValue(it["sessionLogFolder"] as? String, forKey: "sessionLogFolder")
13
+ return result
14
+ }
15
+ func encode() -> [String: Any?] {
16
+ return [
17
+ "transactionId": self.transactionId,
18
+ "tag": self.tag,
19
+ "sessionLogFolder": self.sessionLogFolder,
20
+ ]
21
+ }
22
+ }
23
+
24
+ // MARK: - RFID
25
+
26
+ public extension TCCParams {
27
+ static func decode(_ it: Any?) -> Self? {
28
+ guard let it = it as? [String: Any] else { return nil }
29
+ return Self(serviceTAURLString: it["serviceUrlTA"] as? String,
30
+ servicePAURLString: it["serviceUrlPA"] as? String,
31
+ pfxCertURLString: it["pfxCertUrl"] as? String,
32
+ pfxCertData: Data.decode(it["pfxCert"]),
33
+ pfxPassPhrase: it["pfxPassPhrase"] as? String)
34
+ }
35
+ func encode() -> [String: Any?] {
36
+ return [
37
+ "serviceUrlTA": self.serviceTAURLString,
38
+ "serviceUrlPA": self.servicePAURLString,
39
+ "pfxCertUrl": self.pfxCertURLString,
40
+ "pfxPassPhrase": self.pfxPassPhrase,
41
+ "pfxCert": self.pfxCertData?.encode(),
42
+ ]
43
+ }
44
+ }
45
+
46
+ // MARK: - Init
47
+
48
+ public extension DocReader.BaseReaderConfig {
49
+ @discardableResult
50
+ func update(_ it: [String: Any]) -> Self {
51
+ if let prop = it["databasePath"] as? String { self.databasePath = prop }
52
+ if let prop = it["licenseUpdateTimeout"] as? NSNumber { self.licenseUpdateTimeout = prop }
53
+ if let prop = it["licenseUpdate"] as? Bool { self.licenseUpdateCheck = prop }
54
+ if let prop = it["delayedNNLoad"] as? Bool { self.isDelayedNNLoadEnabled = prop }
55
+ return self
56
+ }
57
+ }
58
+
59
+ public extension DocReader.Config {
60
+ static func decode(_ it: Any?) -> Self? {
61
+ guard let it = it as? [String: Any] else { return nil }
62
+ guard let license = Data.decode(it["license"]) else { return nil }
63
+ return Self(license: license).update(it)
64
+ }
65
+ func encode() -> [String: Any?] {
66
+ return [
67
+ "license": self.licenseData.encode(),
68
+ "databasePath": self.databasePath,
69
+ "licenseUpdateTimeout": self.licenseUpdateTimeout,
70
+ "licenseUpdate": self.licenseUpdateCheck,
71
+ "delayedNNLoad": self.isDelayedNNLoadEnabled,
72
+ ]
73
+ }
74
+ }
75
+
76
+ // MARK: - Scanner
77
+
78
+ public extension DocReader.ScannerConfig {
79
+ static func decode(_ it: Any?) -> Self? {
80
+ guard let it = it as? [String: Any] else { return nil }
81
+ let result: Self
82
+ if let scenario = it["scenario"] as? String {
83
+ result = Self(scenario: scenario)
84
+ if let prop = it["onlineProcessingConfig"] { result.onlineProcessingConfig = DocReader.OnlineProcessingConfig.decode(prop) }
85
+ } else {
86
+ result = Self(onlineProcessingConfig: DocReader.OnlineProcessingConfig.decode(it["onlineProcessingConfig"])!)
87
+ }
88
+ if let prop = it["livePortrait"] { result.livePortrait = UIImage.decode(prop) }
89
+ if let prop = it["extPortrait"] { result.extPortrait = UIImage.decode(prop) }
90
+ return result
91
+ }
92
+ func encode() -> [String: Any?] {
93
+ return [
94
+ "scenario": self.scenario,
95
+ "onlineProcessingConfig": self.onlineProcessingConfig?.encode(),
96
+ "livePortrait": self.livePortrait?.encode(),
97
+ "extPortrait": self.extPortrait?.encode(),
98
+ ]
99
+ }
100
+ }
101
+
102
+ public extension DocReader.RecognizeConfig {
103
+ static func decode(_ it: Any?) -> Self? {
104
+ guard let it = it as? [String: Any] else { return nil }
105
+ let result: Self
106
+ if let scenario = it["scenario"] as? String {
107
+ result = Self(scenario: scenario)
108
+ if let prop = it["onlineProcessingConfig"] { result.onlineProcessingConfig = DocReader.OnlineProcessingConfig.decode(prop) }
109
+ } else {
110
+ result = Self(onlineProcessingConfig: DocReader.OnlineProcessingConfig.decode(it["onlineProcessingConfig"])!)
111
+ }
112
+ if let prop = it["livePortrait"] { result.livePortrait = UIImage.decode(prop) }
113
+ if let prop = it["extPortrait"] { result.extPortrait = UIImage.decode(prop) }
114
+ if let prop = it["oneShotIdentification"] as? Bool { result.oneShotIdentification = prop }
115
+ if let prop = it["dtc"] { result.dtc = Data.decode(prop) }
116
+ if let prop = it["image"] { result.image = UIImage.decode(prop) }
117
+ if let prop = it["data"] { result.imageData = Data.decode(prop) }
118
+ if let prop = it["images"] { result.images = (prop as? [Any])?.compactMap(UIImage.decode) }
119
+ if let prop = it["dataList"] { result.imageDataArray = (prop as? [Any])?.compactMap(Data.decode) }
120
+ if let prop = it["imageInputData"] { result.imageInputs = (prop as? [Any])?.compactMap(DocReader.ImageInput.decode) }
121
+ return result
122
+ }
123
+ func encode() -> [String: Any?] {
124
+ return [
125
+ "scenario": self.scenario,
126
+ "onlineProcessingConfig": self.onlineProcessingConfig?.encode(),
127
+ "livePortrait": self.livePortrait?.encode(),
128
+ "extPortrait": self.extPortrait?.encode(),
129
+ "oneShotIdentification": self.oneShotIdentification,
130
+ "dtc": self.dtc?.encode(),
131
+ "image": self.image?.encode(),
132
+ "data": self.imageData?.encode(),
133
+ "images": self.images?.map { $0.encode() },
134
+ "dataList": self.imageDataArray?.map { $0.encode() },
135
+ "imageInputData": self.imageInputs?.map { $0.encode() },
136
+ ]
137
+ }
138
+ }
139
+
140
+ // MARK: - Processing
141
+
142
+ public extension RGLBackendProcessingConfig {
143
+ static func decode(_ it: Any?) -> Self? {
144
+ guard let it = it as? [String: Any] else { return nil }
145
+ let result = Self()
146
+ if let prop = it["url"] as? String { result.url = prop }
147
+ if let prop = it["httpHeaders"] { result.httpHeaders = prop as? [AnyHashable: Any] }
148
+ if let prop = it["rfidServerSideChipVerification"] as? NSNumber { result.rfidServerSideChipVerification = prop }
149
+ if let prop = it["mdlVerification"] as? NSNumber { result.mDLVerification = prop }
150
+ if let prop = it["timeoutConnection"] as? NSNumber { result.timeoutConnection = prop }
151
+ return result
152
+ }
153
+ func encode() -> [String: Any?] {
154
+ return [
155
+ "url": self.url,
156
+ "httpHeaders": self.httpHeaders,
157
+ "rfidServerSideChipVerification": self.rfidServerSideChipVerification,
158
+ "mdlVerification": self.mDLVerification,
159
+ "timeoutConnection": self.timeoutConnection,
160
+ ]
161
+ }
162
+ }
163
+
164
+ public extension DocReader.Bsi {
165
+ static func decode(_ it: Any?) -> Self? {
166
+ guard let it = it as? [String: Any] else { return nil }
167
+ let result = Self()
168
+ if let prop = it["generateResult"] as? NSNumber { result.generateResult = prop }
169
+ return result
170
+ }
171
+ func encode() -> [String: Any?] {
172
+ return [
173
+ "generateResult": self.generateResult,
174
+ ]
175
+ }
176
+ }
177
+
178
+ public extension DocReader.OnlineProcessingConfig {
179
+ static func decode(_ it: Any?) -> Self? {
180
+ guard let it = it as? [String: Any] else { return nil }
181
+ let result = Self(mode: DocReader.OnlineProcessingMode(rawValue: it["mode"] as! Int)!)
182
+ if let prop = it["url"] as? String { result.serviceURL = prop }
183
+ if let prop = it["processParams"] { result.processParams = ProcessParams.decode(prop) }
184
+ if let prop = it["imageFormat"] { result.imageFormat = DocReader.OnlineProcessingImageFormat(rawValue: prop as! Int)! }
185
+ if let prop = it["imageCompressionQuality"] { result.imageCompressionQuality = prop as! CGFloat }
186
+ if let prop = it["requestHeaders"] as? [String: String] {
187
+ let delegate = IURLRequestInterceptingDelegate(prop)
188
+ result.requestInterceptingDelegate = delegate
189
+ objc_setAssociatedObject(result, &headersDelegateKey, delegate, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
190
+ }
191
+ return result
192
+ }
193
+ func encode() -> [String: Any?] {
194
+ return [
195
+ "mode": self.mode.rawValue,
196
+ "url": self.serviceURL,
197
+ "processParams": self.processParams?.encode(),
198
+ "imageFormat": self.imageFormat.rawValue,
199
+ "imageCompressionQuality": self.imageCompressionQuality,
200
+ ]
201
+ }
202
+ }
203
+
204
+ public extension ImageQA.GlaresCheckParams {
205
+ static func decode(_ it: Any?) -> Self? {
206
+ guard let it = it as? [String: Any] else { return nil }
207
+ let result = Self()
208
+ if let prop = it["imgMarginPart"] as? NSNumber { result.imgMarginPart = prop }
209
+ if let prop = it["maxGlaringPart"] as? NSNumber { result.maxGlaringPart = prop }
210
+ return result
211
+ }
212
+ func encode() -> [String: Any?] {
213
+ return [
214
+ "imgMarginPart": self.imgMarginPart,
215
+ "maxGlaringPart": self.maxGlaringPart,
216
+ ]
217
+ }
218
+ }
219
+
220
+ public extension ImageQA.OcclusionCheckParams {
221
+ static func decode(_ it: Any?) -> Self? {
222
+ guard let it = it as? [String: Any] else { return nil }
223
+ let result = Self()
224
+ if let prop = it["maxOcclusionPart"] as? NSNumber { result.maxOcclusionPart = prop }
225
+ return result
226
+ }
227
+ func encode() -> [String: Any?] {
228
+ return [
229
+ "maxOcclusionPart": self.maxOcclusionPart,
230
+ ]
231
+ }
232
+ }
233
+
234
+ public extension DocReader.ImageInput {
235
+ static func decode(_ it: Any?) -> Self? {
236
+ guard let it = it as? [String: Any] else { return nil }
237
+ guard let image = UIImage.decode(it["image"]) else { return nil }
238
+ return Self(image: image,
239
+ light: GraphicFieldLight(rawValue: it["light"] as? Int ?? 6)!,
240
+ pageIndex: it["pageIndex"] as? Int ?? 0)
241
+ }
242
+ func encode() -> [String: Any?] {
243
+ return [
244
+ "pageIndex": self.pageIndex,
245
+ "light": self.lightType.rawValue,
246
+ "image": self.image.encode(),
247
+ ]
248
+ }
249
+ }
250
+
251
+ public extension PKDCertificate {
252
+ static func decode(_ it: Any?) -> Self? {
253
+ guard let it = it as? [String: Any] else { return nil }
254
+ return Self(binaryData: Data.decode(it["binaryData"])!,
255
+ resourceType: PKDResourceType(rawValue: it["resourceType"] as? Int ?? 0)!,
256
+ privateKey: Data.decode(it["privateKey"]))
257
+ }
258
+ func encode() -> [String: Any?] {
259
+ return [
260
+ "resourceType": self.resourceType.rawValue,
261
+ "binaryData": self.binaryData.encode(),
262
+ "privateKey": self.privateKey?.encode(),
263
+ ]
264
+ }
265
+ }
266
+
267
+ public extension RFIDParams {
268
+ static func decode(_ it: Any?) -> Self? {
269
+ guard let it = it as? [String: Any] else { return nil }
270
+ let result = Self()
271
+ if let prop = it["paIgnoreNotificationCodes"] as? [NSNumber] { result.paIgnoreNotificationCodes = prop }
272
+ return result
273
+ }
274
+ func encode() -> [String: Any?] {
275
+ return [
276
+ "paIgnoreNotificationCodes": self.paIgnoreNotificationCodes,
277
+ ]
278
+ }
279
+ }
280
+
281
+ public extension FaceAPIParams {
282
+ static func decode(_ it: Any?) -> Self? {
283
+ guard let it = it as? [String: Any] else { return nil }
284
+ let result = Self.default()
285
+ if let prop = it["url"] as? String { result.url = prop }
286
+ if let prop = it["mode"] as? String { result.mode = prop }
287
+ if let prop = it["searchParams"] { result.searchParams = RGLFaceAPISearchParams.decode(prop) }
288
+ if let prop = it["threshold"] as? NSNumber { result.threshold = prop }
289
+ if let prop = it["serviceTimeout"] as? NSNumber { result.serviceTimeout = prop }
290
+ if let prop = it["proxy"] as? String { result.proxy = prop }
291
+ if let prop = it["proxyPassword"] as? String { result.proxyPassword = prop }
292
+ if let prop = it["proxyType"] as? NSNumber { result.proxyType = prop }
293
+ if let prop = it["livenessTransactionId"] as? String { result.livenessTransactionId = prop }
294
+ return result
295
+ }
296
+ func encode() -> [String: Any?] {
297
+ return [
298
+ "url": self.url,
299
+ "mode": self.mode,
300
+ "searchParams": self.searchParams?.encode(),
301
+ "threshold": self.threshold,
302
+ "serviceTimeout": self.serviceTimeout,
303
+ "proxy": self.proxy,
304
+ "proxyPassword": self.proxyPassword,
305
+ "proxyType": self.proxyType,
306
+ "livenessTransactionId": self.livenessTransactionId,
307
+ ]
308
+ }
309
+ }
310
+
311
+ public extension RGLFaceAPISearchParams {
312
+ static func decode(_ it: Any?) -> Self? {
313
+ guard let it = it as? [String: Any] else { return nil }
314
+ let result = Self()
315
+ if let prop = it["limit"] as? NSNumber { result.limit = prop }
316
+ if let prop = it["threshold"] as? NSNumber { result.threshold = prop }
317
+ if let prop = it["groupIds"] as? [String] { result.groupIDs = prop }
318
+ return result
319
+ }
320
+ func encode() -> [String: Any?] {
321
+ return [
322
+ "limit": self.limit,
323
+ "threshold": self.threshold,
324
+ "groupIds": self.groupIDs,
325
+ ]
326
+ }
327
+ }
328
+
329
+ // MARK: - Scenario
330
+
331
+ public extension Scenario {
332
+ static func decode(_ it: Any?) -> Self? {
333
+ guard let it = it as? [String: Any] else { return nil }
334
+ let result = Self()
335
+ result.setValue(it["name"] as? String, forKey: "identifier")
336
+ result.setValue(it["frameKWHLandscape"] as? Double, forKey: "frameKWHLandscape")
337
+ result.setValue(it["frameKWHPortrait"] as? Double, forKey: "frameKWHPortrait")
338
+ result.setValue(it["frameKWHDoublePageSpreadPortrait"] as? Double, forKey: "frameKWHDoublePageSpreadPortrait")
339
+ result.setValue(it["frameKWHDoublePageSpreadLandscape"] as? Double, forKey: "frameKWHDoublePageSpreadLandscape")
340
+ result.setValue(it["description"] as? String, forKey: "scenarioDescription")
341
+ result.setValue(it["faceExt"] as? Bool, forKey: "faceExt")
342
+ result.setValue(it["multiPageOff"] as? Bool, forKey: "multiPageOff")
343
+ result.setValue(it["seriesProcessMode"] as? Bool, forKey: "seriesProcessMode")
344
+ result.setValue(it["caption"] as? String, forKey: "caption")
345
+ result.setValue(it["uvTorch"] as? Bool, forKey: "uvTorch")
346
+ result.setValue(it["frameOrientation"] as Any?, forKey: "frameOrientation")
347
+ result.setValue(it["manualCrop"] as? Bool, forKey: "manualCrop")
348
+ return result
349
+ }
350
+ func encode() -> [String: Any?] {
351
+ return [
352
+ "name": self.identifier,
353
+ "frameKWHLandscape": self.frameKWHLandscape,
354
+ "frameKWHPortrait": self.frameKWHPortrait,
355
+ "frameKWHDoublePageSpreadPortrait": self.frameKWHDoublePageSpreadPortrait,
356
+ "frameKWHDoublePageSpreadLandscape": self.frameKWHDoublePageSpreadLandscape,
357
+ "description": self.scenarioDescription,
358
+ "faceExt": self.faceExt,
359
+ "multiPageOff": self.multiPageOff,
360
+ "seriesProcessMode": self.seriesProcessMode,
361
+ "caption": self.caption,
362
+ "uvTorch": self.uvTorch,
363
+ "frameOrientation": self.frameOrientation.rawValue,
364
+ "manualCrop": self.manualCrop,
365
+ ]
366
+ }
367
+ }
368
+
369
+ // MARK: - GraphicResult
370
+
371
+ public extension DocumentReaderGraphicField {
372
+ static func decode(_ it: Any?) -> Self? {
373
+ guard let it = it as? [String: Any] else { return nil }
374
+ let result = Self.emptyInit() as Self
375
+ result.setValue(it["sourceType"] as Any?, forKey: "sourceType")
376
+ result.setValue(it["fieldType"] as Any?, forKey: "fieldType")
377
+ result.setValue(it["fieldName"] as? String, forKey: "fieldName")
378
+ result.setValue(CGRect.decode(it["fieldRect"]), forKey: "boundRect")
379
+ result.setValue(UIImage.decode(it["value"]), forKey: "value")
380
+ result.setValue(it["light"] as Any?, forKey: "lightType")
381
+ result.setValue(it["lightName"] as? String, forKey: "lightName")
382
+ result.setValue(it["pageIndex"] as? Int, forKey: "pageIndex")
383
+ result.setValue(it["originalPageIndex"] as? Int, forKey: "originalPageIndex")
384
+ return result
385
+ }
386
+ func encode() -> [String: Any?] {
387
+ return [
388
+ "sourceType": self.sourceType.rawValue,
389
+ "fieldType": self.fieldType.rawValue,
390
+ "fieldName": self.fieldName,
391
+ "fieldRect": self.boundRect.encode(),
392
+ "value": self.value.encode(),
393
+ "light": self.lightType.rawValue,
394
+ "lightName": self.lightName,
395
+ "pageIndex": self.pageIndex,
396
+ "originalPageIndex": self.originalPageIndex,
397
+ ]
398
+ }
399
+ }
400
+
401
+ public extension DocumentReaderGraphicResult {
402
+ static func decode(_ it: Any?) -> Self? {
403
+ guard let it = it as? [String: Any] else { return nil }
404
+ let result = Self.emptyInit() as Self
405
+ result.setValue((it["fields"] as? [Any])?.compactMap(DocumentReaderGraphicField.decode), forKey: "fields")
406
+ return result
407
+ }
408
+ func encode() -> [String: Any?] {
409
+ return [
410
+ "fields": self.fields.map { $0.encode() },
411
+ ]
412
+ }
413
+ }
414
+
415
+ // MARK: - TextResult
416
+
417
+ public extension DocumentReaderValue {
418
+ static func decode(_ it: Any?) -> Self? {
419
+ guard let it = it as? [String: Any] else { return nil }
420
+ let result = Self.emptyInit() as Self
421
+ result.setValue(it["sourceType"] as Any?, forKey: "sourceType")
422
+ result.setValue(it["value"] as? String, forKey: "value")
423
+ result.setValue(it["originalValue"] as? String, forKey: "originalValue")
424
+ result.setValue(CGRect.decode(it["boundRect"]), forKey: "boundRect")
425
+ result.setValue(it["pageIndex"] as? Int, forKey: "pageIndex")
426
+ result.setValue(it["probability"] as? Int, forKey: "probability")
427
+ result.setValue((it["originalSymbols"] as? [Any])?.compactMap(DocumentReaderSymbol.decode), forKey: "originalSymbols")
428
+ result.setValue(DocumentReaderRfidOrigin.decode(it["rfidOrigin"]), forKey: "rfidOrigin")
429
+ return result
430
+ }
431
+ func encode() -> [String: Any?] {
432
+ return [
433
+ "sourceType": self.sourceType.rawValue,
434
+ "value": self.value,
435
+ "originalValue": self.originalValue,
436
+ "boundRect": self.boundRect.encode(),
437
+ "pageIndex": self.pageIndex,
438
+ "probability": self.probability,
439
+ "originalSymbols": self.originalSymbols.map { $0.encode() },
440
+ "rfidOrigin": self.rfidOrigin?.encode(),
441
+ ]
442
+ }
443
+ }
444
+
445
+ public extension DocumentReaderTextField {
446
+ static func decode(_ it: Any?) -> Self? {
447
+ guard let it = it as? [String: Any] else { return nil }
448
+ let result = Self.emptyInit() as Self
449
+ result.setValue(it["fieldType"] as Any?, forKey: "fieldType")
450
+ result.setValue(it["fieldName"] as? String, forKey: "fieldName")
451
+ result.setValue(it["lcid"] as Any?, forKey: "lcid")
452
+ result.setValue((it["values"] as? [Any])?.compactMap(DocumentReaderValue.decode), forKey: "values")
453
+ result.setValue(it["status"] as Any?, forKey: "status")
454
+ result.setValue(it["comparisonStatus"] as Any?, forKey: "comparisonStatus")
455
+ result.setValue(it["validityStatus"] as Any?, forKey: "validityStatus")
456
+ result.setValue(it["value"] as? String, forKey: "value")
457
+ result.setValue((it["comparisonList"] as? [Any])?.compactMap(DocumentReaderComparison.decode), forKey: "comparisonList")
458
+ result.setValue((it["validityList"] as? [Any])?.compactMap(DocumentReaderValidity.decode), forKey: "validityList")
459
+ return result
460
+ }
461
+ func encode() -> [String: Any?] {
462
+ return [
463
+ "fieldType": self.fieldType.rawValue,
464
+ "fieldName": self.fieldName,
465
+ "lcid": self.lcid.rawValue,
466
+ "lcidName": self.lcidName,
467
+ "values": self.values.map { $0.encode() },
468
+ "status": self.status.rawValue,
469
+ "comparisonStatus": self.comparisonStatus.rawValue,
470
+ "validityStatus": self.validityStatus.rawValue,
471
+ "value": self.value,
472
+ "getValue": self.getValue()?.encode(),
473
+ "comparisonList": self.comparisonList.map { $0.encode() },
474
+ "validityList": self.validityList.map { $0.encode() },
475
+ ]
476
+ }
477
+ }
478
+
479
+ public extension DocumentReaderTextResult {
480
+ static func decode(_ it: Any?) -> Self? {
481
+ guard let it = it as? [String: Any] else { return nil }
482
+ let result = Self.emptyInit() as Self
483
+ result.setValue((it["fields"] as? [Any])?.compactMap(DocumentReaderTextField.decode), forKey: "fields")
484
+ result.setValue(it["status"] as Any?, forKey: "status")
485
+ result.setValue(it["comparisonStatus"] as Any?, forKey: "comparisonStatus")
486
+ result.setValue(it["validityStatus"] as Any?, forKey: "validityStatus")
487
+ result.setValue((it["availableSourceList"] as? [Any])?.compactMap(DocumentReaderTextSource.decode), forKey: "availableSourceList")
488
+ return result
489
+ }
490
+ func encode() -> [String: Any?] {
491
+ return [
492
+ "fields": self.fields.map { $0.encode() },
493
+ "status": self.status.rawValue,
494
+ "comparisonStatus": self.comparisonStatus.rawValue,
495
+ "validityStatus": self.validityStatus.rawValue,
496
+ "availableSourceList": self.availableSourceList.map { $0.encode() },
497
+ ]
498
+ }
499
+ }
500
+
501
+ // MARK: - Position
502
+
503
+ public extension Position {
504
+ static func decode(_ it: Any?) -> Self? {
505
+ guard let it = it as? [String: Any] else { return nil }
506
+ let result = Self.emptyInit() as Self
507
+ result.setValue(NSValue(cgSize: CGSize(width: it["width"] as! CGFloat, height: it["height"] as! CGFloat)), forKey: "size")
508
+ result.setValue(it["angle"] as? Double, forKey: "angle")
509
+ result.setValue(CGPoint.decode(it["center"]), forKey: "center")
510
+ result.setValue(CGPoint.decode(it["leftTop"]), forKey: "leftTop")
511
+ result.setValue(CGPoint.decode(it["leftBottom"]), forKey: "leftBottom")
512
+ result.setValue(CGPoint.decode(it["rightTop"]), forKey: "rightTop")
513
+ result.setValue(CGPoint.decode(it["rightBottom"]), forKey: "rightBottom")
514
+ result.setValue(it["perspectiveTr"] as? Double, forKey: "perspectiveTr")
515
+ result.setValue(it["objArea"] as? Double, forKey: "objArea")
516
+ result.setValue(it["objIntAngleDev"] as? Double, forKey: "objIntAngleDev")
517
+ result.setValue(it["resultStatus"] as Any?, forKey: "resultStatus")
518
+ result.setValue(it["docFormat"] as Any?, forKey: "docFormat")
519
+ result.setValue(it["pageIndex"] as? Int, forKey: "pageIndex")
520
+ result.setValue(it["dpi"] as? Int, forKey: "dpi")
521
+ result.setValue(it["inverse"] as? Int, forKey: "inverse")
522
+ return result
523
+ }
524
+ func encode() -> [String: Any?] {
525
+ return [
526
+ "width": self.size.width,
527
+ "height": self.size.height,
528
+ "angle": self.angle,
529
+ "center": self.center.encode(),
530
+ "leftTop": self.leftTop.encode(),
531
+ "leftBottom": self.leftBottom.encode(),
532
+ "rightTop": self.rightTop.encode(),
533
+ "rightBottom": self.rightBottom.encode(),
534
+ "perspectiveTr": self.perspectiveTr,
535
+ "objArea": self.objArea,
536
+ "objIntAngleDev": self.objIntAngleDev,
537
+ "resultStatus": self.resultStatus.rawValue,
538
+ "docFormat": self.docFormat.rawValue,
539
+ "pageIndex": self.pageIndex,
540
+ "dpi": self.dpi,
541
+ "inverse": self.inverse,
542
+ ]
543
+ }
544
+ }
545
+
546
+ // MARK: - ImageQuality
547
+
548
+ public extension ImageQuality {
549
+ static func decode(_ it: Any?) -> Self? {
550
+ guard let it = it as? [String: Any] else { return nil }
551
+ let result = Self.emptyInit() as Self
552
+ result.setValue(ImageQualityCheckType.decode(it["type"]).rawValue, forKey: "type")
553
+ result.setValue(it["result"] as Any?, forKey: "result")
554
+ result.setValue(it["featureType"] as Any?, forKey: "featureType")
555
+ result.setValue((it["boundRects"] as? [Any])?.map { NSValue(cgRect: CGRect.decode($0)) }, forKey: "boundRects")
556
+ return result
557
+ }
558
+ func encode() -> [String: Any?] {
559
+ return [
560
+ "type": ImageQualityCheckType(rawValue: self.type as String).encode(),
561
+ "result": self.result.rawValue,
562
+ "featureType": self.featureType.rawValue,
563
+ "boundRects": self.boundRects.compactMap { $0.cgRectValue.encode() },
564
+ ]
565
+ }
566
+ }
567
+
568
+ public extension ImageQualityGroup {
569
+ static func decode(_ it: Any?) -> Self? {
570
+ guard let it = it as? [String: Any] else { return nil }
571
+ let result = Self.emptyInit() as Self
572
+ result.setValue(it["count"] as? Int, forKey: "count")
573
+ result.setValue(it["result"] as Any?, forKey: "result")
574
+ result.setValue((it["imageQualityList"] as? [Any])?.compactMap(ImageQuality.decode), forKey: "imageQualityList")
575
+ result.setValue(it["pageIndex"] as? Int, forKey: "pageIndex")
576
+ return result
577
+ }
578
+ func encode() -> [String: Any?] {
579
+ return [
580
+ "count": self.count,
581
+ "result": self.result.rawValue,
582
+ "imageQualityList": self.imageQualityList.map { $0.encode() },
583
+ "pageIndex": self.pageIndex,
584
+ ]
585
+ }
586
+ }
587
+
588
+ public extension DocumentReaderDocumentType {
589
+ static func decode(_ it: Any?) -> Self? {
590
+ guard let it = it as? [String: Any] else { return nil }
591
+ let result = Self.emptyInit() as Self
592
+ result.setValue(it["name"] as? String, forKey: "name")
593
+ result.setValue(it["documentID"] as? Int, forKey: "documentID")
594
+ result.setValue(it["ICAOCode"] as? String, forKey: "ICAOCode")
595
+ result.setValue(it["FDSID"] as? [NSNumber], forKey: "FDSID")
596
+ result.setValue(it["dType"] as Any?, forKey: "dType")
597
+ result.setValue(it["dFormat"] as Any?, forKey: "dFormat")
598
+ result.setValue(it["dMRZ"] as? Bool, forKey: "dMRZ")
599
+ result.setValue(it["isDeprecated"] as? Bool, forKey: "isDeprecated")
600
+ result.setValue(it["dDescription"] as? String, forKey: "dDescription")
601
+ result.setValue(it["dYear"] as? String, forKey: "dYear")
602
+ result.setValue(it["dCountryName"] as? String, forKey: "dCountryName")
603
+ result.setValue(it["pageIndex"] as? Int, forKey: "pageIndex")
604
+ return result
605
+ }
606
+ func encode() -> [String: Any?] {
607
+ return [
608
+ "name": self.name,
609
+ "documentID": self.documentID,
610
+ "ICAOCode": self.icaoCode,
611
+ "FDSID": self.fdsid,
612
+ "dType": self.dType.rawValue,
613
+ "dFormat": self.dFormat.rawValue,
614
+ "dMRZ": self.dMRZ,
615
+ "isDeprecated": self.isDeprecated,
616
+ "dDescription": self.dDescription,
617
+ "dYear": self.dYear,
618
+ "dCountryName": self.dCountryName,
619
+ "pageIndex": self.pageIndex,
620
+ ]
621
+ }
622
+ }
623
+
624
+ // MARK: - RFID
625
+
626
+ public extension RFIDNotify {
627
+ func encode() -> [String: Any?] {
628
+ return [
629
+ "notificationCode": self.code.rawValue & 0xFFFF0000,
630
+ "dataFileType": self.attachment,
631
+ "progress": Int(self.value),
632
+ ]
633
+ }
634
+ }
635
+
636
+ public extension AccessControlProcedureType {
637
+ static func decode(_ it: Any?) -> Self? {
638
+ guard let it = it as? [String: Any] else { return nil }
639
+ let result = Self.emptyInit() as Self
640
+ result.setValue(it["activeOptionIdx"] as? Int, forKey: "activeOptionIdx")
641
+ result.setValue(it["notifications"] as? [NSNumber], forKey: "notifications")
642
+ result.setValue(it["status"] as Any?, forKey: "status")
643
+ result.setValue(it["type"] as Any?, forKey: "type")
644
+ return result
645
+ }
646
+ func encode() -> [String: Any?] {
647
+ return [
648
+ "activeOptionIdx": self.activeOptionIdx,
649
+ "notifications": self.notifications,
650
+ "status": self.status.rawValue,
651
+ "type": self.type.rawValue,
652
+ ]
653
+ }
654
+ }
655
+
656
+ public extension FileData {
657
+ static func decode(_ it: Any?) -> Self? {
658
+ guard let it = it as? [String: Any] else { return nil }
659
+ let result = Self.emptyInit() as Self
660
+ result.setValue(it["data"] as? String, forKey: "data")
661
+ result.setValue(it["length"] as? Int, forKey: "length")
662
+ result.setValue(it["status"] as? Double, forKey: "status")
663
+ result.setValue(it["type"] as? Int, forKey: "type")
664
+ return result
665
+ }
666
+ func encode() -> [String: Any?] {
667
+ return [
668
+ "data": self.data,
669
+ "length": self.length,
670
+ "status": self.status,
671
+ "type": self.type,
672
+ ]
673
+ }
674
+ }
675
+
676
+ public extension CertificateData {
677
+ static func decode(_ it: Any?) -> Self? {
678
+ guard let it = it as? [String: Any] else { return nil }
679
+ let result = Self.emptyInit() as Self
680
+ result.setValue(it["data"] as? String, forKey: "data")
681
+ result.setValue(it["length"] as? Int, forKey: "length")
682
+ return result
683
+ }
684
+ func encode() -> [String: Any?] {
685
+ return [
686
+ "data": self.data,
687
+ "length": self.length,
688
+ ]
689
+ }
690
+ }
691
+
692
+ public extension SecurityObjectCertificates {
693
+ static func decode(_ it: Any?) -> Self? {
694
+ guard let it = it as? [String: Any] else { return nil }
695
+ let result = Self.emptyInit() as Self
696
+ result.setValue(CertificateData.decode(it["securityObject"]), forKey: "securityObject")
697
+ return result
698
+ }
699
+ func encode() -> [String: Any?] {
700
+ return [
701
+ "securityObject": self.securityObject.encode(),
702
+ ]
703
+ }
704
+ }
705
+
706
+ public extension File {
707
+ static func decode(_ it: Any?) -> Self? {
708
+ guard let it = it as? [String: Any] else { return nil }
709
+ let result = Self.emptyInit() as Self
710
+ result.setValue(FileData.decode(it["fileData"]), forKey: "fileData")
711
+ result.setValue(it["fileID"] as? String, forKey: "fileID")
712
+ result.setValue(it["notifications"] as? [NSNumber], forKey: "notifications")
713
+ result.setValue(it["pAStatus"] as Any?, forKey: "pAStatus")
714
+ result.setValue(it["readingStatus"] as Any?, forKey: "readingStatus")
715
+ result.setValue(it["readingTime"] as? Int, forKey: "readingTime")
716
+ result.setValue(it["type"] as Any?, forKey: "type")
717
+ result.setValue(it["typeName"] as? String, forKey: "typeName")
718
+ result.setValue(it["docFieldsText"] as? [NSNumber], forKey: "docFieldsText")
719
+ result.setValue(it["docFieldsGraphics"] as? [NSNumber], forKey: "docFieldsGraphics")
720
+ result.setValue(it["docFieldsOriginals"] as? [NSNumber], forKey: "docFieldsOriginals")
721
+ result.setValue(SecurityObjectCertificates.decode(it["certificates"]), forKey: "certificates")
722
+ return result
723
+ }
724
+ func encode() -> [String: Any?] {
725
+ return [
726
+ "fileData": self.fileData.encode(),
727
+ "fileID": self.fileID,
728
+ "notifications": self.notifications,
729
+ "pAStatus": self.pAStatus.rawValue,
730
+ "readingStatus": self.readingStatus.rawValue,
731
+ "readingTime": self.readingTime,
732
+ "type": self.type.rawValue,
733
+ "typeName": self.typeName,
734
+ "docFieldsText": self.docFieldsText,
735
+ "docFieldsGraphics": self.docFieldsGraphics,
736
+ "docFieldsOriginals": self.docFieldsOriginals,
737
+ "certificates": self.certificates.encode(),
738
+ ]
739
+ }
740
+ }
741
+
742
+ public extension Application {
743
+ static func decode(_ it: Any?) -> Self? {
744
+ guard let it = it as? [String: Any] else { return nil }
745
+ let result = Self.emptyInit() as Self
746
+ result.setValue(it["applicationID"] as? String, forKey: "applicationID")
747
+ result.setValue(it["dataHashAlgorithm"] as? String, forKey: "dataHashAlgorithm")
748
+ result.setValue((it["files"] as? [Any])?.compactMap(File.decode), forKey: "files")
749
+ result.setValue(it["type"] as Any?, forKey: "type")
750
+ result.setValue(it["status"] as Any?, forKey: "status")
751
+ result.setValue(it["unicodeVersion"] as? String, forKey: "unicodeVersion")
752
+ result.setValue(it["version"] as? String, forKey: "version")
753
+ return result
754
+ }
755
+ func encode() -> [String: Any?] {
756
+ return [
757
+ "applicationID": self.applicationID,
758
+ "dataHashAlgorithm": self.dataHashAlgorithm,
759
+ "files": self.files.map { $0.encode() },
760
+ "type": self.type.rawValue,
761
+ "status": self.status.rawValue,
762
+ "unicodeVersion": self.unicodeVersion,
763
+ "version": self.version,
764
+ ]
765
+ }
766
+ }
767
+
768
+ public extension RFIDValue {
769
+ static func decode(_ it: Any?) -> Self? {
770
+ guard let it = it as? [String: Any] else { return nil }
771
+ let result = Self.emptyInit() as Self
772
+ result.setValue(it["data"] as? String, forKey: "data")
773
+ result.setValue(it["length"] as? Int, forKey: "length")
774
+ result.setValue(it["status"] as? Double, forKey: "status")
775
+ result.setValue(it["type"] as? Int, forKey: "type")
776
+ result.setValue(it["format"] as? String, forKey: "format")
777
+ return result
778
+ }
779
+ func encode() -> [String: Any?] {
780
+ return [
781
+ "data": self.data,
782
+ "length": self.length,
783
+ "status": self.status,
784
+ "type": self.type,
785
+ "format": self.format,
786
+ ]
787
+ }
788
+ }
789
+
790
+ public extension Attribute {
791
+ static func decode(_ it: Any?) -> Self? {
792
+ guard let it = it as? [String: Any] else { return nil }
793
+ let result = Self.emptyInit() as Self
794
+ result.setValue(it["type"] as? String, forKey: "type")
795
+ result.setValue(RFIDValue.decode(it["value"]), forKey: "value")
796
+ return result
797
+ }
798
+ func encode() -> [String: Any?] {
799
+ return [
800
+ "type": self.type,
801
+ "value": self.value.encode(),
802
+ ]
803
+ }
804
+ }
805
+
806
+ public extension Authority {
807
+ static func decode(_ it: Any?) -> Self? {
808
+ guard let it = it as? [String: Any] else { return nil }
809
+ let result = Self.emptyInit() as Self
810
+ result.setValue((it["attributes"] as? [Any])?.compactMap(Attribute.decode), forKey: "attributes")
811
+ result.setValue(it["data"] as? String, forKey: "data")
812
+ result.setValue(RFIDValue.decode(it["friendlyName"]), forKey: "friendlyName")
813
+ return result
814
+ }
815
+ func encode() -> [String: Any?] {
816
+ return [
817
+ "attributes": self.attributes.map { $0.encode() },
818
+ "data": self.data,
819
+ "friendlyName": self.friendlyName.encode(),
820
+ ]
821
+ }
822
+ }
823
+
824
+ public extension Extension {
825
+ static func decode(_ it: Any?) -> Self? {
826
+ guard let it = it as? [String: Any] else { return nil }
827
+ let result = Self.emptyInit() as Self
828
+ result.setValue(it["data"] as? String, forKey: "data")
829
+ result.setValue(it["type"] as? String, forKey: "type")
830
+ return result
831
+ }
832
+ func encode() -> [String: Any?] {
833
+ return [
834
+ "data": self.data,
835
+ "type": self.type,
836
+ ]
837
+ }
838
+ }
839
+
840
+ public extension Validity {
841
+ static func decode(_ it: Any?) -> Self? {
842
+ guard let it = it as? [String: Any] else { return nil }
843
+ let result = Self.emptyInit() as Self
844
+ result.setValue(RFIDValue.decode(it["notAfter"]), forKey: "notAfter")
845
+ result.setValue(RFIDValue.decode(it["notBefore"]), forKey: "notBefore")
846
+ return result
847
+ }
848
+ func encode() -> [String: Any?] {
849
+ return [
850
+ "notAfter": self.notAfter.encode(),
851
+ "notBefore": self.notBefore.encode(),
852
+ ]
853
+ }
854
+ }
855
+
856
+ public extension CertificateChain {
857
+ static func decode(_ it: Any?) -> Self? {
858
+ guard let it = it as? [String: Any] else { return nil }
859
+ let result = Self.emptyInit() as Self
860
+ result.setValue((it["extensions"] as? [Any])?.compactMap(Extension.decode), forKey: "extensions")
861
+ result.setValue(RFIDValue.decode(it["fileName"]), forKey: "fileName")
862
+ result.setValue(Authority.decode(it["issuer"]), forKey: "issuer")
863
+ result.setValue(it["notifications"] as? [NSNumber], forKey: "notifications")
864
+ result.setValue(it["origin"] as? Int, forKey: "origin")
865
+ result.setValue(it["paStatus"] as? Double, forKey: "paStatus")
866
+ result.setValue(it["serialNumber"] as? String, forKey: "serialNumber")
867
+ result.setValue(it["signatureAlgorithm"] as? String, forKey: "signatureAlgorithm")
868
+ result.setValue(Authority.decode(it["subject"]), forKey: "subject")
869
+ result.setValue(it["subjectPKAlgorithm"] as? String, forKey: "subjectPKAlgorithm")
870
+ result.setValue(it["type"] as Any?, forKey: "type")
871
+ result.setValue(Validity.decode(it["validity"]), forKey: "validity")
872
+ result.setValue(it["version"] as? Int, forKey: "version")
873
+ return result
874
+ }
875
+ func encode() -> [String: Any?] {
876
+ return [
877
+ "extensions": self.extensions.map { $0.encode() },
878
+ "fileName": self.fileName.encode(),
879
+ "issuer": self.issuer.encode(),
880
+ "notifications": self.notifications,
881
+ "origin": self.origin,
882
+ "paStatus": self.paStatus,
883
+ "serialNumber": self.serialNumber,
884
+ "signatureAlgorithm": self.signatureAlgorithm,
885
+ "subject": self.subject.encode(),
886
+ "subjectPKAlgorithm": self.subjectPKAlgorithm,
887
+ "type": self.type.rawValue,
888
+ "validity": self.validity.encode(),
889
+ "version": self.version,
890
+ ]
891
+ }
892
+ }
893
+
894
+ public extension SignerInfo {
895
+ static func decode(_ it: Any?) -> Self? {
896
+ guard let it = it as? [String: Any] else { return nil }
897
+ let result = Self.emptyInit() as Self
898
+ result.setValue(it["dataToHash"] as? String, forKey: "dataToHash")
899
+ result.setValue(it["digestAlgorithm"] as? String, forKey: "digestAlgorithm")
900
+ result.setValue(it["paStatus"] as? Double, forKey: "paStatus")
901
+ result.setValue(it["signatureAlgorithm"] as? String, forKey: "signatureAlgorithm")
902
+ result.setValue(it["version"] as? Int, forKey: "version")
903
+ result.setValue(Authority.decode(it["issuer"]), forKey: "issuer")
904
+ result.setValue(RFIDValue.decode(it["serialNumber"]), forKey: "serialNumber")
905
+ result.setValue(RFIDValue.decode(it["signature"]), forKey: "signature")
906
+ result.setValue((it["signedAttributes"] as? [Any])?.compactMap(Extension.decode), forKey: "signedAttributes")
907
+ result.setValue(RFIDValue.decode(it["subjectKeyIdentifier"]), forKey: "subjectKeyIdentifier")
908
+ result.setValue((it["certificateChain"] as? [Any])?.compactMap(CertificateChain.decode), forKey: "certificateChain")
909
+ result.setValue(it["notifications"] as? [NSNumber], forKey: "notifications")
910
+ return result
911
+ }
912
+ func encode() -> [String: Any?] {
913
+ return [
914
+ "dataToHash": self.dataToHash,
915
+ "digestAlgorithm": self.digestAlgorithm,
916
+ "paStatus": self.paStatus,
917
+ "signatureAlgorithm": self.signatureAlgorithm,
918
+ "version": self.version,
919
+ "issuer": self.issuer.encode(),
920
+ "serialNumber": self.serialNumber.encode(),
921
+ "signature": self.signature.encode(),
922
+ "signedAttributes": self.signedAttributes.map { $0.encode() },
923
+ "subjectKeyIdentifier": self.subjectKeyIdentifier.encode(),
924
+ "certificateChain": self.certificateChain.map { $0.encode() },
925
+ "notifications": self.notifications,
926
+ ]
927
+ }
928
+ }
929
+
930
+ public extension SecurityObject {
931
+ static func decode(_ it: Any?) -> Self? {
932
+ guard let it = it as? [String: Any] else { return nil }
933
+ let result = Self.emptyInit() as Self
934
+ result.setValue(it["fileReference"] as? Int, forKey: "fileReference")
935
+ result.setValue(it["objectType"] as? String, forKey: "objectType")
936
+ result.setValue(it["version"] as? Int, forKey: "version")
937
+ result.setValue((it["signerInfos"] as? [Any])?.compactMap(SignerInfo.decode), forKey: "signerInfos")
938
+ result.setValue(it["notifications"] as? [NSNumber], forKey: "notifications")
939
+ return result
940
+ }
941
+ func encode() -> [String: Any?] {
942
+ return [
943
+ "fileReference": self.fileReference,
944
+ "objectType": self.objectType,
945
+ "version": self.version,
946
+ "signerInfos": self.signerInfos.map { $0.encode() },
947
+ "notifications": self.notifications,
948
+ ]
949
+ }
950
+ }
951
+
952
+ public extension CardProperties {
953
+ static func decode(_ it: Any?) -> Self? {
954
+ guard let it = it as? [String: Any] else { return nil }
955
+ let result = Self.emptyInit() as Self
956
+ result.setValue(it["aTQA"] as? Int, forKey: "aTQA")
957
+ result.setValue(it["aTQB"] as? String, forKey: "aTQB")
958
+ result.setValue(it["aTR"] as? String, forKey: "aTR")
959
+ result.setValue(it["baudrate1"] as? String, forKey: "baudrate1")
960
+ result.setValue(it["baudrate2"] as? String, forKey: "baudrate2")
961
+ result.setValue(it["bitRateR"] as? Int, forKey: "bitRateR")
962
+ result.setValue(it["bitRateS"] as? Int, forKey: "bitRateS")
963
+ result.setValue(it["chipTypeA"] as? Int, forKey: "chipTypeA")
964
+ result.setValue(it["mifareMemory"] as? Int, forKey: "mifareMemory")
965
+ result.setValue(it["rfidType"] as? Int, forKey: "rfidType")
966
+ result.setValue(it["sAK"] as? Int, forKey: "sAK")
967
+ result.setValue(it["support4"] as? Bool, forKey: "support4")
968
+ result.setValue(it["supportMifare"] as? Bool, forKey: "supportMifare")
969
+ result.setValue(it["uID"] as? String, forKey: "uID")
970
+ return result
971
+ }
972
+ func encode() -> [String: Any?] {
973
+ return [
974
+ "aTQA": self.aTQA,
975
+ "aTQB": self.aTQB,
976
+ "aTR": self.aTR,
977
+ "baudrate1": self.baudrate1,
978
+ "baudrate2": self.baudrate2,
979
+ "bitRateR": self.bitRateR,
980
+ "bitRateS": self.bitRateS,
981
+ "chipTypeA": self.chipTypeA,
982
+ "mifareMemory": self.mifareMemory,
983
+ "rfidType": self.rfidType,
984
+ "sAK": self.sAK,
985
+ "support4": self.support4,
986
+ "supportMifare": self.supportMifare,
987
+ "uID": self.uID,
988
+ ]
989
+ }
990
+ }
991
+
992
+ public extension RFIDSessionData {
993
+ static func decode(_ it: Any?) -> Self? {
994
+ guard let it = it as? [String: Any] else { return nil }
995
+ let result = Self.emptyInit() as Self
996
+ result.setValue((it["accessControls"] as? [Any])?.compactMap(AccessControlProcedureType.decode), forKey: "accessControls")
997
+ result.setValue((it["applications"] as? [Any])?.compactMap(Application.decode), forKey: "applications")
998
+ result.setValue((it["securityObjects"] as? [Any])?.compactMap(SecurityObject.decode), forKey: "securityObjects")
999
+ result.setValue(CardProperties.decode(it["cardProperties"]), forKey: "cardProperties")
1000
+ result.setValue(it["totalBytesReceived"] as? Int, forKey: "totalBytesReceived")
1001
+ result.setValue(it["totalBytesSent"] as? Int, forKey: "totalBytesSent")
1002
+ result.setValue(it["status"] as Any?, forKey: "status")
1003
+ result.setValue(it["extLeSupport"] as Any?, forKey: "extLeSupport")
1004
+ result.setValue(it["processTime"] as? Double, forKey: "processTime")
1005
+ result.setValue(it["dataGroups"] as? [NSNumber], forKey: "dataGroups")
1006
+ result.setValue((it["dataFields"] as? [Any])?.compactMap(DataField.decode), forKey: "dataFields")
1007
+ return result
1008
+ }
1009
+ func encode() -> [String: Any?] {
1010
+ return [
1011
+ "accessControls": self.accessControls.map { $0.encode() },
1012
+ "applications": self.applications.map { $0.encode() },
1013
+ "securityObjects": self.securityObjects.map { $0.encode() },
1014
+ "cardProperties": self.cardProperties.encode(),
1015
+ "totalBytesReceived": self.totalBytesReceived,
1016
+ "totalBytesSent": self.totalBytesSent,
1017
+ "status": self.status.rawValue,
1018
+ "extLeSupport": self.extLeSupport.rawValue,
1019
+ "processTime": self.processTime,
1020
+ "dataGroups": self.dataGroups,
1021
+ "dataFields": self.dataFields.map { $0.encode() },
1022
+ ]
1023
+ }
1024
+ }
1025
+
1026
+ public extension DataField {
1027
+ static func decode(_ it: Any?) -> Self? {
1028
+ guard let it = it as? [String: Any] else { return nil }
1029
+ let result = Self.emptyInit() as Self
1030
+ result.setValue(it["data"] as? String, forKey: "data")
1031
+ result.setValue(it["fieldType"] as? Int, forKey: "fieldType")
1032
+ return result
1033
+ }
1034
+ func encode() -> [String: Any?] {
1035
+ return [
1036
+ "data": self.data,
1037
+ "fieldType": self.fieldType,
1038
+ ]
1039
+ }
1040
+ }
1041
+
1042
+ public extension AuthenticityCheck {
1043
+ static func decode(_ it: Any?) -> Self? {
1044
+ guard let it = it as? [String: Any] else { return nil }
1045
+ let result = Self.emptyInit() as Self
1046
+ result.setValue(it["type"] as Any?, forKey: "type")
1047
+ result.setValue(it["status"] as Any?, forKey: "status")
1048
+ result.setValue((it["elements"] as? [Any])?.compactMap(AuthenticityElement.decode), forKey: "elements")
1049
+ result.setValue(it["pageIndex"] as? Int, forKey: "pageIndex")
1050
+ return result
1051
+ }
1052
+ func encode() -> [String: Any?] {
1053
+ return [
1054
+ "type": self.type.rawValue,
1055
+ "typeName": self.typeName,
1056
+ "status": self.status.rawValue,
1057
+ "elements": self.elements?.map { $0.encode() },
1058
+ "pageIndex": self.pageIndex,
1059
+ ]
1060
+ }
1061
+ }
1062
+
1063
+ public extension PDF417Info {
1064
+ static func decode(_ it: Any?) -> Self? {
1065
+ guard let it = it as? [String: Any] else { return nil }
1066
+ let result = Self.emptyInit() as Self
1067
+ result.setValue(it["errorLevel"] as? Int, forKey: "errorLevel")
1068
+ result.setValue(it["columns"] as? Int, forKey: "columns")
1069
+ result.setValue(it["rows"] as? Int, forKey: "rows")
1070
+ return result
1071
+ }
1072
+ func encode() -> [String: Any?] {
1073
+ return [
1074
+ "errorLevel": self.errorLevel,
1075
+ "columns": self.columns,
1076
+ "rows": self.rows,
1077
+ ]
1078
+ }
1079
+ }
1080
+
1081
+ // MARK: - Barcode
1082
+
1083
+ public extension DocumentReaderBarcodeResult {
1084
+ static func decode(_ it: Any?) -> Self? {
1085
+ guard let it = it as? [String: Any] else { return nil }
1086
+ let result = Self.emptyInit() as Self
1087
+ result.setValue((it["fields"] as? [Any])?.compactMap(DocumentReaderBarcodeField.decode), forKey: "fields")
1088
+ return result
1089
+ }
1090
+ func encode() -> [String: Any?] {
1091
+ return [
1092
+ "fields": self.fields?.map { $0.encode() },
1093
+ ]
1094
+ }
1095
+ }
1096
+
1097
+ public extension DocumentReaderBarcodeField {
1098
+ static func decode(_ it: Any?) -> Self? {
1099
+ guard let it = it as? [String: Any] else { return nil }
1100
+ let result = Self.emptyInit() as Self
1101
+ result.setValue(it["barcodeType"] as Any?, forKey: "barcodeType")
1102
+ result.setValue(it["status"] as Any?, forKey: "status")
1103
+ result.setValue(PDF417Info.decode(it["pdf417Info"]), forKey: "pdf417Info")
1104
+ result.setValue(Data.decode(it["data"]), forKey: "data")
1105
+ result.setValue(it["pageIndex"] as? Int, forKey: "pageIndex")
1106
+ return result
1107
+ }
1108
+ func encode() -> [String: Any?] {
1109
+ return [
1110
+ "barcodeType": self.barcodeType.rawValue,
1111
+ "status": self.status.rawValue,
1112
+ "pdf417Info": self.pdf417Info?.encode(),
1113
+ "data": self.data.encode(),
1114
+ "pageIndex": self.pageIndex,
1115
+ ]
1116
+ }
1117
+ }
1118
+
1119
+ // MARK: - Authenticity
1120
+
1121
+ public extension DocumentReaderAuthenticityResult {
1122
+ static func decode(_ it: Any?) -> Self? {
1123
+ guard let it = it as? [String: Any] else { return nil }
1124
+ let result = Self.emptyInit() as Self
1125
+ result.setValue(it["status"] as Any?, forKey: "security")
1126
+ result.setValue((it["checks"] as? [Any])?.compactMap(AuthenticityCheck.decode), forKey: "checks")
1127
+ return result
1128
+ }
1129
+ func encode() -> [String: Any?] {
1130
+ return [
1131
+ "status": self.status.rawValue,
1132
+ "checks": self.checks?.map { $0.encode() },
1133
+ ]
1134
+ }
1135
+ }
1136
+
1137
+ public extension AuthenticityElement {
1138
+ static func decode(_ it: Any?) -> Self? {
1139
+ guard let it = it as? [String: Any] else { return nil }
1140
+ let result = Self.emptyInit() as Self
1141
+ result.setValue(it["status"] as Any?, forKey: "status")
1142
+ result.setValue(it["elementType"] as Any?, forKey: "elementType")
1143
+ result.setValue(it["elementDiagnose"] as Any?, forKey: "elementDiagnose")
1144
+ return result
1145
+ }
1146
+ func encode() -> [String: Any?] {
1147
+ return [
1148
+ "status": self.status.rawValue,
1149
+ "elementType": self.elementType.rawValue,
1150
+ "elementTypeName": self.elementTypeName,
1151
+ "elementDiagnose": self.elementDiagnose.rawValue,
1152
+ "elementDiagnoseName": self.elementDiagnoseName,
1153
+ ]
1154
+ }
1155
+ }
1156
+
1157
+ // MARK: - Certificates
1158
+
1159
+ public extension PAResourcesIssuer {
1160
+ static func decode(_ it: Any?) -> Self? {
1161
+ guard let it = it as? [String: Any] else { return nil }
1162
+ let result = Self.emptyInit() as Self
1163
+ result.setValue(Data.decode(it["data"]), forKey: "data")
1164
+ result.setValue(it["friendlyName"] as? String, forKey: "friendlyName")
1165
+ result.setValue((it["attributes"] as? [Any])?.compactMap(PAAttribute.decode), forKey: "attributes")
1166
+ return result
1167
+ }
1168
+ func encode() -> [String: Any?] {
1169
+ return [
1170
+ "data": self.data?.encode(),
1171
+ "friendlyName": self.friendlyName,
1172
+ "attributes": self.attributes?.map { $0.encode() },
1173
+ ]
1174
+ }
1175
+ }
1176
+
1177
+ public extension PAAttribute {
1178
+ static func decode(_ it: Any?) -> Self? {
1179
+ guard let it = it as? [String: Any] else { return nil }
1180
+ let result = Self.emptyInit() as Self
1181
+ result.setValue(it["value"] as? String, forKey: "value")
1182
+ result.setValue(it["type"] as? String, forKey: "type")
1183
+ return result
1184
+ }
1185
+ func encode() -> [String: Any?] {
1186
+ return [
1187
+ "value": self.value,
1188
+ "type": self.type,
1189
+ ]
1190
+ }
1191
+ }
1192
+
1193
+ public extension TAChallenge {
1194
+ static func decode(_ it: Any?) -> Self? {
1195
+ guard let it = it as? [String: Any] else { return nil }
1196
+ let result = Self.emptyInit() as Self
1197
+ result.setValue(Data.decode(it["data"]), forKey: "data")
1198
+ result.setValue(it["auxPCD"] as? String, forKey: "auxPCD")
1199
+ result.setValue(it["challengePICC"] as? String, forKey: "challengePICC")
1200
+ result.setValue(it["hashPK"] as? String, forKey: "hashPK")
1201
+ result.setValue(it["idPICC"] as? String, forKey: "idPICC")
1202
+ return result
1203
+ }
1204
+ func encode() -> [String: Any?] {
1205
+ return [
1206
+ "data": self.data.encode(),
1207
+ "auxPCD": self.auxPCD,
1208
+ "challengePICC": self.challengePICC,
1209
+ "hashPK": self.hashPK,
1210
+ "idPICC": self.idPICC,
1211
+ ]
1212
+ }
1213
+ }
1214
+
1215
+ // MARK: - Status
1216
+
1217
+ public extension DocumentReaderResults.Status {
1218
+ static func decode(_ it: Any?) -> Self? {
1219
+ guard let it = it as? [String: Any] else { return nil }
1220
+ var json = it
1221
+ if var rfid = it["detailsRFID"] as? [String: Any] {
1222
+ rfid["AA"] = rfid["aa"]
1223
+ rfid["BAC"] = rfid["bac"]
1224
+ rfid["CA"] = rfid["ca"]
1225
+ rfid["PA"] = rfid["pa"]
1226
+ rfid["PACE"] = rfid["pace"]
1227
+ rfid["TA"] = rfid["ta"]
1228
+ json["detailsRFID"] = rfid
1229
+ }
1230
+ return perform("resultsStatusWithJSON:".selector(), with: json).takeUnretainedValue() as? Self
1231
+ }
1232
+ func encode() -> [String: Any?] {
1233
+ return [
1234
+ "overallStatus": self.overallStatus.rawValue,
1235
+ "optical": self.optical.rawValue,
1236
+ "detailsOptical": self.detailsOptical.encode(),
1237
+ "rfid": self.rfid.rawValue,
1238
+ "detailsRFID": self.detailsRFID.encode(),
1239
+ "portrait": self.portrait.rawValue,
1240
+ "stopList": self.stopList.rawValue,
1241
+ "mDL": self.mDL.rawValue,
1242
+ "age": self.age.rawValue,
1243
+ "captureProcessIntegrity": self.captureProcessIntegrity.rawValue,
1244
+ "detailsAge": self.detailsAge.encode(),
1245
+ ]
1246
+ }
1247
+ }
1248
+
1249
+ public extension OpticalStatus {
1250
+ static func decode(_ it: Any?) -> Self? {
1251
+ guard let it = it as? [String: Any] else { return nil }
1252
+ return perform("opticalStatusWithJSON:".selector(), with: it).takeUnretainedValue() as? Self
1253
+ }
1254
+ func encode() -> [String: Any?] {
1255
+ return [
1256
+ "overallStatus": self.overallStatus.rawValue,
1257
+ "mrz": self.mrz.rawValue,
1258
+ "text": self.text.rawValue,
1259
+ "docType": self.docType.rawValue,
1260
+ "security": self.security.rawValue,
1261
+ "imageQA": self.imageQA.rawValue,
1262
+ "expiry": self.expiry.rawValue,
1263
+ "vds": self.vds.rawValue,
1264
+ "pagesCount": self.pagesCount,
1265
+ ]
1266
+ }
1267
+ }
1268
+
1269
+ public extension RFIDSessionDataStatus {
1270
+ static func decode(_ it: Any?) -> Self? {
1271
+ guard let it = it as? [String: Any] else { return nil }
1272
+ var json = it
1273
+ json["AA"] = it["aa"]
1274
+ json["BAC"] = it["bac"]
1275
+ json["CA"] = it["ca"]
1276
+ json["PA"] = it["pa"]
1277
+ json["PACE"] = it["pace"]
1278
+ json["TA"] = it["ta"]
1279
+ return perform("rfidStatusWithJSON:".selector(), with: json).takeUnretainedValue() as? Self
1280
+ }
1281
+ func encode() -> [String: Any?] {
1282
+ return [
1283
+ "aa": self.aa.rawValue,
1284
+ "bac": self.bac.rawValue,
1285
+ "ca": self.ca.rawValue,
1286
+ "pa": self.pa.rawValue,
1287
+ "pace": self.pace.rawValue,
1288
+ "ta": self.ta.rawValue,
1289
+ "overallStatus": self.overallStatus.rawValue,
1290
+ ]
1291
+ }
1292
+ }
1293
+
1294
+ public extension DetailsAge {
1295
+ static func decode(_ it: Any?) -> Self? {
1296
+ guard let it = it as? [String: Any] else { return nil }
1297
+ return perform("detailsAgeWithJSON:".selector(), with: it).takeUnretainedValue() as? Self
1298
+ }
1299
+ func encode() -> [String: Any?] {
1300
+ return [
1301
+ "threshold": self.threshold,
1302
+ "overThreshold": self.overThreshold.rawValue,
1303
+ "over18": self.over18.rawValue,
1304
+ "over21": self.over21.rawValue,
1305
+ "over25": self.over25.rawValue,
1306
+ "over65": self.over65.rawValue,
1307
+ ]
1308
+ }
1309
+ }
1310
+
1311
+ // MARK: - VDS
1312
+
1313
+ public extension VDSNCData {
1314
+ static func decode(_ it: Any?) -> Self? {
1315
+ guard let it = it as? [String: Any] else { return nil }
1316
+ let alloc = Self.allocate()
1317
+ let sel = "initWithType:version:issuingCountry:message:signatureAlgorithm:signature:certificate:certificateChain:notifications:".selector()
1318
+ return privateInit(alloc, sel, (@convention(c)(
1319
+ Any, Selector,
1320
+ Any?, Int, Any?, Any?, Any?, Any?, Any?, Any?, Any?) -> Unmanaged<AnyObject>?).self, { f in f(
1321
+ alloc, sel,
1322
+ it["type"], it["version"] as! Int, it["issuingCountry"], it["message"], it["signatureAlgorithm"],
1323
+ BytesData.decode(it["signature"]), BytesData.decode(it["certificate"]),
1324
+ (it["certificateChain"] as? [Any])?.compactMap(CertificateChain.decode) ?? [],
1325
+ it["notifications"]
1326
+ )})
1327
+ }
1328
+ func encode() -> [String: Any?] {
1329
+ return [
1330
+ "type": self.type,
1331
+ "version": self.version,
1332
+ "issuingCountry": self.issuingCountry,
1333
+ "message": self.message,
1334
+ "signatureAlgorithm": self.signatureAlgorithm,
1335
+ "signature": self.signature?.encode(),
1336
+ "certificate": self.certificate?.encode(),
1337
+ "certificateChain": self.certificateChain.map { $0.encode() },
1338
+ "notifications": self.notifications,
1339
+ ]
1340
+ }
1341
+ }
1342
+
1343
+ public extension BytesData {
1344
+ static func decode(_ it: Any?) -> Self? {
1345
+ guard let it = it as? [String: Any] else { return nil }
1346
+ var json = it
1347
+ json["Data"] = it["data"]
1348
+ json["Length"] = it["length"]
1349
+ json["Status"] = it["status"]
1350
+ json["Type"] = it["type"]
1351
+ return perform("bytesDataWithJSON:".selector(), with: json).takeUnretainedValue() as? Self
1352
+ }
1353
+ func encode() -> [String: Any?] {
1354
+ return [
1355
+ "data": self.data,
1356
+ "length": self.length,
1357
+ "status": self.status,
1358
+ "type": self.type,
1359
+ ]
1360
+ }
1361
+ }
1362
+
1363
+ // MARK: - Info
1364
+
1365
+ public extension License {
1366
+ func encode() -> [String: Any?] {
1367
+ let formatter = DateFormatter()
1368
+ formatter.dateStyle = .short
1369
+ formatter.timeStyle = .none
1370
+ return [
1371
+ "expiryDate": self.expiryDate.map { formatter.string(from: $0) },
1372
+ "countryFilter": self.countryFilter,
1373
+ "isRfidAvailable": self.isRfidAvailable,
1374
+ ]
1375
+ }
1376
+ }
1377
+
1378
+ public extension DocReaderVersion {
1379
+ func encode() -> [String: Any?] {
1380
+ return [
1381
+ "api": self.api,
1382
+ "core": self.core,
1383
+ "coreMode": self.coreMode,
1384
+ "database": self.database.encode(),
1385
+ ]
1386
+ }
1387
+ }
1388
+
1389
+ public extension DocReaderDocumentsDatabase {
1390
+ static func decode(_ it: Any?) -> Self? {
1391
+ guard let it = it as? [String: Any] else { return nil }
1392
+ let result = Self.emptyInit() as Self
1393
+ result.setValue(it["databaseID"] as? String, forKey: "databaseID")
1394
+ result.setValue(it["version"] as? String, forKey: "version")
1395
+ result.setValue(it["date"] as? String, forKey: "date")
1396
+ result.setValue(it["databaseDescription"] as? String, forKey: "databaseDescription")
1397
+ result.setValue(it["countriesNumber"] as? Int, forKey: "countriesNumber")
1398
+ result.setValue(it["documentsNumber"] as? Int, forKey: "documentsNumber")
1399
+ result.setValue(it["size"] as? NSNumber, forKey: "size")
1400
+ return result
1401
+ }
1402
+ func encode() -> [String: Any?] {
1403
+ return [
1404
+ "databaseID": self.databaseID,
1405
+ "version": self.version,
1406
+ "date": self.date,
1407
+ "databaseDescription": self.databaseDescription,
1408
+ "countriesNumber": self.countriesNumber,
1409
+ "documentsNumber": self.documentsNumber,
1410
+ "size": self.size,
1411
+ ]
1412
+ }
1413
+ }
1414
+
1415
+ public extension DocumentReaderComparison {
1416
+ static func decode(_ it: Any?) -> Self? {
1417
+ guard let it = it as? [String: Any] else { return nil }
1418
+ let result = Self.emptyInit() as Self
1419
+ result.setValue(it["sourceTypeLeft"] as Any?, forKey: "sourceTypeLeft")
1420
+ result.setValue(it["sourceTypeRight"] as Any?, forKey: "sourceTypeRight")
1421
+ result.setValue(it["status"] as Any?, forKey: "status")
1422
+ return result
1423
+ }
1424
+ func encode() -> [String: Any?] {
1425
+ return [
1426
+ "sourceTypeLeft": self.sourceTypeLeft.rawValue,
1427
+ "sourceTypeRight": self.sourceTypeRight.rawValue,
1428
+ "status": self.status.rawValue,
1429
+ ]
1430
+ }
1431
+ }
1432
+
1433
+ public extension DocumentReaderRfidOrigin {
1434
+ static func decode(_ it: Any?) -> Self? {
1435
+ guard let it = it as? [String: Any] else { return nil }
1436
+ let result = Self.emptyInit() as Self
1437
+ result.setValue(it["dg"] as? Int, forKey: "dg")
1438
+ result.setValue(it["dgTag"] as? Int, forKey: "dgTag")
1439
+ result.setValue(it["entryView"] as? Int, forKey: "entryView")
1440
+ result.setValue(it["tagEntry"] as? Int, forKey: "tagEntry")
1441
+ return result
1442
+ }
1443
+ func encode() -> [String: Any?] {
1444
+ return [
1445
+ "dg": self.dg,
1446
+ "dgTag": self.dgTag,
1447
+ "entryView": self.entryView,
1448
+ "tagEntry": self.tagEntry,
1449
+ ]
1450
+ }
1451
+ }
1452
+
1453
+ public extension DocumentReaderTextSource {
1454
+ static func decode(_ it: Any?) -> Self? {
1455
+ guard let it = it as? [String: Any] else { return nil }
1456
+ let result = Self.emptyInit() as Self
1457
+ result.setValue(it["sourceType"] as Any?, forKey: "sourceType")
1458
+ result.setValue(it["source"] as? String, forKey: "source")
1459
+ result.setValue(it["validityStatus"] as Any?, forKey: "validityStatus")
1460
+ return result
1461
+ }
1462
+ func encode() -> [String: Any?] {
1463
+ return [
1464
+ "sourceType": self.sourceType.rawValue,
1465
+ "source": self.value(forKey: "source"),
1466
+ "validityStatus": self.validityStatus.rawValue,
1467
+ ]
1468
+ }
1469
+ }
1470
+
1471
+ public extension DocumentReaderSymbol {
1472
+ static func decode(_ it: Any?) -> Self? {
1473
+ guard let it = it as? [String: Any] else { return nil }
1474
+ let result = Self.emptyInit() as Self
1475
+ result.setValue(it["code"] as? Int, forKey: "code")
1476
+ result.setValue(CGRect.decode(it["rect"]), forKey: "rect")
1477
+ result.setValue(it["probability"] as? Int, forKey: "probability")
1478
+ return result
1479
+ }
1480
+ func encode() -> [String: Any?] {
1481
+ return [
1482
+ "code": self.code,
1483
+ "rect": self.rect.encode(),
1484
+ "probability": self.probability,
1485
+ ]
1486
+ }
1487
+ }
1488
+
1489
+ public extension DocumentReaderValidity {
1490
+ static func decode(_ it: Any?) -> Self? {
1491
+ guard let it = it as? [String: Any] else { return nil }
1492
+ let result = Self.emptyInit() as Self
1493
+ result.setValue(it["sourceType"] as Any?, forKey: "sourceType")
1494
+ result.setValue(it["status"] as Any?, forKey: "status")
1495
+ return result
1496
+ }
1497
+ func encode() -> [String: Any?] {
1498
+ return [
1499
+ "sourceType": self.sourceType.rawValue,
1500
+ "status": self.status.rawValue,
1501
+ ]
1502
+ }
1503
+ }
1504
+
1505
+ // MARK: - mDL
1506
+
1507
+ public extension RGLDocFeature {
1508
+ static func decode(_ it: Any?) -> Self? {
1509
+ guard let it = it as? [String: Any] else { return nil }
1510
+ let result = Self.emptyInit() as Self
1511
+ result.setValue(it["type"] as? NSNumber, forKey: "type")
1512
+ result.setValue(BytesData.decode(it["data"]), forKey: "data")
1513
+ return result
1514
+ }
1515
+ func encode() -> [String: Any?] {
1516
+ return [
1517
+ "type": self.type,
1518
+ "data": self.data?.encode(),
1519
+ ]
1520
+ }
1521
+ }
1522
+
1523
+ public extension VDSData {
1524
+ static func decode(_ it: Any?) -> Self? {
1525
+ guard let it = it as? [String: Any] else { return nil }
1526
+ let alloc = Self.allocate()
1527
+ let sel = "initWithType:docType:featureRef:version:certificate:issuingCountry:docIssueDate:signature:signatureDate:signer:certificateChain:docFeatures:notifications:".selector()
1528
+ return privateInit(alloc, sel, (@convention(c)(
1529
+ Any, Selector,
1530
+ Int, Int, Int, Int, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?, Any?) -> Unmanaged<AnyObject>?).self, { f in f(
1531
+ alloc, sel,
1532
+ it["type"] as! Int, it["docType"] as! Int, it["featureRef"] as! Int, it["version"] as! Int,
1533
+ it["certificate"], it["issuingCountry"], it["docIssueDate"], BytesData.decode(it["signature"]),
1534
+ it["signatureDate"], it["signer"],
1535
+ (it["certificateChain"] as? [Any])?.compactMap(CertificateChain.decode) ?? [],
1536
+ (it["docFeatures"] as? [Any])?.compactMap(RGLDocFeature.decode) ?? [],
1537
+ it["notifications"]
1538
+ )})
1539
+ }
1540
+ func encode() -> [String: Any?] {
1541
+ return [
1542
+ "type": self.type,
1543
+ "docType": self.docType,
1544
+ "featureRef": self.featureRef,
1545
+ "version": self.version,
1546
+ "certificate": self.certificate,
1547
+ "issuingCountry": self.issuingCountry,
1548
+ "docIssueDate": self.docIssueDate,
1549
+ "signature": self.signature?.encode(),
1550
+ "signatureDate": self.signatureDate,
1551
+ "signer": self.signer,
1552
+ "certificateChain": self.certificateChain.map { $0.encode() },
1553
+ "docFeatures": self.docFeatures.map { $0.encode() },
1554
+ "notifications": self.notifications,
1555
+ ]
1556
+ }
1557
+ }
1558
+
1559
+ public extension DocReader.DeviceRetrievalMethod {
1560
+ static func decode(_ it: Any?) -> Self? {
1561
+ guard let it = it as? [String: Any] else { return nil }
1562
+ let result = Self.emptyInit() as Self
1563
+ if let prop = it["type"] { result.type = eMDLDeviceRetrieval(rawValue: prop as! Int)! }
1564
+ if let prop = it["version"] as? NSNumber { result.version = prop }
1565
+ if let prop = it["cmdMaxLength"] as? NSNumber { result.cmdMaxLength = prop }
1566
+ if let prop = it["respMaxLength"] as? NSNumber { result.respMaxLength = prop }
1567
+ if let prop = it["clientModeSupport"] as? NSNumber { result.clientModeSupport = prop }
1568
+ if let prop = it["clientModeUUID"] as? String { result.clientModeUUID = prop }
1569
+ if let prop = it["serverModeSupport"] as? NSNumber { result.serverModeSupport = prop }
1570
+ if let prop = it["serverModeUUID"] as? String { result.serverModeUUID = prop }
1571
+ return result
1572
+ }
1573
+ func encode() -> [String: Any?] {
1574
+ return [
1575
+ "type": self.type.rawValue,
1576
+ "version": self.version,
1577
+ "cmdMaxLength": self.cmdMaxLength,
1578
+ "respMaxLength": self.respMaxLength,
1579
+ "clientModeSupport": self.clientModeSupport,
1580
+ "clientModeUUID": self.clientModeUUID,
1581
+ "serverModeSupport": self.serverModeSupport,
1582
+ "serverModeUUID": self.serverModeUUID,
1583
+ ]
1584
+ }
1585
+ }
1586
+
1587
+ public extension DocReader.DeviceEngagement {
1588
+ static func decode(_ it: Any?) -> Self? {
1589
+ guard let it = it as? [String: Any] else { return nil }
1590
+ let result = Self()
1591
+ if let prop = it["deviceRetrievalMethods"] { result.deviceRetrievalMethods = (prop as? [Any])?.compactMap(DocReader.DeviceRetrievalMethod.decode) }
1592
+ return result
1593
+ }
1594
+ func encode() -> [String: Any?] {
1595
+ return [
1596
+ "deviceRetrievalMethods": self.deviceRetrievalMethods?.map { $0.encode() },
1597
+ ]
1598
+ }
1599
+ }
1600
+
1601
+ public extension DocReader.NameSpaceMDL {
1602
+ static func decode(_ it: Any?) -> Self? {
1603
+ guard let it = it as? [String: Any] else { return nil }
1604
+ let result = Self(name: it["name"] as! String)
1605
+ for (key, value) in it["map"] as! [String: Int] {
1606
+ result.addField(key, intentToRetain: eMDLIntentToRetain(rawValue: value)!)
1607
+ }
1608
+ return result
1609
+ }
1610
+ func encode() -> [String: Any?] {
1611
+ return [
1612
+ "name": self.name,
1613
+ "map": self.value(forKey: "jsonDict"),
1614
+ ]
1615
+ }
1616
+ }
1617
+
1618
+ public extension DocReader.DocumentRequestMDL {
1619
+ static func decode(_ it: Any?) -> DocReader.DocumentRequestMDL? {
1620
+ guard let it = it as? [String: Any] else { return nil }
1621
+ let docType = it["docType"] as! String
1622
+ if docType == "org.iso.18013.5.1.mDL" { return DocReader.DocumentRequest18013MDL.decode2(it) }
1623
+ let result = DocReader.DocumentRequestMDL(docType: docType)
1624
+ result.setValue((it["namespaces"] as? [Any])?.compactMap(DocReader.NameSpaceMDL.decode) ?? [], forKey: "nameSpaces")
1625
+ return result
1626
+ }
1627
+ func encode() -> [String: Any?] {
1628
+ if let it = self as? DocReader.DocumentRequest18013MDL { return it.encode2() }
1629
+ return [
1630
+ "docType": self.value(forKey: "docType"),
1631
+ "namespaces": (self.value(forKey: "nameSpaces") as? [DocReader.NameSpaceMDL])?.map { $0.encode() },
1632
+ ]
1633
+ }
1634
+ }
1635
+
1636
+ public extension DocReader.DocumentRequest18013MDL {
1637
+ static func decode2(_ it: Any?) -> Self? {
1638
+ guard let it = it as? [String: Any] else { return nil }
1639
+ let result = Self()
1640
+ if let prop = it["docType"] { result.setValue(prop, forKey: "docType") }
1641
+ if let prop = it["namespaces"] as? [Any] {
1642
+ result.setValue(prop.compactMap(DocReader.NameSpaceMDL.decode), forKey: "nameSpaces")
1643
+ }
1644
+ if let prop = it["familyName"] { result.familyName = eMDLIntentToRetain(rawValue: prop as! Int)! }
1645
+ if let prop = it["givenName"] { result.givenName = eMDLIntentToRetain(rawValue: prop as! Int)! }
1646
+ if let prop = it["birthDate"] { result.birthDate = eMDLIntentToRetain(rawValue: prop as! Int)! }
1647
+ if let prop = it["issueDate"] { result.issueDate = eMDLIntentToRetain(rawValue: prop as! Int)! }
1648
+ if let prop = it["expiryDate"] { result.expiryDate = eMDLIntentToRetain(rawValue: prop as! Int)! }
1649
+ if let prop = it["issuingCountry"] { result.issuingCountry = eMDLIntentToRetain(rawValue: prop as! Int)! }
1650
+ if let prop = it["issuingAuthority"] { result.issuingAuthority = eMDLIntentToRetain(rawValue: prop as! Int)! }
1651
+ if let prop = it["documentNumber"] { result.documentNumber = eMDLIntentToRetain(rawValue: prop as! Int)! }
1652
+ if let prop = it["portrait"] { result.portrait = eMDLIntentToRetain(rawValue: prop as! Int)! }
1653
+ if let prop = it["drivingPrivileges"] { result.drivingPrivileges = eMDLIntentToRetain(rawValue: prop as! Int)! }
1654
+ if let prop = it["unDistinguishingSign"] { result.unDistinguishingSign = eMDLIntentToRetain(rawValue: prop as! Int)! }
1655
+ if let prop = it["administrativeNumber"] { result.administrativeNumber = eMDLIntentToRetain(rawValue: prop as! Int)! }
1656
+ if let prop = it["sex"] { result.sex = eMDLIntentToRetain(rawValue: prop as! Int)! }
1657
+ if let prop = it["height"] { result.height = eMDLIntentToRetain(rawValue: prop as! Int)! }
1658
+ if let prop = it["weight"] { result.weight = eMDLIntentToRetain(rawValue: prop as! Int)! }
1659
+ if let prop = it["eyeColour"] { result.eyeColour = eMDLIntentToRetain(rawValue: prop as! Int)! }
1660
+ if let prop = it["hairColour"] { result.hairColour = eMDLIntentToRetain(rawValue: prop as! Int)! }
1661
+ if let prop = it["birthPlace"] { result.birthPlace = eMDLIntentToRetain(rawValue: prop as! Int)! }
1662
+ if let prop = it["residentAddress"] { result.residentAddress = eMDLIntentToRetain(rawValue: prop as! Int)! }
1663
+ if let prop = it["portraitCaptureDate"] { result.portraitCaptureDate = eMDLIntentToRetain(rawValue: prop as! Int)! }
1664
+ if let prop = it["ageInYears"] { result.ageInYears = eMDLIntentToRetain(rawValue: prop as! Int)! }
1665
+ if let prop = it["ageBirthYear"] { result.ageBirthYear = eMDLIntentToRetain(rawValue: prop as! Int)! }
1666
+ if let prop = it["ageOver18"] { result.ageOver18 = eMDLIntentToRetain(rawValue: prop as! Int)! }
1667
+ if let prop = it["issuingJurisdiction"] { result.issuingJurisdiction = eMDLIntentToRetain(rawValue: prop as! Int)! }
1668
+ if let prop = it["nationality"] { result.nationality = eMDLIntentToRetain(rawValue: prop as! Int)! }
1669
+ if let prop = it["residentCity"] { result.residentCity = eMDLIntentToRetain(rawValue: prop as! Int)! }
1670
+ if let prop = it["residentState"] { result.residentState = eMDLIntentToRetain(rawValue: prop as! Int)! }
1671
+ if let prop = it["residentPostalCode"] { result.residentPostalCode = eMDLIntentToRetain(rawValue: prop as! Int)! }
1672
+ if let prop = it["residentCountry"] { result.residentCountry = eMDLIntentToRetain(rawValue: prop as! Int)! }
1673
+ if let prop = it["biometricTemplateFace"] { result.biometricTemplateFace = eMDLIntentToRetain(rawValue: prop as! Int)! }
1674
+ if let prop = it["biometricTemplateIris"] { result.biometricTemplateIris = eMDLIntentToRetain(rawValue: prop as! Int)! }
1675
+ if let prop = it["biometricTemplateFinger"] { result.biometricTemplateFinger = eMDLIntentToRetain(rawValue: prop as! Int)! }
1676
+ if let prop = it["biometricTemplateSignatureSign"] { result.biometricTemplateSignatureSign = eMDLIntentToRetain(rawValue: prop as! Int)! }
1677
+ if let prop = it["familyNameNationalCharacter"] { result.familyNameNationalCharacter = eMDLIntentToRetain(rawValue: prop as! Int)! }
1678
+ if let prop = it["givenNameNationalCharacter"] { result.givenNameNationalCharacter = eMDLIntentToRetain(rawValue: prop as! Int)! }
1679
+ if let prop = it["signatureUsualMark"] { result.signatureUsualMark = eMDLIntentToRetain(rawValue: prop as! Int)! }
1680
+ return result
1681
+ }
1682
+ func encode2() -> [String: Any?] {
1683
+ return [
1684
+ "docType": self.value(forKey: "docType"),
1685
+ "namespaces": (self.value(forKey: "nameSpaces") as? [DocReader.NameSpaceMDL])?.map { $0.encode() },
1686
+ "familyName": self.familyName.encode(),
1687
+ "givenName": self.givenName.encode(),
1688
+ "birthDate": self.birthDate.encode(),
1689
+ "issueDate": self.issueDate.encode(),
1690
+ "expiryDate": self.expiryDate.encode(),
1691
+ "issuingCountry": self.issuingCountry.encode(),
1692
+ "issuingAuthority": self.issuingAuthority.encode(),
1693
+ "documentNumber": self.documentNumber.encode(),
1694
+ "portrait": self.portrait.encode(),
1695
+ "drivingPrivileges": self.drivingPrivileges.encode(),
1696
+ "unDistinguishingSign": self.unDistinguishingSign.encode(),
1697
+ "administrativeNumber": self.administrativeNumber.encode(),
1698
+ "sex": self.sex.encode(),
1699
+ "height": self.height.encode(),
1700
+ "weight": self.weight.encode(),
1701
+ "eyeColour": self.eyeColour.encode(),
1702
+ "hairColour": self.hairColour.encode(),
1703
+ "birthPlace": self.birthPlace.encode(),
1704
+ "residentAddress": self.residentAddress.encode(),
1705
+ "portraitCaptureDate": self.portraitCaptureDate.encode(),
1706
+ "ageInYears": self.ageInYears.encode(),
1707
+ "ageBirthYear": self.ageBirthYear.encode(),
1708
+ "ageOver18": self.ageOver18.encode(),
1709
+ "issuingJurisdiction": self.issuingJurisdiction.encode(),
1710
+ "nationality": self.nationality.encode(),
1711
+ "residentCity": self.residentCity.encode(),
1712
+ "residentState": self.residentState.encode(),
1713
+ "residentPostalCode": self.residentPostalCode.encode(),
1714
+ "residentCountry": self.residentCountry.encode(),
1715
+ "biometricTemplateFace": self.biometricTemplateFace.encode(),
1716
+ "biometricTemplateIris": self.biometricTemplateIris.encode(),
1717
+ "biometricTemplateFinger": self.biometricTemplateFinger.encode(),
1718
+ "biometricTemplateSignatureSign": self.biometricTemplateSignatureSign.encode(),
1719
+ "familyNameNationalCharacter": self.familyNameNationalCharacter.encode(),
1720
+ "givenNameNationalCharacter": self.givenNameNationalCharacter.encode(),
1721
+ "signatureUsualMark": self.signatureUsualMark.encode(),
1722
+ ]
1723
+ }
1724
+ }
1725
+
1726
+ public extension DocReader.DataRetrieval {
1727
+ static func decode(_ it: Any?) -> Self? {
1728
+ guard let it = it as? [String: Any] else { return nil }
1729
+ let result = Self(deviceRetrieval: eMDLDeviceRetrieval(rawValue: it["deviceRetrieval"] as! Int)!)
1730
+ if let prop = it["docRequestPreset"] as? Int {
1731
+ result.setDocRequestPreset(eMDLDocRequestPreset(rawValue: prop)!, intentToRetain: eMDLIntentToRetain(rawValue: it["intentToRetain"] as! Int)!)
1732
+ }
1733
+ result.requests = (it["requests"] as? [Any])?.compactMap(DocReader.DocumentRequestMDL.decode) ?? []
1734
+ return result
1735
+ }
1736
+ func encode() -> [String: Any?] {
1737
+ return [
1738
+ "deviceRetrieval": self.value(forKey: "deviceRetrieval"),
1739
+ "docRequestPreset": self.value(forKey: "docRequestPreset"),
1740
+ "intentToRetain": self.value(forKey: "intentToRetain"),
1741
+ "requests": self.requests.map { $0.encode() },
1742
+ ]
1743
+ }
1744
+ }
1745
+
1746
+ public extension DocReader.FinalizeConfig {
1747
+ static func decode(_ it: Any?) -> Self? {
1748
+ guard let it = it as? [String: Any] else { return nil }
1749
+ let result = Self.defaultParams()
1750
+ if let prop = it["rawImages"] as? Bool { result.rawImages = prop }
1751
+ if let prop = it["video"] as? Bool { result.video = prop }
1752
+ if let prop = it["rfidSession"] as? Bool { result.rfidSession = prop }
1753
+ if let prop = it["mdlSession"] as? Bool { result.mdlSession = prop }
1754
+ return result
1755
+ }
1756
+ func encode() -> [String: Any?] {
1757
+ return [
1758
+ "rawImages": self.rawImages,
1759
+ "video": self.video,
1760
+ "rfidSession": self.rfidSession,
1761
+ "mdlSession": self.mdlSession,
1762
+ ]
1763
+ }
1764
+ }
1765
+
1766
+ public extension RGLRFIDAccessControlPACE {
1767
+ static func decode(_ it: Any?) -> Self? {
1768
+ guard let it = it as? [String: Any] else { return nil }
1769
+ let result = Self.emptyInit() as Self
1770
+ if let prop = it["version"] { result.version = Int(prop as! String)! }
1771
+ if let prop = it["stdDomainParams"] as? String { result.stdDomainParams = prop }
1772
+ if let prop = it["keyAlgorithm"] as? String { result.keyAlgorithm = prop }
1773
+ return result
1774
+ }
1775
+ func encode() -> [String: Any?] {
1776
+ return [
1777
+ "version": String(self.version),
1778
+ "stdDomainParams": self.stdDomainParams,
1779
+ "keyAlgorithm": self.keyAlgorithm,
1780
+ ]
1781
+ }
1782
+ }
1783
+
1784
+ public extension RGLRFIDAccessControlCA {
1785
+ static func decode(_ it: Any?) -> Self? {
1786
+ guard let it = it as? [String: Any] else { return nil }
1787
+ let result = Self.emptyInit() as Self
1788
+ if let prop = it["version"] { result.version = Int(prop as! String)! }
1789
+ if let prop = it["scheme"] as? String { result.scheme = prop }
1790
+ if let prop = it["keyAlgorithm"] as? String { result.keyAlgorithm = prop }
1791
+ if let prop = it["chipIndividual"] as? Bool { result.chipIndividual = prop }
1792
+ return result
1793
+ }
1794
+ func encode() -> [String: Any?] {
1795
+ return [
1796
+ "version": String(self.version),
1797
+ "scheme": self.scheme,
1798
+ "keyAlgorithm": self.keyAlgorithm,
1799
+ "chipIndividual": self.chipIndividual,
1800
+ ]
1801
+ }
1802
+ }
1803
+
1804
+ // MARK: - Results
1805
+
1806
+ public extension DocumentReaderResults {
1807
+ static func decode(_ it: Any?) -> Self? {
1808
+ guard let it = it as? [String: Any] else { return nil }
1809
+ let result = Self.emptyInit() as Self
1810
+ result.setValue((it["documentType"] as? [Any])?.compactMap(DocumentReaderDocumentType.decode), forKey: "documentType")
1811
+ result.setValue(DocumentReaderTextResult.decode(it["textResult"]), forKey: "textResult")
1812
+ result.setValue(DocumentReaderGraphicResult.decode(it["graphicResult"]), forKey: "graphicResult")
1813
+ result.setValue((it["documentPosition"] as? [Any])?.compactMap(DocumentPosition.decode), forKey: "documentPosition")
1814
+ result.setValue((it["barcodePosition"] as? [Any])?.compactMap(BarcodePosition.decode), forKey: "barcodePosition")
1815
+ result.setValue((it["mrzPosition"] as? [Any])?.compactMap(MrzPosition.decode), forKey: "mrzPosition")
1816
+ result.setValue((it["imageQuality"] as? [Any])?.compactMap(ImageQualityGroup.decode), forKey: "imageQualityGroup")
1817
+ result.setValue(DocumentReaderAuthenticityResult.decode(it["authenticityResult"]), forKey: "authenticityResults")
1818
+ result.setValue(RFIDSessionData.decode(it["rfidSessionData"]), forKey: "rfidSessionData")
1819
+ result.setValue(it["chipPage"] as? Int, forKey: "chipPage")
1820
+ result.setValue(DocumentReaderBarcodeResult.decode(it["barcodeResult"]), forKey: "barcodeResult")
1821
+ result.setValue(it["processingFinishedStatus"] as Any?, forKey: "processingFinishedStatus")
1822
+ result.setValue(it["morePagesAvailable"] as? Int, forKey: "morePagesAvailable")
1823
+ result.setValue(it["elapsedTime"] as? Int, forKey: "elapsedTime")
1824
+ result.setValue(it["elapsedTimeRFID"] as? Int, forKey: "elapsedTimeRFID")
1825
+ result.setValue(it["rawResult"] as? String, forKey: "rawResult")
1826
+ result.setValue(it["bsiTr03135Results"] as? String, forKey: "bsiTr03135Results")
1827
+ result.setValue(DocumentReaderResults.Status.decode(it["status"]), forKey: "status")
1828
+ result.setValue(VDSNCData.decode(it["vdsncData"]), forKey: "vdsncData")
1829
+ result.setValue(VDSData.decode(it["vdsData"]), forKey: "vdsData")
1830
+ result.setValue(Data.decode(it["dtcData"]), forKey: "dtcData")
1831
+ result.setValue(RGLTransactionInfo.decode(it["transactionInfo"]), forKey: "transactionInfo")
1832
+ return result
1833
+ }
1834
+ func encode() -> [String: Any?] {
1835
+ return [
1836
+ "documentType": self.documentType?.map { $0.encode() },
1837
+ "textResult": self.textResult.encode(),
1838
+ "graphicResult": self.graphicResult.encode(),
1839
+ "documentPosition": self.documentPosition?.map { $0.encode() },
1840
+ "barcodePosition": self.barcodePosition?.map { $0.encode() },
1841
+ "mrzPosition": self.mrzPosition?.map { $0.encode() },
1842
+ "imageQuality": self.imageQualityGroup?.map { $0.encode() },
1843
+ "authenticityResult": self.authenticityResults?.encode(),
1844
+ "rfidSessionData": self.rfidSessionData?.encode(),
1845
+ "chipPage": self.chipPage,
1846
+ "barcodeResult": self.barcodeResult.encode(),
1847
+ "processingFinishedStatus": self.processingFinishedStatus.rawValue,
1848
+ "morePagesAvailable": self.morePagesAvailable,
1849
+ "elapsedTime": self.elapsedTime,
1850
+ "elapsedTimeRFID": self.elapsedTimeRFID,
1851
+ "rawResult": self.rawResult,
1852
+ "bsiTr03135Results": self.bsiTr03135Results,
1853
+ "status": self.status.encode(),
1854
+ "vdsncData": self.vdsncData?.encode(),
1855
+ "vdsData": self.vdsData?.encode(),
1856
+ "dtcData": self.dtcData?.encode(),
1857
+ "transactionInfo": self.transactionInfo?.encode(),
1858
+ ]
1859
+ }
1860
+ }
1861
+
1862
+ // MARK: - Converting
1863
+
1864
+ public extension CGRect {
1865
+ static func decode(_ it: Any?) -> Self {
1866
+ guard let it = it as? [String: Any] else { return .zero }
1867
+ let left = it["left"] as? CGFloat ?? 0
1868
+ let top = it["top"] as? CGFloat ?? 0
1869
+ return Self(x: left, y: top,
1870
+ width: (it["right"] as? CGFloat ?? 0) - left,
1871
+ height: (it["bottom"] as? CGFloat ?? 0) - top)
1872
+ }
1873
+ func encode() -> [String: Any?]? {
1874
+ if self.origin.x == 0 && self.origin.y == 0 { return nil }
1875
+ return [
1876
+ "top": self.origin.y,
1877
+ "left": self.origin.x,
1878
+ "bottom": self.origin.y + self.size.height,
1879
+ "right": self.origin.x + self.size.width,
1880
+ ]
1881
+ }
1882
+ }
1883
+
1884
+ public extension CGPoint {
1885
+ static func decode(_ it: Any?) -> Self {
1886
+ guard let it = it as? [String: Any] else { return .zero }
1887
+ return Self(x: it["x"] as? CGFloat ?? 0,
1888
+ y: it["y"] as? CGFloat ?? 0)
1889
+ }
1890
+ func encode() -> [String: Any?] {
1891
+ return ["x": self.x, "y": self.y]
1892
+ }
1893
+ }
1894
+
1895
+ public extension Error {
1896
+ func encode() -> [String: Any?] {
1897
+ let it = self as NSError
1898
+ return ["code": it.code, "message": it.localizedDescription]
1899
+ }
1900
+ }
1901
+
1902
+ func generateSuccessCompletion(_ success: Bool, _ error: Error?) -> [String: Any?] {
1903
+ return ["success": success, "error": error?.encode()]
1904
+ }
1905
+
1906
+ func generateCompletion(_ action: Int, _ results: DocumentReaderResults?, _ error: Error?) -> [String: Any?] {
1907
+ return [
1908
+ "action": action,
1909
+ "results": [0, 2, 3, 4, 6].contains(action) ? results?.encode() : nil,
1910
+ "error": error?.encode(),
1911
+ ]
1912
+ }
1913
+
1914
+ func generateDeviceEngagementCompletion(_ deviceEngagement: DocReader.DeviceEngagement?, _ error: Error?) -> [String: Any?] {
1915
+ return ["deviceEngagement": deviceEngagement?.encode(), "error": error?.encode()]
1916
+ }
1917
+
1918
+ func generateFinalizePackageCompletion(_ action: Int, _ info: RGLTransactionInfo?, _ error: Error?) -> [String: Any?] {
1919
+ return ["action": action, "info": info?.encode(), "error": error?.encode()]
1920
+ }
1921
+
1922
+ extension eMDLIntentToRetain {
1923
+ func encode() -> Int? {
1924
+ return self.rawValue == -1 ? nil : self.rawValue
1925
+ }
1926
+ }
1927
+
1928
+ extension DocReaderAction {
1929
+ func encode() -> Int {
1930
+ switch self {
1931
+ case .complete: return 0
1932
+ case .process: return 1
1933
+ case .morePagesAvailable: return 2
1934
+ case .cancel: return 3
1935
+ case .processWhiteFlashLight: return 5
1936
+ case .processTimeout: return 6
1937
+ case .processOnServer: return 7
1938
+ default: return 4
1939
+ }
1940
+ }
1941
+ }
1942
+
1943
+ extension RFIDCompleteAction {
1944
+ func encode() -> Int {
1945
+ switch self {
1946
+ case .error: return 4
1947
+ case .cancel: return 3
1948
+ default: return 0
1949
+ }
1950
+ }
1951
+ }
1952
+
1953
+ extension DocReader.BleConfig {
1954
+ static func decode(_ it: [String: Any], _ bluetooth: Bluetooth) -> DocReader.BleConfig {
1955
+ return DocReader.BleConfig(bluetooth: bluetooth).update(it)
1956
+ }
1957
+ }
1958
+
1959
+ public extension NSError {
1960
+ static func decode(_ it: Any?) -> NSError? {
1961
+ guard let it = it as? [String: Any] else { return nil }
1962
+ return NSError(domain: RGLDocumentReaderDomain, code: it["code"] as! Int,
1963
+ userInfo: [NSLocalizedDescriptionKey: it["message"] as! String])
1964
+ }
1965
+ }