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