@firela/api-types 0.0.0-canary.209967 → 0.0.0-canary.32edff08

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.
@@ -8,6 +8,12 @@ export const $CreateAccountDto = {
8
8
  description: 'Account path (hierarchical, colon-separated)',
9
9
  example: 'Assets:CN:Bank:ICBC:Checking'
10
10
  },
11
+ displayName: {
12
+ type: 'string',
13
+ description:
14
+ 'Display name to distinguish accounts at the same path (default: "")',
15
+ example: '工资卡'
16
+ },
11
17
  openDate: {
12
18
  format: 'date-time',
13
19
  type: 'string',
@@ -86,6 +92,12 @@ export const $AccountResponseDto = {
86
92
  description: 'Account path (hierarchical, colon-separated)',
87
93
  example: 'Assets:CN:Bank:ICBC:Checking'
88
94
  },
95
+ displayName: {
96
+ type: 'string',
97
+ description:
98
+ 'Display name distinguishing multiple accounts at the same path',
99
+ example: '工资卡'
100
+ },
89
101
  type: {
90
102
  type: 'string',
91
103
  description: 'Account type (root segment)',
@@ -180,6 +192,7 @@ export const $AccountResponseDto = {
180
192
  required: [
181
193
  'id',
182
194
  'path',
195
+ 'displayName',
183
196
  'type',
184
197
  'status',
185
198
  'openDate',
@@ -212,6 +225,11 @@ export const $AccountListResponseDto = {
212
225
  export const $UpdateAccountDto = {
213
226
  type: 'object',
214
227
  properties: {
228
+ displayName: {
229
+ type: 'string',
230
+ description: 'Display name to distinguish accounts at the same path',
231
+ example: '招行工资卡'
232
+ },
215
233
  currencies: {
216
234
  description: 'Allowed currencies (null = no restriction)',
217
235
  example: ['CNY', 'USD'],
@@ -251,7 +269,7 @@ export const $UpdateAccountDto = {
251
269
  }
252
270
  },
253
271
  platformId: {
254
- type: 'object',
272
+ type: 'string',
255
273
  description:
256
274
  'Platform ID (references Platform.id), null to clear association',
257
275
  example: 'c98e5d4a-2f71-4a5a-bb3c-92c9f231d5e2',
@@ -292,6 +310,162 @@ export const $ReopenAccountDto = {
292
310
  }
293
311
  } as const;
294
312
 
313
+ export const $AccountStandardResponseDto = {
314
+ type: 'object',
315
+ properties: {
316
+ path: {
317
+ type: 'string',
318
+ description: 'Account path (hierarchical, colon-separated)',
319
+ example: 'Assets:CN:Bank:ICBC:Checking'
320
+ },
321
+ type: {
322
+ type: 'string',
323
+ description: 'Account type in Beancount hierarchy',
324
+ enum: ['Assets', 'Liabilities', 'Income', 'Expenses', 'Equity'],
325
+ example: 'Assets'
326
+ },
327
+ i18nKey: {
328
+ type: 'string',
329
+ description: 'i18n key for localized display name',
330
+ example: 'account.assets.cn.bank.icbc.checking'
331
+ },
332
+ name: {
333
+ type: 'string',
334
+ description: 'Short localized display name',
335
+ example: 'Housing Fund'
336
+ },
337
+ description: {
338
+ type: 'string',
339
+ description: 'Account description (stable semantics only)',
340
+ example: 'ICBC checking account for daily transactions'
341
+ },
342
+ tags: {
343
+ description: 'Account tags for categorization',
344
+ example: ['bank', 'checking', 'primary'],
345
+ type: 'array',
346
+ items: {
347
+ type: 'string'
348
+ }
349
+ },
350
+ icon: {
351
+ type: 'string',
352
+ description: 'Icon identifier for UI display',
353
+ example: 'bank-icbc'
354
+ }
355
+ },
356
+ required: ['path', 'type', 'i18nKey', 'description', 'tags', 'icon']
357
+ } as const;
358
+
359
+ export const $AccountStandardListResponseDto = {
360
+ type: 'object',
361
+ properties: {
362
+ items: {
363
+ description: 'Array of account templates',
364
+ type: 'array',
365
+ items: {
366
+ $ref: '#/components/schemas/AccountStandardResponseDto'
367
+ }
368
+ },
369
+ total: {
370
+ type: 'number',
371
+ description: 'Total number of account templates',
372
+ example: 150
373
+ },
374
+ region: {
375
+ type: 'string',
376
+ description: 'Region code',
377
+ example: 'CN'
378
+ }
379
+ },
380
+ required: ['items', 'total', 'region']
381
+ } as const;
382
+
383
+ export const $TemplateMetadataDto = {
384
+ type: 'object',
385
+ properties: {
386
+ extendable: {
387
+ type: 'boolean',
388
+ description: 'Whether this path can be extended',
389
+ example: true
390
+ },
391
+ rootType: {
392
+ type: 'string',
393
+ description: 'Root account type',
394
+ example: 'Assets'
395
+ }
396
+ },
397
+ required: ['extendable', 'rootType']
398
+ } as const;
399
+
400
+ export const $TemplateMetadataResponseDto = {
401
+ type: 'object',
402
+ properties: {
403
+ metadata: {
404
+ $ref: '#/components/schemas/TemplateMetadataDto'
405
+ }
406
+ }
407
+ } as const;
408
+
409
+ export const $RegionConfigDto = {
410
+ type: 'object',
411
+ properties: {
412
+ currency: {
413
+ type: 'string',
414
+ example: 'EUR'
415
+ },
416
+ dateFormat: {
417
+ type: 'string',
418
+ example: 'DD.MM.YYYY'
419
+ },
420
+ locale: {
421
+ type: 'string',
422
+ example: 'de-DE'
423
+ }
424
+ },
425
+ required: ['currency', 'dateFormat', 'locale']
426
+ } as const;
427
+
428
+ export const $RegionInfoDto = {
429
+ type: 'object',
430
+ properties: {
431
+ code: {
432
+ type: 'string',
433
+ example: 'de'
434
+ },
435
+ displayName: {
436
+ type: 'string',
437
+ example: 'Germany'
438
+ },
439
+ parent: {
440
+ type: 'string'
441
+ },
442
+ chain: {
443
+ example: ['de'],
444
+ type: 'array',
445
+ items: {
446
+ type: 'string'
447
+ }
448
+ },
449
+ config: {
450
+ $ref: '#/components/schemas/RegionConfigDto'
451
+ }
452
+ },
453
+ required: ['code', 'displayName', 'chain', 'config']
454
+ } as const;
455
+
456
+ export const $RegionsMetadataResponseDto = {
457
+ type: 'object',
458
+ properties: {
459
+ regions: {
460
+ type: 'array',
461
+ items: {
462
+ $ref: '#/components/schemas/RegionInfoDto'
463
+ }
464
+ }
465
+ },
466
+ required: ['regions']
467
+ } as const;
468
+
295
469
  export const $CreatePostingDto = {
296
470
  type: 'object',
297
471
  properties: {
@@ -409,7 +583,8 @@ export const $PostingResponseDto = {
409
583
  },
410
584
  units: {
411
585
  type: 'string',
412
- description: 'Amount (may be null if interpolated)',
586
+ description:
587
+ 'Amount as decimal string. Typed optional but always present in responses: interpolation fills any MISSING posting before it is persisted or returned.',
413
588
  example: '100.50'
414
589
  },
415
590
  currency: {
@@ -607,6 +782,65 @@ export const $ApiProblemResponseDto = {
607
782
  required: ['type', 'title', 'status', 'detail']
608
783
  } as const;
609
784
 
785
+ export const $BatchCreateTransactionDto = {
786
+ type: 'object',
787
+ properties: {
788
+ transactions: {
789
+ description: 'Array of transactions to create',
790
+ minItems: 1,
791
+ maxItems: 100,
792
+ type: 'array',
793
+ items: {
794
+ $ref: '#/components/schemas/CreateTransactionDto'
795
+ }
796
+ }
797
+ },
798
+ required: ['transactions']
799
+ } as const;
800
+
801
+ export const $BatchTransactionErrorDto = {
802
+ type: 'object',
803
+ properties: {
804
+ index: {
805
+ type: 'number',
806
+ description: 'Index of failed transaction in the input array',
807
+ example: 0
808
+ },
809
+ error: {
810
+ type: 'string',
811
+ description: 'Error message describing the failure',
812
+ example: 'Transaction does not balance'
813
+ },
814
+ errorCode: {
815
+ type: 'string',
816
+ description: 'Structured error code for programmatic handling',
817
+ example: 'INSUFFICIENT_QUANTITY'
818
+ }
819
+ },
820
+ required: ['index', 'error']
821
+ } as const;
822
+
823
+ export const $BatchTransactionResponseDto = {
824
+ type: 'object',
825
+ properties: {
826
+ succeeded: {
827
+ description: 'Successfully created transactions',
828
+ type: 'array',
829
+ items: {
830
+ $ref: '#/components/schemas/TransactionResponseDto'
831
+ }
832
+ },
833
+ failed: {
834
+ description: 'Failed transactions with error details',
835
+ type: 'array',
836
+ items: {
837
+ $ref: '#/components/schemas/BatchTransactionErrorDto'
838
+ }
839
+ }
840
+ },
841
+ required: ['succeeded', 'failed']
842
+ } as const;
843
+
610
844
  export const $PostingDetailDto = {
611
845
  type: 'object',
612
846
  properties: {
@@ -627,7 +861,8 @@ export const $PostingDetailDto = {
627
861
  },
628
862
  units: {
629
863
  type: 'string',
630
- description: 'Amount (may be null if interpolated)',
864
+ description:
865
+ 'Amount as decimal string. Typed optional but always present in responses: interpolation fills any MISSING posting before it is persisted or returned.',
631
866
  example: '100.50'
632
867
  },
633
868
  currency: {
@@ -742,8 +977,8 @@ export const $TransactionDetailDto = {
742
977
  },
743
978
  sourceType: {
744
979
  type: 'string',
745
- description: 'Source type (how the transaction was created)',
746
- enum: ['NLP', 'CSV', 'OCR', 'API']
980
+ description:
981
+ 'Source type (free-form string from transaction metadata, e.g. import, api)'
747
982
  },
748
983
  sourcePlatform: {
749
984
  type: 'string',
@@ -819,6 +1054,37 @@ export const $TransactionListResponseDto = {
819
1054
  required: ['data', 'total', 'limit', 'offset']
820
1055
  } as const;
821
1056
 
1057
+ export const $TagSuggestionDto = {
1058
+ type: 'object',
1059
+ properties: {
1060
+ tag: {
1061
+ type: 'string',
1062
+ description: 'Tag name',
1063
+ example: 'Monthly'
1064
+ },
1065
+ count: {
1066
+ type: 'number',
1067
+ description: 'Usage count across ACTIVE transactions',
1068
+ example: 12
1069
+ }
1070
+ },
1071
+ required: ['tag', 'count']
1072
+ } as const;
1073
+
1074
+ export const $TagSuggestionsResponseDto = {
1075
+ type: 'object',
1076
+ properties: {
1077
+ data: {
1078
+ description: 'Tag suggestions sorted as requested',
1079
+ type: 'array',
1080
+ items: {
1081
+ $ref: '#/components/schemas/TagSuggestionDto'
1082
+ }
1083
+ }
1084
+ },
1085
+ required: ['data']
1086
+ } as const;
1087
+
822
1088
  export const $UpdateTransactionDto = {
823
1089
  type: 'object',
824
1090
  properties: {
@@ -876,157 +1142,31 @@ export const $UpdateTransactionDto = {
876
1142
  }
877
1143
  } as const;
878
1144
 
879
- export const $AccountStandardResponseDto = {
1145
+ export const $BalanceResponseDto = {
880
1146
  type: 'object',
881
1147
  properties: {
882
- path: {
883
- type: 'string',
884
- description: 'Account path (hierarchical, colon-separated)',
885
- example: 'Assets:CN:Bank:ICBC:Checking'
886
- },
887
- type: {
1148
+ account: {
888
1149
  type: 'string',
889
- description: 'Account type in Beancount hierarchy',
890
- enum: ['Assets', 'Liabilities', 'Income', 'Expenses', 'Equity'],
891
- example: 'Assets'
1150
+ description: 'Account name',
1151
+ example: 'Assets:Bank:Checking'
892
1152
  },
893
- i18nKey: {
1153
+ balance: {
894
1154
  type: 'string',
895
- description: 'i18n key for localized display name',
896
- example: 'account.assets.cn.bank.icbc.checking'
1155
+ description: 'Balance amount (decimal string for precision)',
1156
+ example: '12345.67'
897
1157
  },
898
- description: {
1158
+ currency: {
899
1159
  type: 'string',
900
- description: 'Account description',
901
- example: 'ICBC checking account for daily transactions'
902
- },
903
- tags: {
904
- description: 'Account tags for categorization',
905
- example: ['bank', 'checking', 'primary'],
906
- type: 'array',
907
- items: {
908
- type: 'string'
909
- }
1160
+ description: 'Currency code',
1161
+ example: 'USD'
910
1162
  },
911
- icon: {
1163
+ date: {
912
1164
  type: 'string',
913
- description: 'Icon identifier for UI display',
914
- example: 'bank-icbc'
1165
+ description: 'Date of the balance calculation (ISO 8601)',
1166
+ example: '2024-12-31T00:00:00.000Z'
915
1167
  }
916
1168
  },
917
- required: ['path', 'type']
918
- } as const;
919
-
920
- export const $AccountStandardListResponseDto = {
921
- type: 'object',
922
- properties: {
923
- items: {
924
- description: 'Array of account templates',
925
- type: 'array',
926
- items: {
927
- $ref: '#/components/schemas/AccountStandardResponseDto'
928
- }
929
- },
930
- total: {
931
- type: 'number',
932
- description: 'Total number of account templates',
933
- example: 150
934
- },
935
- region: {
936
- type: 'string',
937
- description: 'Region code',
938
- example: 'CN'
939
- }
940
- },
941
- required: ['items', 'total', 'region']
942
- } as const;
943
-
944
- export const $RegionConfigDto = {
945
- type: 'object',
946
- properties: {
947
- currency: {
948
- type: 'string',
949
- example: 'EUR'
950
- },
951
- dateFormat: {
952
- type: 'string',
953
- example: 'DD.MM.YYYY'
954
- },
955
- locale: {
956
- type: 'string',
957
- example: 'de-DE'
958
- }
959
- },
960
- required: ['currency', 'dateFormat', 'locale']
961
- } as const;
962
-
963
- export const $RegionInfoDto = {
964
- type: 'object',
965
- properties: {
966
- code: {
967
- type: 'string',
968
- example: 'de'
969
- },
970
- displayName: {
971
- type: 'string',
972
- example: 'Germany'
973
- },
974
- parent: {
975
- type: 'string',
976
- example: 'eu-core'
977
- },
978
- chain: {
979
- example: ['eu-core', 'de'],
980
- type: 'array',
981
- items: {
982
- type: 'string'
983
- }
984
- },
985
- config: {
986
- $ref: '#/components/schemas/RegionConfigDto'
987
- }
988
- },
989
- required: ['code', 'displayName', 'chain', 'config']
990
- } as const;
991
-
992
- export const $RegionsMetadataResponseDto = {
993
- type: 'object',
994
- properties: {
995
- regions: {
996
- type: 'array',
997
- items: {
998
- $ref: '#/components/schemas/RegionInfoDto'
999
- }
1000
- }
1001
- },
1002
- required: ['regions']
1003
- } as const;
1004
-
1005
- export const $BalanceResponseDto = {
1006
- type: 'object',
1007
- properties: {
1008
- account: {
1009
- type: 'string',
1010
- description: 'Account name',
1011
- example: 'Assets:Bank:Checking'
1012
- },
1013
- balance: {
1014
- type: 'string',
1015
- description: 'Balance amount (decimal string for precision)',
1016
- example: '12345.67'
1017
- },
1018
- currency: {
1019
- type: 'string',
1020
- description: 'Currency code',
1021
- example: 'USD'
1022
- },
1023
- date: {
1024
- type: 'string',
1025
- description: 'Date of the balance calculation (ISO 8601)',
1026
- example: '2024-12-31T00:00:00.000Z'
1027
- }
1028
- },
1029
- required: ['account', 'balance', 'currency', 'date']
1169
+ required: ['account', 'balance', 'currency', 'date']
1030
1170
  } as const;
1031
1171
 
1032
1172
  export const $MultiCurrencyBalanceResponseDto = {
@@ -1095,8 +1235,8 @@ export const $TransactionSummaryDto = {
1095
1235
  },
1096
1236
  sourceType: {
1097
1237
  type: 'string',
1098
- description: 'Source type (NLP, CSV, OCR, API)',
1099
- enum: ['NLP', 'CSV', 'OCR', 'API']
1238
+ description:
1239
+ 'Source type (free-form string from transaction metadata, e.g. import, api)'
1100
1240
  },
1101
1241
  sourcePlatform: {
1102
1242
  type: 'string',
@@ -1136,12 +1276,23 @@ export const $ReviewSummaryDto = {
1136
1276
  },
1137
1277
  confidenceLevel: {
1138
1278
  type: 'string',
1139
- description: 'Confidence level derived from score',
1140
- enum: ['HIGH', 'MEDIUM', 'LOW']
1279
+ description:
1280
+ 'Confidence level derived from score. Null for error-type reviews (ACCOUNT_VALIDATION/PIPELINE_ERROR) which carry no confidence.',
1281
+ enum: ['HIGH', 'MEDIUM', 'LOW'],
1282
+ nullable: true
1141
1283
  },
1142
- summary: {
1284
+ summaryKey: {
1143
1285
  type: 'string',
1144
- description: 'Human-readable summary of the review item'
1286
+ description:
1287
+ 'i18n message key for summary (e.g., review.summary.duplicate). Translate on frontend with summaryParams.'
1288
+ },
1289
+ summaryParams: {
1290
+ type: 'object',
1291
+ description:
1292
+ 'Parameters for summary message interpolation (e.g., { date: "2024-01-15", amount: "50" })',
1293
+ additionalProperties: {
1294
+ type: 'string'
1295
+ }
1145
1296
  },
1146
1297
  matchReasons: {
1147
1298
  description: 'Human-readable reasons for branching',
@@ -1152,7 +1303,8 @@ export const $ReviewSummaryDto = {
1152
1303
  },
1153
1304
  sourceType: {
1154
1305
  type: 'string',
1155
- description: 'Source type (NLP, CSV, OCR, API)'
1306
+ description:
1307
+ 'Source type (free-form string from transaction metadata, e.g. import, api)'
1156
1308
  },
1157
1309
  sourcePlatform: {
1158
1310
  type: 'string',
@@ -1201,7 +1353,7 @@ export const $ReviewSummaryDto = {
1201
1353
  'status',
1202
1354
  'confidence',
1203
1355
  'confidenceLevel',
1204
- 'summary',
1356
+ 'summaryKey',
1205
1357
  'matchReasons',
1206
1358
  'sourceType',
1207
1359
  'createdAt'
@@ -1262,7 +1414,20 @@ export const $DecisionOptionDto = {
1262
1414
  properties: {
1263
1415
  value: {
1264
1416
  type: 'string',
1265
- description: 'The action value to submit (e.g., UPGRADE_REPLACE, ACCEPT)'
1417
+ description: 'The action value to submit (e.g., UPGRADE_REPLACE, ACCEPT)',
1418
+ enum: [
1419
+ 'UPGRADE_REPLACE',
1420
+ 'LINK_KEEP_BOTH',
1421
+ 'IGNORE_NEW',
1422
+ 'CONFIRM_DIFFERENT',
1423
+ 'ACCEPT',
1424
+ 'REJECT',
1425
+ 'ACCEPT_AND_LEARN',
1426
+ 'CHOOSE_OTHER',
1427
+ 'CANCEL',
1428
+ 'FIX',
1429
+ 'IGNORE'
1430
+ ]
1266
1431
  },
1267
1432
  labelKey: {
1268
1433
  type: 'string',
@@ -1310,12 +1475,23 @@ export const $ReviewDetailDto = {
1310
1475
  },
1311
1476
  confidenceLevel: {
1312
1477
  type: 'string',
1313
- description: 'Confidence level derived from score',
1314
- enum: ['HIGH', 'MEDIUM', 'LOW']
1478
+ description:
1479
+ 'Confidence level derived from score. Null for error-type reviews (ACCOUNT_VALIDATION/PIPELINE_ERROR) which carry no confidence.',
1480
+ enum: ['HIGH', 'MEDIUM', 'LOW'],
1481
+ nullable: true
1315
1482
  },
1316
- summary: {
1483
+ summaryKey: {
1317
1484
  type: 'string',
1318
- description: 'Human-readable summary of the review item'
1485
+ description:
1486
+ 'i18n message key for summary (e.g., review.summary.duplicate). Translate on frontend with summaryParams.'
1487
+ },
1488
+ summaryParams: {
1489
+ type: 'object',
1490
+ description:
1491
+ 'Parameters for summary message interpolation (e.g., { date: "2024-01-15", amount: "50" })',
1492
+ additionalProperties: {
1493
+ type: 'string'
1494
+ }
1319
1495
  },
1320
1496
  matchReasons: {
1321
1497
  description: 'Human-readable reasons for branching',
@@ -1326,7 +1502,8 @@ export const $ReviewDetailDto = {
1326
1502
  },
1327
1503
  sourceType: {
1328
1504
  type: 'string',
1329
- description: 'Source type (NLP, CSV, OCR, API)'
1505
+ description:
1506
+ 'Source type (free-form string from transaction metadata, e.g. import, api)'
1330
1507
  },
1331
1508
  sourcePlatform: {
1332
1509
  type: 'string',
@@ -1391,7 +1568,7 @@ export const $ReviewDetailDto = {
1391
1568
  'status',
1392
1569
  'confidence',
1393
1570
  'confidenceLevel',
1394
- 'summary',
1571
+ 'summaryKey',
1395
1572
  'matchReasons',
1396
1573
  'sourceType',
1397
1574
  'createdAt',
@@ -1400,131 +1577,333 @@ export const $ReviewDetailDto = {
1400
1577
  ]
1401
1578
  } as const;
1402
1579
 
1403
- export const $PayeeResponseDto = {
1580
+ export const $ResolveReviewDto = {
1404
1581
  type: 'object',
1405
1582
  properties: {
1406
- id: {
1583
+ action: {
1407
1584
  type: 'string',
1408
- description: 'Unique identifier (UUID)',
1409
- example: 'uuid-123-456'
1585
+ description:
1586
+ 'Decision action. Valid actions vary by review type — see DecisionOptionDto.value returned by the review detail endpoint.',
1587
+ enum: [
1588
+ 'UPGRADE_REPLACE',
1589
+ 'LINK_KEEP_BOTH',
1590
+ 'IGNORE_NEW',
1591
+ 'CONFIRM_DIFFERENT',
1592
+ 'ACCEPT',
1593
+ 'REJECT',
1594
+ 'ACCEPT_AND_LEARN',
1595
+ 'CHOOSE_OTHER',
1596
+ 'CANCEL',
1597
+ 'FIX',
1598
+ 'IGNORE'
1599
+ ],
1600
+ example: 'ACCEPT'
1410
1601
  },
1411
- userId: {
1412
- type: 'string',
1413
- description: 'User ID (owner of this payee mapping)',
1414
- example: 'user-123'
1602
+ data: {
1603
+ type: 'object',
1604
+ description:
1605
+ 'Additional data for the decision (e.g., selected account ID)',
1606
+ example: {
1607
+ accountId: 'acc-123'
1608
+ }
1609
+ }
1610
+ },
1611
+ required: ['action']
1612
+ } as const;
1613
+
1614
+ export const $ResolveResultDto = {
1615
+ type: 'object',
1616
+ properties: {
1617
+ success: {
1618
+ type: 'boolean',
1619
+ description: 'Whether resolution was successful'
1415
1620
  },
1416
- payee: {
1621
+ messageKey: {
1417
1622
  type: 'string',
1418
- description: "User's original payee name (e.g., 'Starbucks', 'McDonald')",
1419
- example: 'Starbucks'
1420
- },
1421
- payeeProfileId: {
1422
- type: 'object',
1423
1623
  description:
1424
- 'Reference to global PayeeProfile (merchant info, i18n keys, categories)',
1425
- example: 'uuid-789',
1426
- nullable: true
1624
+ 'i18n message key for result message (e.g., review.payee.result.mapped)'
1427
1625
  },
1428
- customCategory: {
1626
+ messageParams: {
1429
1627
  type: 'object',
1430
1628
  description:
1431
- "User's custom category (overrides PayeeProfile category if set)",
1432
- example: 'Dining:Coffee',
1433
- nullable: true
1434
- },
1435
- customTags: {
1436
- description: "User's custom tags (e.g., ['favorite', 'work_meal'])",
1437
- example: ['favorite', 'work_meal'],
1438
- type: 'array',
1439
- items: {
1629
+ 'Parameters for message interpolation (e.g., { name: "PayeeName" })',
1630
+ additionalProperties: {
1440
1631
  type: 'string'
1441
1632
  }
1442
1633
  },
1443
- useCount: {
1444
- type: 'number',
1445
- description:
1446
- 'Usage count (number of times this payee was used in transactions)',
1447
- example: 42
1634
+ resolutionId: {
1635
+ type: 'string',
1636
+ description: 'Resolution ID for undo'
1448
1637
  },
1449
- lastUsedAt: {
1638
+ canUndo: {
1639
+ type: 'boolean',
1640
+ description: 'Whether this decision can be undone'
1641
+ },
1642
+ undoDeadline: {
1450
1643
  format: 'date-time',
1451
1644
  type: 'string',
1452
- description: 'Last used timestamp',
1453
- example: '2024-11-20T10:00:00Z'
1454
- },
1455
- meta: {
1456
- type: 'object',
1457
- description: 'Extended metadata (location, notes, contact info, etc.)',
1458
- example: {
1459
- location: 'Zhongguancun',
1460
- note: 'Near subway station',
1461
- favorite: true
1462
- }
1645
+ description: 'Deadline for undo (24h from resolution)'
1463
1646
  },
1464
- isActive: {
1647
+ learnedRuleId: {
1648
+ type: 'string',
1649
+ description:
1650
+ 'Rule ID if learning was triggered (ACCEPT_AND_LEARN actions). Use this to deep-link to the rule management page.',
1651
+ example: 'rule_01HXK5V8N2M3P4Q5R6S7T8U9V0'
1652
+ }
1653
+ },
1654
+ required: ['success', 'resolutionId', 'canUndo', 'undoDeadline']
1655
+ } as const;
1656
+
1657
+ export const $UndoResultDto = {
1658
+ type: 'object',
1659
+ properties: {
1660
+ success: {
1465
1661
  type: 'boolean',
1466
- description: 'Active status (inactive payees hidden from autocomplete)',
1467
- example: true
1662
+ description: 'Whether undo was successful'
1468
1663
  },
1469
- createdAt: {
1470
- format: 'date-time',
1664
+ message: {
1471
1665
  type: 'string',
1472
- description: 'Creation timestamp (first time this payee was used)',
1473
- example: '2024-01-01T10:00:00Z'
1666
+ description: 'Message'
1474
1667
  },
1475
- updatedAt: {
1476
- format: 'date-time',
1668
+ reviewId: {
1477
1669
  type: 'string',
1478
- description: 'Last update timestamp',
1479
- example: '2024-11-20T10:00:00Z'
1670
+ description: 'Review item ID that was restored'
1480
1671
  }
1481
1672
  },
1482
- required: [
1483
- 'id',
1484
- 'userId',
1485
- 'payee',
1486
- 'customTags',
1487
- 'useCount',
1488
- 'lastUsedAt',
1489
- 'meta',
1490
- 'isActive',
1491
- 'createdAt',
1492
- 'updatedAt'
1493
- ]
1673
+ required: ['success', 'reviewId']
1494
1674
  } as const;
1495
1675
 
1496
- export const $PayeeListResponseDto = {
1676
+ export const $BatchResolveDto = {
1497
1677
  type: 'object',
1498
1678
  properties: {
1499
- items: {
1500
- description: 'List of payees',
1679
+ reviewIds: {
1680
+ description: 'Review item IDs to resolve',
1681
+ example: ['review-1', 'review-2', 'review-3'],
1501
1682
  type: 'array',
1502
1683
  items: {
1503
- $ref: '#/components/schemas/PayeeResponseDto'
1684
+ type: 'string'
1504
1685
  }
1505
1686
  },
1506
- total: {
1507
- type: 'number',
1508
- description: 'Total number of payees',
1509
- example: 42
1687
+ action: {
1688
+ type: 'string',
1689
+ description: 'Decision action to apply to all items',
1690
+ enum: [
1691
+ 'UPGRADE_REPLACE',
1692
+ 'LINK_KEEP_BOTH',
1693
+ 'IGNORE_NEW',
1694
+ 'CONFIRM_DIFFERENT',
1695
+ 'ACCEPT',
1696
+ 'REJECT',
1697
+ 'ACCEPT_AND_LEARN',
1698
+ 'CHOOSE_OTHER',
1699
+ 'CANCEL',
1700
+ 'FIX',
1701
+ 'IGNORE'
1702
+ ],
1703
+ example: 'ACCEPT'
1704
+ },
1705
+ data: {
1706
+ type: 'object',
1707
+ description: 'Additional data for the decision'
1510
1708
  }
1511
1709
  },
1512
- required: ['items', 'total']
1710
+ required: ['reviewIds', 'action']
1513
1711
  } as const;
1514
1712
 
1515
- export const $PayeeAutocompleteResponseDto = {
1713
+ export const $BatchResolveResultDto = {
1516
1714
  type: 'object',
1517
1715
  properties: {
1518
- suggestions: {
1519
- description: 'List of matching payee names',
1520
- example: ['Starbucks', 'Starbucks Coffee', 'Starbucks Reserve'],
1716
+ successCount: {
1717
+ type: 'number',
1718
+ description: 'Number of successfully resolved items'
1719
+ },
1720
+ failedCount: {
1721
+ type: 'number',
1722
+ description: 'Number of failed items'
1723
+ },
1724
+ results: {
1725
+ description: 'Details for each item',
1521
1726
  type: 'array',
1522
1727
  items: {
1523
1728
  type: 'string'
1524
1729
  }
1525
1730
  }
1526
1731
  },
1527
- required: ['suggestions']
1732
+ required: ['successCount', 'failedCount', 'results']
1733
+ } as const;
1734
+
1735
+ export const $CreatePayeeDto = {
1736
+ type: 'object',
1737
+ properties: {
1738
+ payee: {
1739
+ type: 'string',
1740
+ description:
1741
+ "User's original payee name (e.g., 'Starbucks', 'McDonald'). This is the raw payee string as entered by the user.",
1742
+ example: 'Starbucks',
1743
+ maxLength: 200
1744
+ },
1745
+ payeeProfileId: {
1746
+ type: 'string',
1747
+ description:
1748
+ 'Optional reference to global PayeeProfile for standardized data (merchant info, i18n keys, categories)',
1749
+ example: 'uuid-123',
1750
+ format: 'uuid'
1751
+ },
1752
+ customCategory: {
1753
+ type: 'string',
1754
+ description:
1755
+ "User's custom category for this payee (overrides PayeeProfile category)",
1756
+ example: 'Dining:Coffee',
1757
+ maxLength: 100
1758
+ },
1759
+ customTags: {
1760
+ description:
1761
+ "User's custom tags for this payee (e.g., ['favorite', 'work_meal'])",
1762
+ example: ['favorite', 'work_meal'],
1763
+ type: 'array',
1764
+ items: {
1765
+ type: 'string'
1766
+ }
1767
+ },
1768
+ meta: {
1769
+ type: 'object',
1770
+ description:
1771
+ 'Metadata for extended information (location, notes, contact info, etc.)',
1772
+ example: {
1773
+ location: 'Zhongguancun',
1774
+ note: 'Near subway station',
1775
+ favorite: true
1776
+ }
1777
+ }
1778
+ },
1779
+ required: ['payee']
1780
+ } as const;
1781
+
1782
+ export const $PayeeResponseDto = {
1783
+ type: 'object',
1784
+ properties: {
1785
+ id: {
1786
+ type: 'string',
1787
+ description: 'Unique identifier (UUID)',
1788
+ example: 'uuid-123-456'
1789
+ },
1790
+ userId: {
1791
+ type: 'string',
1792
+ description: 'User ID (owner of this payee mapping)',
1793
+ example: 'user-123'
1794
+ },
1795
+ payee: {
1796
+ type: 'string',
1797
+ description: "User's original payee name (e.g., 'Starbucks', 'McDonald')",
1798
+ example: 'Starbucks'
1799
+ },
1800
+ payeeProfileId: {
1801
+ type: 'string',
1802
+ description:
1803
+ 'Reference to global PayeeProfile (merchant info, i18n keys, categories)',
1804
+ example: 'uuid-789',
1805
+ nullable: true
1806
+ },
1807
+ customCategory: {
1808
+ type: 'string',
1809
+ description:
1810
+ "User's custom category (overrides PayeeProfile category if set)",
1811
+ example: 'Dining:Coffee',
1812
+ nullable: true
1813
+ },
1814
+ customTags: {
1815
+ description: "User's custom tags (e.g., ['favorite', 'work_meal'])",
1816
+ example: ['favorite', 'work_meal'],
1817
+ type: 'array',
1818
+ items: {
1819
+ type: 'string'
1820
+ }
1821
+ },
1822
+ useCount: {
1823
+ type: 'number',
1824
+ description:
1825
+ 'Usage count (number of times this payee was used in transactions)',
1826
+ example: 42
1827
+ },
1828
+ lastUsedAt: {
1829
+ format: 'date-time',
1830
+ type: 'string',
1831
+ description: 'Last used timestamp',
1832
+ example: '2024-11-20T10:00:00Z'
1833
+ },
1834
+ meta: {
1835
+ type: 'object',
1836
+ description: 'Extended metadata (location, notes, contact info, etc.)',
1837
+ example: {
1838
+ location: 'Zhongguancun',
1839
+ note: 'Near subway station',
1840
+ favorite: true
1841
+ }
1842
+ },
1843
+ isActive: {
1844
+ type: 'boolean',
1845
+ description: 'Active status (inactive payees hidden from autocomplete)',
1846
+ example: true
1847
+ },
1848
+ createdAt: {
1849
+ format: 'date-time',
1850
+ type: 'string',
1851
+ description: 'Creation timestamp (first time this payee was used)',
1852
+ example: '2024-01-01T10:00:00Z'
1853
+ },
1854
+ updatedAt: {
1855
+ format: 'date-time',
1856
+ type: 'string',
1857
+ description: 'Last update timestamp',
1858
+ example: '2024-11-20T10:00:00Z'
1859
+ }
1860
+ },
1861
+ required: [
1862
+ 'id',
1863
+ 'userId',
1864
+ 'payee',
1865
+ 'customTags',
1866
+ 'useCount',
1867
+ 'lastUsedAt',
1868
+ 'meta',
1869
+ 'isActive',
1870
+ 'createdAt',
1871
+ 'updatedAt'
1872
+ ]
1873
+ } as const;
1874
+
1875
+ export const $PayeeListResponseDto = {
1876
+ type: 'object',
1877
+ properties: {
1878
+ items: {
1879
+ description: 'List of payees',
1880
+ type: 'array',
1881
+ items: {
1882
+ $ref: '#/components/schemas/PayeeResponseDto'
1883
+ }
1884
+ },
1885
+ total: {
1886
+ type: 'number',
1887
+ description: 'Total number of payees',
1888
+ example: 42
1889
+ }
1890
+ },
1891
+ required: ['items', 'total']
1892
+ } as const;
1893
+
1894
+ export const $PayeeAutocompleteResponseDto = {
1895
+ type: 'object',
1896
+ properties: {
1897
+ suggestions: {
1898
+ description: 'List of matching payee names',
1899
+ example: ['Starbucks', 'Starbucks Coffee', 'Starbucks Reserve'],
1900
+ type: 'array',
1901
+ items: {
1902
+ type: 'string'
1903
+ }
1904
+ }
1905
+ },
1906
+ required: ['suggestions']
1528
1907
  } as const;
1529
1908
 
1530
1909
  export const $PayeeStatsResponseDto = {
@@ -1532,22 +1911,187 @@ export const $PayeeStatsResponseDto = {
1532
1911
  properties: {
1533
1912
  payee: {
1534
1913
  type: 'string',
1535
- description: 'Payee name',
1536
- example: 'Starbucks'
1914
+ description: 'Payee name',
1915
+ example: 'Starbucks'
1916
+ },
1917
+ transactionCount: {
1918
+ type: 'number',
1919
+ description: 'Total transaction count',
1920
+ example: 42
1921
+ },
1922
+ lastUsedAt: {
1923
+ format: 'date-time',
1924
+ type: 'string',
1925
+ description: 'Last used timestamp',
1926
+ example: '2024-11-20T10:00:00Z'
1927
+ }
1928
+ },
1929
+ required: ['payee', 'transactionCount', 'lastUsedAt']
1930
+ } as const;
1931
+
1932
+ export const $UpdatePayeeDto = {
1933
+ type: 'object',
1934
+ properties: {
1935
+ payeeProfileId: {
1936
+ type: 'string',
1937
+ description:
1938
+ 'Optional reference to global PayeeProfile for standardized data (merchant info, i18n keys, categories)',
1939
+ example: 'uuid-123',
1940
+ format: 'uuid'
1941
+ },
1942
+ customCategory: {
1943
+ type: 'string',
1944
+ description:
1945
+ "User's custom category for this payee (overrides PayeeProfile category)",
1946
+ example: 'Dining:Coffee',
1947
+ maxLength: 100
1948
+ },
1949
+ customTags: {
1950
+ description:
1951
+ "User's custom tags for this payee (e.g., ['favorite', 'work_meal'])",
1952
+ example: ['favorite', 'work_meal'],
1953
+ type: 'array',
1954
+ items: {
1955
+ type: 'string'
1956
+ }
1957
+ },
1958
+ meta: {
1959
+ type: 'object',
1960
+ description:
1961
+ 'Metadata for extended information (location, notes, contact info, etc.). Will merge with existing metadata.',
1962
+ example: {
1963
+ location: 'Zhongguancun',
1964
+ note: 'Updated note',
1965
+ favorite: true
1966
+ }
1967
+ },
1968
+ isActive: {
1969
+ type: 'boolean',
1970
+ description:
1971
+ 'Enable or disable this payee. Disabled payees will not appear in autocomplete suggestions.',
1972
+ example: true
1973
+ }
1974
+ }
1975
+ } as const;
1976
+
1977
+ export const $CreatePayeeProfileDto = {
1978
+ type: 'object',
1979
+ properties: {
1980
+ canonical: {
1981
+ type: 'string',
1982
+ description:
1983
+ 'Canonical payee name (unique, case-insensitive). This is the primary identifier for the payee.',
1984
+ example: 'Starbucks',
1985
+ maxLength: 200
1986
+ },
1987
+ aliases: {
1988
+ description:
1989
+ 'Multi-language aliases for the payee. Used for matching user input in different languages.',
1990
+ example: ['Starbucks Coffee', 'SBUX'],
1991
+ type: 'array',
1992
+ items: {
1993
+ type: 'string'
1994
+ }
1995
+ },
1996
+ i18nKey: {
1997
+ type: 'string',
1998
+ description:
1999
+ 'Translation key for i18n integration (XLIFF translation system)',
2000
+ example: 'payee.starbucks',
2001
+ maxLength: 100
2002
+ },
2003
+ category: {
2004
+ type: 'string',
2005
+ description: 'Payee category classification',
2006
+ enum: [
2007
+ 'RESTAURANT',
2008
+ 'CAFE',
2009
+ 'FAST_FOOD',
2010
+ 'BAR',
2011
+ 'SUPERMARKET',
2012
+ 'CONVENIENCE_STORE',
2013
+ 'SHOPPING_MALL',
2014
+ 'ONLINE_SHOPPING',
2015
+ 'TAXI',
2016
+ 'RIDE_SHARING',
2017
+ 'PUBLIC_TRANSPORT',
2018
+ 'PARKING',
2019
+ 'GAS_STATION',
2020
+ 'UTILITIES',
2021
+ 'TELECOM',
2022
+ 'STREAMING',
2023
+ 'HEALTHCARE',
2024
+ 'EDUCATION',
2025
+ 'ENTERTAINMENT',
2026
+ 'SPORTS',
2027
+ 'TRAVEL',
2028
+ 'HOTEL',
2029
+ 'OTHER'
2030
+ ],
2031
+ example: 'CAFE'
2032
+ },
2033
+ subCategory: {
2034
+ type: 'string',
2035
+ description: 'Sub-category for more specific classification',
2036
+ example: 'coffee_chain',
2037
+ maxLength: 100
2038
+ },
2039
+ countries: {
2040
+ description:
2041
+ 'Country/region codes where the payee operates (ISO 3166-1 alpha-2)',
2042
+ example: ['CN', 'US', 'JP'],
2043
+ type: 'array',
2044
+ items: {
2045
+ type: 'string'
2046
+ }
2047
+ },
2048
+ primaryCountry: {
2049
+ type: 'string',
2050
+ description: 'Primary operating country (ISO 3166-1 alpha-2)',
2051
+ example: 'US',
2052
+ maxLength: 2
2053
+ },
2054
+ keywords: {
2055
+ description: 'Search keywords for fuzzy matching',
2056
+ example: ['coffee', 'cafe', 'drinks'],
2057
+ type: 'array',
2058
+ items: {
2059
+ type: 'string'
2060
+ }
2061
+ },
2062
+ logoUrl: {
2063
+ type: 'string',
2064
+ description: 'Payee logo URL',
2065
+ example: 'https://example.com/logo.png'
1537
2066
  },
1538
- transactionCount: {
1539
- type: 'number',
1540
- description: 'Total transaction count',
1541
- example: 42
2067
+ website: {
2068
+ type: 'string',
2069
+ description: 'Official website URL',
2070
+ example: 'https://www.starbucks.com'
1542
2071
  },
1543
- lastUsedAt: {
1544
- format: 'date-time',
2072
+ description: {
1545
2073
  type: 'string',
1546
- description: 'Last used timestamp',
1547
- example: '2024-11-20T10:00:00Z'
2074
+ description: 'Payee description',
2075
+ example: 'Global coffeehouse chain headquartered in Seattle',
2076
+ maxLength: 1000
2077
+ },
2078
+ meta: {
2079
+ type: 'object',
2080
+ description:
2081
+ 'Extended metadata (business hours, contact info, additional details)',
2082
+ example: {
2083
+ businessHours: '07:00-22:00',
2084
+ phone: '+1-800-782-7282'
2085
+ }
2086
+ },
2087
+ dataSource: {
2088
+ type: 'string',
2089
+ description: 'Data source for this profile',
2090
+ enum: ['MANUAL', 'IMPORT', 'API', 'CROWDSOURCED'],
2091
+ default: 'MANUAL'
1548
2092
  }
1549
2093
  },
1550
- required: ['payee', 'transactionCount', 'lastUsedAt']
2094
+ required: ['canonical', 'category']
1551
2095
  } as const;
1552
2096
 
1553
2097
  export const $PayeeProfileResponseDto = {
@@ -1572,7 +2116,7 @@ export const $PayeeProfileResponseDto = {
1572
2116
  }
1573
2117
  },
1574
2118
  i18nKey: {
1575
- type: 'object',
2119
+ type: 'string',
1576
2120
  description: 'Translation key for i18n',
1577
2121
  example: 'payee.starbucks',
1578
2122
  nullable: true
@@ -1608,7 +2152,7 @@ export const $PayeeProfileResponseDto = {
1608
2152
  example: 'CAFE'
1609
2153
  },
1610
2154
  subCategory: {
1611
- type: 'object',
2155
+ type: 'string',
1612
2156
  description: 'Sub-category',
1613
2157
  example: 'coffee_chain',
1614
2158
  nullable: true
@@ -1622,7 +2166,7 @@ export const $PayeeProfileResponseDto = {
1622
2166
  }
1623
2167
  },
1624
2168
  primaryCountry: {
1625
- type: 'object',
2169
+ type: 'string',
1626
2170
  description: 'Primary operating country',
1627
2171
  example: 'US',
1628
2172
  nullable: true
@@ -1636,19 +2180,19 @@ export const $PayeeProfileResponseDto = {
1636
2180
  }
1637
2181
  },
1638
2182
  logoUrl: {
1639
- type: 'object',
2183
+ type: 'string',
1640
2184
  description: 'Logo URL',
1641
2185
  example: 'https://example.com/logo.png',
1642
2186
  nullable: true
1643
2187
  },
1644
2188
  website: {
1645
- type: 'object',
2189
+ type: 'string',
1646
2190
  description: 'Official website',
1647
2191
  example: 'https://www.starbucks.com',
1648
2192
  nullable: true
1649
2193
  },
1650
2194
  description: {
1651
- type: 'object',
2195
+ type: 'string',
1652
2196
  description: 'Description',
1653
2197
  example: 'Global coffeehouse chain',
1654
2198
  nullable: true
@@ -1664,9 +2208,10 @@ export const $PayeeProfileResponseDto = {
1664
2208
  example: 'MANUAL'
1665
2209
  },
1666
2210
  verifiedAt: {
1667
- type: 'object',
2211
+ type: 'string',
1668
2212
  description: 'Verification timestamp (null if not verified)',
1669
2213
  example: '2025-01-01T00:00:00.000Z',
2214
+ format: 'date-time',
1670
2215
  nullable: true
1671
2216
  },
1672
2217
  isActive: {
@@ -1721,6 +2266,164 @@ export const $PayeeProfileListResponseDto = {
1721
2266
  required: ['items', 'total']
1722
2267
  } as const;
1723
2268
 
2269
+ export const $UpdatePayeeProfileDto = {
2270
+ type: 'object',
2271
+ properties: {
2272
+ aliases: {
2273
+ description:
2274
+ 'Multi-language aliases for the payee. Used for matching user input in different languages.',
2275
+ example: ['Starbucks Coffee', 'SBUX'],
2276
+ type: 'array',
2277
+ items: {
2278
+ type: 'string'
2279
+ }
2280
+ },
2281
+ i18nKey: {
2282
+ type: 'string',
2283
+ description:
2284
+ 'Translation key for i18n integration (XLIFF translation system)',
2285
+ example: 'payee.starbucks',
2286
+ maxLength: 100
2287
+ },
2288
+ category: {
2289
+ type: 'string',
2290
+ description: 'Payee category classification',
2291
+ enum: [
2292
+ 'RESTAURANT',
2293
+ 'CAFE',
2294
+ 'FAST_FOOD',
2295
+ 'BAR',
2296
+ 'SUPERMARKET',
2297
+ 'CONVENIENCE_STORE',
2298
+ 'SHOPPING_MALL',
2299
+ 'ONLINE_SHOPPING',
2300
+ 'TAXI',
2301
+ 'RIDE_SHARING',
2302
+ 'PUBLIC_TRANSPORT',
2303
+ 'PARKING',
2304
+ 'GAS_STATION',
2305
+ 'UTILITIES',
2306
+ 'TELECOM',
2307
+ 'STREAMING',
2308
+ 'HEALTHCARE',
2309
+ 'EDUCATION',
2310
+ 'ENTERTAINMENT',
2311
+ 'SPORTS',
2312
+ 'TRAVEL',
2313
+ 'HOTEL',
2314
+ 'OTHER'
2315
+ ],
2316
+ example: 'CAFE'
2317
+ },
2318
+ subCategory: {
2319
+ type: 'string',
2320
+ description: 'Sub-category for more specific classification',
2321
+ example: 'coffee_chain',
2322
+ maxLength: 100
2323
+ },
2324
+ countries: {
2325
+ description:
2326
+ 'Country/region codes where the payee operates (ISO 3166-1 alpha-2)',
2327
+ example: ['CN', 'US', 'JP'],
2328
+ type: 'array',
2329
+ items: {
2330
+ type: 'string'
2331
+ }
2332
+ },
2333
+ primaryCountry: {
2334
+ type: 'string',
2335
+ description: 'Primary operating country (ISO 3166-1 alpha-2)',
2336
+ example: 'US',
2337
+ maxLength: 2
2338
+ },
2339
+ keywords: {
2340
+ description: 'Search keywords for fuzzy matching',
2341
+ example: ['coffee', 'cafe', 'drinks'],
2342
+ type: 'array',
2343
+ items: {
2344
+ type: 'string'
2345
+ }
2346
+ },
2347
+ logoUrl: {
2348
+ type: 'string',
2349
+ description: 'Payee logo URL',
2350
+ example: 'https://example.com/logo.png'
2351
+ },
2352
+ website: {
2353
+ type: 'string',
2354
+ description: 'Official website URL',
2355
+ example: 'https://www.starbucks.com'
2356
+ },
2357
+ description: {
2358
+ type: 'string',
2359
+ description: 'Payee description',
2360
+ example: 'Global coffeehouse chain headquartered in Seattle',
2361
+ maxLength: 1000
2362
+ },
2363
+ meta: {
2364
+ type: 'object',
2365
+ description:
2366
+ 'Extended metadata (business hours, contact info, additional details)',
2367
+ example: {
2368
+ businessHours: '07:00-22:00',
2369
+ phone: '+1-800-782-7282'
2370
+ }
2371
+ },
2372
+ dataSource: {
2373
+ type: 'string',
2374
+ description: 'Data source for this profile',
2375
+ enum: ['MANUAL', 'IMPORT', 'API', 'CROWDSOURCED'],
2376
+ default: 'MANUAL'
2377
+ },
2378
+ isActive: {
2379
+ type: 'boolean',
2380
+ description: 'Whether the payee profile is active (soft delete)',
2381
+ example: true
2382
+ },
2383
+ verifiedAt: {
2384
+ type: 'string',
2385
+ description:
2386
+ 'Verification timestamp. Set to current time to verify, or null to unverify.',
2387
+ example: '2025-01-01T00:00:00.000Z',
2388
+ format: 'date-time',
2389
+ nullable: true
2390
+ }
2391
+ }
2392
+ } as const;
2393
+
2394
+ export const $CreateCommodityDto = {
2395
+ type: 'object',
2396
+ properties: {
2397
+ symbol: {
2398
+ type: 'string',
2399
+ description:
2400
+ 'Commodity symbol (e.g., AAPL, USD, BTC) - corresponds to Beancount currency field',
2401
+ example: 'AAPL',
2402
+ maxLength: 50
2403
+ },
2404
+ date: {
2405
+ type: 'string',
2406
+ description:
2407
+ 'Commodity definition date (ISO 8601, required per Beancount spec). Represents when this commodity was first defined in the accounting system.',
2408
+ example: '2024-01-01',
2409
+ format: 'date'
2410
+ },
2411
+ metadata: {
2412
+ type: 'object',
2413
+ description:
2414
+ 'Metadata (corresponds to Beancount meta field). Can contain name, assetClass, precision, note, tags, etc.',
2415
+ example: {
2416
+ name: 'Apple Inc.',
2417
+ assetClass: 'stock',
2418
+ precision: 2,
2419
+ note: 'Long-term investment',
2420
+ tags: ['tech', 'dividend']
2421
+ }
2422
+ }
2423
+ },
2424
+ required: ['symbol', 'date']
2425
+ } as const;
2426
+
1724
2427
  export const $CommodityResponseDto = {
1725
2428
  type: 'object',
1726
2429
  properties: {
@@ -1730,7 +2433,7 @@ export const $CommodityResponseDto = {
1730
2433
  example: 'uuid-123-456'
1731
2434
  },
1732
2435
  userId: {
1733
- type: 'object',
2436
+ type: 'string',
1734
2437
  description: 'User ID (owner of the commodity)',
1735
2438
  example: 'user-123',
1736
2439
  nullable: true
@@ -1759,13 +2462,6 @@ export const $CommodityResponseDto = {
1759
2462
  source: 'AUTO_CREATED'
1760
2463
  }
1761
2464
  },
1762
- symbolProfileId: {
1763
- type: 'object',
1764
- description:
1765
- 'Reference to SymbolProfile (market data integration, SaaS feature)',
1766
- example: 'uuid-789',
1767
- nullable: true
1768
- },
1769
2465
  createdAt: {
1770
2466
  format: 'date-time',
1771
2467
  type: 'string',
@@ -1792,13 +2488,137 @@ export const $CommodityListResponseDto = {
1792
2488
  $ref: '#/components/schemas/CommodityResponseDto'
1793
2489
  }
1794
2490
  },
1795
- total: {
1796
- type: 'number',
1797
- description: 'Total number of commodities',
1798
- example: 42
2491
+ total: {
2492
+ type: 'number',
2493
+ description: 'Total number of commodities',
2494
+ example: 42
2495
+ }
2496
+ },
2497
+ required: ['items', 'total']
2498
+ } as const;
2499
+
2500
+ export const $UpdateCommodityDto = {
2501
+ type: 'object',
2502
+ properties: {
2503
+ date: {
2504
+ type: 'string',
2505
+ description:
2506
+ 'Commodity definition date (ISO 8601). Represents when this commodity was first defined in the accounting system.',
2507
+ example: '2024-01-01',
2508
+ format: 'date'
2509
+ },
2510
+ metadata: {
2511
+ type: 'object',
2512
+ description:
2513
+ 'Metadata (corresponds to Beancount meta field). Will merge with existing metadata. Can contain name, assetClass, precision, note, tags, etc.',
2514
+ example: {
2515
+ name: 'Updated Apple Inc.',
2516
+ assetClass: 'equity',
2517
+ precision: 4,
2518
+ note: 'Updated investment strategy',
2519
+ lastReviewed: '2024-11-03'
2520
+ }
2521
+ }
2522
+ }
2523
+ } as const;
2524
+
2525
+ export const $CreateRecurringRuleDto = {
2526
+ type: 'object',
2527
+ properties: {
2528
+ name: {
2529
+ type: 'string',
2530
+ description: 'Rule name (unique per user)',
2531
+ maxLength: 100
2532
+ },
2533
+ icon: {
2534
+ type: 'string',
2535
+ description: 'Icon emoji',
2536
+ maxLength: 10
2537
+ },
2538
+ frequency: {
2539
+ type: 'string',
2540
+ description: 'Recurring frequency',
2541
+ enum: [
2542
+ 'WEEKLY',
2543
+ 'BIWEEKLY',
2544
+ 'MONTHLY',
2545
+ 'BIMONTHLY',
2546
+ 'QUARTERLY',
2547
+ 'YEARLY',
2548
+ 'CUSTOM'
2549
+ ]
2550
+ },
2551
+ expectedAmount: {
2552
+ type: 'number',
2553
+ description: 'Expected amount (positive number)',
2554
+ minimum: 0
2555
+ },
2556
+ expectedDay: {
2557
+ type: 'number',
2558
+ description: 'Expected day of month (1-31)',
2559
+ minimum: 1,
2560
+ maximum: 31
2561
+ },
2562
+ customIntervalDays: {
2563
+ type: 'number',
2564
+ description: 'Custom interval in days (required for CUSTOM frequency)',
2565
+ minimum: 1
2566
+ },
2567
+ currency: {
2568
+ type: 'string',
2569
+ description: 'Currency code',
2570
+ default: 'CNY',
2571
+ maxLength: 10
2572
+ },
2573
+ matchPayeePattern: {
2574
+ type: 'string',
2575
+ description: 'Payee matching pattern (supports wildcards)',
2576
+ maxLength: 200
2577
+ },
2578
+ matchAmountTolerance: {
2579
+ type: 'number',
2580
+ description: 'Amount tolerance percentage (0-1)',
2581
+ default: 0.075,
2582
+ minimum: 0,
2583
+ maximum: 1
2584
+ },
2585
+ defaultExpenseAccount: {
2586
+ type: 'string',
2587
+ description: 'Default expense account for auto-create',
2588
+ maxLength: 200
2589
+ },
2590
+ defaultPaymentAccount: {
2591
+ type: 'string',
2592
+ description: 'Default payment account for auto-create',
2593
+ maxLength: 200
2594
+ },
2595
+ defaultPayee: {
2596
+ type: 'string',
2597
+ description: 'Default payee for auto-create',
2598
+ maxLength: 200
2599
+ },
2600
+ autoCreate: {
2601
+ type: 'boolean',
2602
+ description: 'Auto-create transaction when expected date arrives',
2603
+ default: false
2604
+ },
2605
+ startDate: {
2606
+ type: 'string',
2607
+ description: 'Rule start date (ISO format)'
2608
+ },
2609
+ endDate: {
2610
+ type: 'string',
2611
+ description: 'Rule end date (ISO format)'
1799
2612
  }
1800
2613
  },
1801
- required: ['items', 'total']
2614
+ required: [
2615
+ 'name',
2616
+ 'frequency',
2617
+ 'expectedAmount',
2618
+ 'currency',
2619
+ 'matchAmountTolerance',
2620
+ 'autoCreate'
2621
+ ]
1802
2622
  } as const;
1803
2623
 
1804
2624
  export const $RecurringRuleResponseDto = {
@@ -1912,6 +2732,37 @@ export const $RecurringRuleResponseDto = {
1912
2732
  ]
1913
2733
  } as const;
1914
2734
 
2735
+ export const $CreateRuleFromTransactionDto = {
2736
+ type: 'object',
2737
+ properties: {
2738
+ frequency: {
2739
+ type: 'string',
2740
+ description: 'Recurring frequency',
2741
+ enum: [
2742
+ 'WEEKLY',
2743
+ 'BIWEEKLY',
2744
+ 'MONTHLY',
2745
+ 'BIMONTHLY',
2746
+ 'QUARTERLY',
2747
+ 'YEARLY',
2748
+ 'CUSTOM'
2749
+ ],
2750
+ example: 'MONTHLY'
2751
+ },
2752
+ name: {
2753
+ type: 'string',
2754
+ description: 'Optional name override (default: transaction payee)',
2755
+ maxLength: 100
2756
+ },
2757
+ icon: {
2758
+ type: 'string',
2759
+ description: 'Optional icon emoji',
2760
+ maxLength: 10
2761
+ }
2762
+ },
2763
+ required: ['frequency']
2764
+ } as const;
2765
+
1915
2766
  export const $RecurringRuleWithStatsResponseDto = {
1916
2767
  type: 'object',
1917
2768
  properties: {
@@ -2070,6 +2921,94 @@ export const $RecurringRuleWithStatsResponseDto = {
2070
2921
  ]
2071
2922
  } as const;
2072
2923
 
2924
+ export const $UpdateRecurringRuleDto = {
2925
+ type: 'object',
2926
+ properties: {
2927
+ name: {
2928
+ type: 'string',
2929
+ description: 'Rule name',
2930
+ maxLength: 100
2931
+ },
2932
+ icon: {
2933
+ type: 'string',
2934
+ description: 'Icon emoji',
2935
+ maxLength: 10
2936
+ },
2937
+ frequency: {
2938
+ type: 'string',
2939
+ description: 'Recurring frequency',
2940
+ enum: [
2941
+ 'WEEKLY',
2942
+ 'BIWEEKLY',
2943
+ 'MONTHLY',
2944
+ 'BIMONTHLY',
2945
+ 'QUARTERLY',
2946
+ 'YEARLY',
2947
+ 'CUSTOM'
2948
+ ]
2949
+ },
2950
+ expectedAmount: {
2951
+ type: 'number',
2952
+ description: 'Expected amount',
2953
+ minimum: 0
2954
+ },
2955
+ expectedDay: {
2956
+ type: 'number',
2957
+ description: 'Expected day of month (1-31)',
2958
+ minimum: 1,
2959
+ maximum: 31
2960
+ },
2961
+ customIntervalDays: {
2962
+ type: 'number',
2963
+ description: 'Custom interval in days',
2964
+ minimum: 1
2965
+ },
2966
+ currency: {
2967
+ type: 'string',
2968
+ description: 'Currency code',
2969
+ maxLength: 10
2970
+ },
2971
+ matchPayeePattern: {
2972
+ type: 'string',
2973
+ description: 'Payee matching pattern',
2974
+ maxLength: 200
2975
+ },
2976
+ matchAmountTolerance: {
2977
+ type: 'number',
2978
+ description: 'Amount tolerance percentage (0-1)',
2979
+ minimum: 0,
2980
+ maximum: 1
2981
+ },
2982
+ defaultExpenseAccount: {
2983
+ type: 'string',
2984
+ description: 'Default expense account',
2985
+ maxLength: 200
2986
+ },
2987
+ defaultPaymentAccount: {
2988
+ type: 'string',
2989
+ description: 'Default payment account',
2990
+ maxLength: 200
2991
+ },
2992
+ defaultPayee: {
2993
+ type: 'string',
2994
+ description: 'Default payee',
2995
+ maxLength: 200
2996
+ },
2997
+ autoCreate: {
2998
+ type: 'boolean',
2999
+ description: 'Auto-create transaction'
3000
+ },
3001
+ isActive: {
3002
+ type: 'boolean',
3003
+ description: 'Rule active status'
3004
+ },
3005
+ endDate: {
3006
+ type: 'string',
3007
+ description: 'Rule end date (ISO format)'
3008
+ }
3009
+ }
3010
+ } as const;
3011
+
2073
3012
  export const $ExpectedTransactionRuleDto = {
2074
3013
  type: 'object',
2075
3014
  properties: {
@@ -2186,6 +3125,50 @@ export const $ExpectedTransactionListResponseDto = {
2186
3125
  required: ['items', 'total']
2187
3126
  } as const;
2188
3127
 
3128
+ export const $ConfirmMatchDto = {
3129
+ type: 'object',
3130
+ properties: {
3131
+ transactionId: {
3132
+ type: 'string',
3133
+ description: 'Transaction ID to match with'
3134
+ }
3135
+ },
3136
+ required: ['transactionId']
3137
+ } as const;
3138
+
3139
+ export const $EnterNowDto = {
3140
+ type: 'object',
3141
+ properties: {
3142
+ expenseAccount: {
3143
+ type: 'string',
3144
+ description:
3145
+ 'Override expense account (uses rule default if not provided)',
3146
+ maxLength: 200
3147
+ },
3148
+ paymentAccount: {
3149
+ type: 'string',
3150
+ description:
3151
+ 'Override payment account (uses rule default if not provided)',
3152
+ maxLength: 200
3153
+ },
3154
+ amount: {
3155
+ type: 'number',
3156
+ description: 'Override amount (uses expected amount if not provided)',
3157
+ minimum: 0
3158
+ },
3159
+ payee: {
3160
+ type: 'string',
3161
+ description: 'Override payee (uses rule default if not provided)',
3162
+ maxLength: 200
3163
+ },
3164
+ narration: {
3165
+ type: 'string',
3166
+ description: 'Optional narration',
3167
+ maxLength: 500
3168
+ }
3169
+ }
3170
+ } as const;
3171
+
2189
3172
  export const $ForecastItemDto = {
2190
3173
  type: 'object',
2191
3174
  properties: {
@@ -2210,7 +3193,7 @@ export const $ForecastItemDto = {
2210
3193
  example: '2024-04-01'
2211
3194
  },
2212
3195
  icon: {
2213
- type: 'object',
3196
+ type: 'string',
2214
3197
  description: 'Rule icon emoji',
2215
3198
  example: '🏠',
2216
3199
  nullable: true
@@ -2310,6 +3293,107 @@ export const $ForecastResponseDto = {
2310
3293
  ]
2311
3294
  } as const;
2312
3295
 
3296
+ export const $CreateTransactionRuleDto = {
3297
+ type: 'object',
3298
+ properties: {
3299
+ name: {
3300
+ type: 'string',
3301
+ minLength: 1,
3302
+ maxLength: 100
3303
+ },
3304
+ description: {
3305
+ type: 'string',
3306
+ maxLength: 500
3307
+ },
3308
+ narrationKeywords: {
3309
+ items: {
3310
+ type: 'array'
3311
+ },
3312
+ maxItems: 50,
3313
+ type: 'array'
3314
+ },
3315
+ payeeKeywords: {
3316
+ items: {
3317
+ type: 'array'
3318
+ },
3319
+ maxItems: 50,
3320
+ type: 'array'
3321
+ },
3322
+ categoryKeywords: {
3323
+ items: {
3324
+ type: 'array'
3325
+ },
3326
+ maxItems: 50,
3327
+ type: 'array'
3328
+ },
3329
+ methodKeywords: {
3330
+ items: {
3331
+ type: 'array'
3332
+ },
3333
+ maxItems: 50,
3334
+ description: 'Payment method keywords (e.g., HuaBei, YuEBao)',
3335
+ type: 'array'
3336
+ },
3337
+ categoryAccount: {
3338
+ type: 'string',
3339
+ maxLength: 200,
3340
+ description:
3341
+ 'Destination account for expenses/income (e.g., Expenses:Food:Coffee)'
3342
+ },
3343
+ matchLogic: {
3344
+ type: 'string',
3345
+ enum: ['OR', 'AND'],
3346
+ default: 'OR'
3347
+ },
3348
+ amountMin: {
3349
+ type: 'number',
3350
+ minimum: 0,
3351
+ description: 'Minimum transaction amount (inclusive)'
3352
+ },
3353
+ amountMax: {
3354
+ type: 'number',
3355
+ minimum: 0,
3356
+ description: 'Maximum transaction amount (inclusive)'
3357
+ },
3358
+ priority: {
3359
+ type: 'number',
3360
+ default: 50,
3361
+ minimum: 0,
3362
+ maximum: 1000
3363
+ },
3364
+ additionalTags: {
3365
+ items: {
3366
+ type: 'array'
3367
+ },
3368
+ maxItems: 20,
3369
+ type: 'array'
3370
+ },
3371
+ additionalMetadata: {
3372
+ type: 'object'
3373
+ },
3374
+ upsertByPayee: {
3375
+ type: 'boolean',
3376
+ description:
3377
+ 'If true, update existing rule with matching payeeKeywords[0] instead of creating new rule'
3378
+ }
3379
+ },
3380
+ required: ['name', 'matchLogic', 'priority']
3381
+ } as const;
3382
+
3383
+ export const $AmountRangeDto = {
3384
+ type: 'object',
3385
+ properties: {
3386
+ min: {
3387
+ type: 'number',
3388
+ description: 'Minimum amount'
3389
+ },
3390
+ max: {
3391
+ type: 'number',
3392
+ description: 'Maximum amount'
3393
+ }
3394
+ }
3395
+ } as const;
3396
+
2313
3397
  export const $TransactionRuleResponseDto = {
2314
3398
  type: 'object',
2315
3399
  properties: {
@@ -2364,12 +3448,12 @@ export const $TransactionRuleResponseDto = {
2364
3448
  example: 'OR'
2365
3449
  },
2366
3450
  amountRange: {
2367
- type: 'object',
2368
3451
  description: 'Amount range for matching',
2369
- example: {
2370
- min: 0,
2371
- max: 100
2372
- }
3452
+ allOf: [
3453
+ {
3454
+ $ref: '#/components/schemas/AmountRangeDto'
3455
+ }
3456
+ ]
2373
3457
  },
2374
3458
  priority: {
2375
3459
  type: 'number',
@@ -2384,6 +3468,7 @@ export const $TransactionRuleResponseDto = {
2384
3468
  type: 'string',
2385
3469
  description: 'Learning source: NLP, REVIEW_CENTER, or null for manual',
2386
3470
  enum: ['NLP', 'REVIEW_CENTER'],
3471
+ nullable: true,
2387
3472
  example: 'REVIEW_CENTER'
2388
3473
  },
2389
3474
  autoApplyEnabled: {
@@ -2405,7 +3490,9 @@ export const $TransactionRuleResponseDto = {
2405
3490
  additionalMetadata: {
2406
3491
  type: 'object',
2407
3492
  description: 'Additional metadata',
2408
- example: {}
3493
+ additionalProperties: {
3494
+ type: 'string'
3495
+ }
2409
3496
  },
2410
3497
  createdAt: {
2411
3498
  format: 'date-time',
@@ -2578,6 +3665,64 @@ export const $ValidateRuleResponseDto = {
2578
3665
  required: ['valid', 'errors', 'warnings']
2579
3666
  } as const;
2580
3667
 
3668
+ export const $BulkCreateRulesDto = {
3669
+ type: 'object',
3670
+ properties: {
3671
+ rules: {
3672
+ items: {
3673
+ type: 'array'
3674
+ },
3675
+ description: 'Array of rules to import',
3676
+ type: 'array'
3677
+ },
3678
+ conflictStrategy: {
3679
+ type: 'string',
3680
+ enum: ['replace', 'skip'],
3681
+ default: 'skip',
3682
+ description:
3683
+ 'Conflict handling strategy: skip (default) ignores duplicates, replace soft-deletes existing rule'
3684
+ }
3685
+ },
3686
+ required: ['rules', 'conflictStrategy']
3687
+ } as const;
3688
+
3689
+ export const $BulkCreateRulesResponseDto = {
3690
+ type: 'object',
3691
+ properties: {
3692
+ successCount: {
3693
+ type: 'number',
3694
+ description: 'Number of successfully created rules'
3695
+ },
3696
+ failureCount: {
3697
+ type: 'number',
3698
+ description: 'Number of failed rules'
3699
+ },
3700
+ errors: {
3701
+ type: 'array',
3702
+ description: 'Error details for failed rules',
3703
+ items: {
3704
+ type: 'object',
3705
+ properties: {
3706
+ index: {
3707
+ type: 'number'
3708
+ },
3709
+ message: {
3710
+ type: 'string'
3711
+ }
3712
+ }
3713
+ }
3714
+ },
3715
+ createdRuleIds: {
3716
+ description: 'IDs of successfully created rules',
3717
+ type: 'array',
3718
+ items: {
3719
+ type: 'string'
3720
+ }
3721
+ }
3722
+ },
3723
+ required: ['successCount', 'failureCount', 'errors', 'createdRuleIds']
3724
+ } as const;
3725
+
2581
3726
  export const $ExportRulesResponseDto = {
2582
3727
  type: 'object',
2583
3728
  properties: {
@@ -2658,6 +3803,89 @@ export const $RuleStatisticsResponseDto = {
2658
3803
  ]
2659
3804
  } as const;
2660
3805
 
3806
+ export const $UpdateTransactionRuleDto = {
3807
+ type: 'object',
3808
+ properties: {
3809
+ name: {
3810
+ type: 'string',
3811
+ minLength: 1,
3812
+ maxLength: 100
3813
+ },
3814
+ description: {
3815
+ type: 'string',
3816
+ maxLength: 500
3817
+ },
3818
+ narrationKeywords: {
3819
+ items: {
3820
+ type: 'array'
3821
+ },
3822
+ maxItems: 50,
3823
+ type: 'array'
3824
+ },
3825
+ payeeKeywords: {
3826
+ items: {
3827
+ type: 'array'
3828
+ },
3829
+ maxItems: 50,
3830
+ type: 'array'
3831
+ },
3832
+ categoryKeywords: {
3833
+ items: {
3834
+ type: 'array'
3835
+ },
3836
+ maxItems: 50,
3837
+ type: 'array'
3838
+ },
3839
+ methodKeywords: {
3840
+ items: {
3841
+ type: 'array'
3842
+ },
3843
+ maxItems: 50,
3844
+ description: 'Payment method keywords (e.g., HuaBei, YuEBao)',
3845
+ type: 'array'
3846
+ },
3847
+ categoryAccount: {
3848
+ type: 'string',
3849
+ maxLength: 200,
3850
+ description:
3851
+ 'Destination account for expenses/income (e.g., Expenses:Food:Coffee)'
3852
+ },
3853
+ matchLogic: {
3854
+ type: 'string',
3855
+ enum: ['OR', 'AND']
3856
+ },
3857
+ amountMin: {
3858
+ type: 'number',
3859
+ minimum: 0,
3860
+ description: 'Minimum transaction amount (inclusive)'
3861
+ },
3862
+ amountMax: {
3863
+ type: 'number',
3864
+ minimum: 0,
3865
+ description: 'Maximum transaction amount (inclusive)'
3866
+ },
3867
+ priority: {
3868
+ type: 'number',
3869
+ minimum: 0,
3870
+ maximum: 1000
3871
+ },
3872
+ enabled: {
3873
+ type: 'boolean',
3874
+ description: 'Enable or disable the rule'
3875
+ },
3876
+ additionalTags: {
3877
+ items: {
3878
+ type: 'array'
3879
+ },
3880
+ maxItems: 20,
3881
+ type: 'array'
3882
+ },
3883
+ additionalMetadata: {
3884
+ type: 'object'
3885
+ }
3886
+ }
3887
+ } as const;
3888
+
2661
3889
  export const $TestRuleDto = {
2662
3890
  type: 'object',
2663
3891
  properties: {
@@ -2850,6 +4078,17 @@ export const $UpdateUserSettingDto = {
2850
4078
  }
2851
4079
  } as const;
2852
4080
 
4081
+ export const $UpdatePropertyDto = {
4082
+ type: 'object',
4083
+ properties: {
4084
+ value: {
4085
+ type: 'string',
4086
+ description: 'Property value'
4087
+ }
4088
+ },
4089
+ required: ['value']
4090
+ } as const;
4091
+
2853
4092
  export const $FileImportDto = {
2854
4093
  type: 'object',
2855
4094
  properties: {
@@ -3149,7 +4388,8 @@ export const $ImporterConfigDto = {
3149
4388
  'cmbc-credit',
3150
4389
  'icbc',
3151
4390
  'icbc-credit',
3152
- 'hsbc-hk'
4391
+ 'hsbc-hk-credit',
4392
+ 'hsbc-hk-debit'
3153
4393
  ]
3154
4394
  },
3155
4395
  version: {
@@ -3195,6 +4435,181 @@ export const $ImporterConfigDto = {
3195
4435
  ]
3196
4436
  } as const;
3197
4437
 
4438
+ export const $UpdateMapperDefaultsDto = {
4439
+ type: 'object',
4440
+ properties: {
4441
+ sourceAccount: {
4442
+ type: 'string',
4443
+ description: 'Source account for transactions (Beancount format)',
4444
+ example: 'Assets:Alipay:Balance',
4445
+ pattern: '^[A-Z][a-zA-Z0-9-]*:[a-zA-Z0-9-:]+$'
4446
+ },
4447
+ currency: {
4448
+ type: 'string',
4449
+ description: 'Default currency (ISO 4217 code)',
4450
+ example: 'CNY',
4451
+ minLength: 3,
4452
+ maxLength: 3,
4453
+ pattern: '^[A-Z]{3}$'
4454
+ },
4455
+ expenseAccount: {
4456
+ type: 'string',
4457
+ description: 'Default expense account (optional)',
4458
+ example: 'Expenses:Unknown',
4459
+ pattern: '^[A-Z][a-zA-Z0-9-]*:[a-zA-Z0-9-:]+$'
4460
+ },
4461
+ incomeAccount: {
4462
+ type: 'string',
4463
+ description: 'Default income account (optional)',
4464
+ example: 'Income:Unknown',
4465
+ pattern: '^[A-Z][a-zA-Z0-9-]*:[a-zA-Z0-9-:]+$'
4466
+ },
4467
+ methodAccountMapping: {
4468
+ type: 'object',
4469
+ description:
4470
+ 'Payment method to source account mapping. Maps payment method keywords to Beancount account paths. Used by Alipay/WeChat importers to determine sourceAccount based on payment method (e.g., HuaBei, CreditCard).',
4471
+ example: {
4472
+ HuaBei: 'Liabilities:Alipay:Huabei',
4473
+ CreditCard: 'Liabilities:CreditCard'
4474
+ }
4475
+ }
4476
+ }
4477
+ } as const;
4478
+
4479
+ export const $UpdateConfigDataDto = {
4480
+ type: 'object',
4481
+ properties: {
4482
+ defaults: {
4483
+ description: 'Mapper defaults configuration',
4484
+ allOf: [
4485
+ {
4486
+ $ref: '#/components/schemas/UpdateMapperDefaultsDto'
4487
+ }
4488
+ ]
4489
+ }
4490
+ }
4491
+ } as const;
4492
+
4493
+ export const $UpdateImporterConfigDto = {
4494
+ type: 'object',
4495
+ properties: {
4496
+ data: {
4497
+ description: 'Configuration data (v1 schema)',
4498
+ allOf: [
4499
+ {
4500
+ $ref: '#/components/schemas/UpdateConfigDataDto'
4501
+ }
4502
+ ]
4503
+ }
4504
+ }
4505
+ } as const;
4506
+
4507
+ export const $CreatePlatformDto = {
4508
+ type: 'object',
4509
+ properties: {
4510
+ name: {
4511
+ type: 'string',
4512
+ description: 'Platform name',
4513
+ example: 'Binance'
4514
+ },
4515
+ canonical: {
4516
+ type: 'string',
4517
+ description: 'Platform canonical identifier (lowercase, kebab-case)',
4518
+ example: 'binance'
4519
+ },
4520
+ aliases: {
4521
+ description: 'Platform aliases (multi-language names for lookup)',
4522
+ example: ['Binance', 'Binance Exchange', 'BNB'],
4523
+ type: 'array',
4524
+ items: {
4525
+ type: 'string'
4526
+ }
4527
+ },
4528
+ url: {
4529
+ type: 'string',
4530
+ description: 'Platform URL',
4531
+ example: 'https://www.binance.com'
4532
+ },
4533
+ type: {
4534
+ type: 'string',
4535
+ description: 'Platform type',
4536
+ enum: [
4537
+ 'BANK',
4538
+ 'BROKERAGE',
4539
+ 'CRYPTO_EXCHANGE',
4540
+ 'PAYMENT',
4541
+ 'INVESTMENT',
4542
+ 'INSURANCE',
4543
+ 'OTHER'
4544
+ ],
4545
+ example: 'CRYPTO_EXCHANGE'
4546
+ },
4547
+ logoUrl: {
4548
+ type: 'string',
4549
+ description: 'Platform logo URL',
4550
+ example: 'https://example.com/logos/binance.png'
4551
+ },
4552
+ isActive: {
4553
+ type: 'boolean',
4554
+ description: 'Whether the platform is active',
4555
+ default: true
4556
+ }
4557
+ },
4558
+ required: ['name', 'canonical', 'aliases', 'url', 'type']
4559
+ } as const;
4560
+
4561
+ export const $UpdatePlatformDto = {
4562
+ type: 'object',
4563
+ properties: {
4564
+ name: {
4565
+ type: 'string',
4566
+ description: 'Platform name',
4567
+ example: 'Binance'
4568
+ },
4569
+ canonical: {
4570
+ type: 'string',
4571
+ description: 'Platform canonical identifier (lowercase, kebab-case)',
4572
+ example: 'binance'
4573
+ },
4574
+ aliases: {
4575
+ description: 'Platform aliases (multi-language names for lookup)',
4576
+ example: ['Binance', 'Binance Exchange', 'BNB'],
4577
+ type: 'array',
4578
+ items: {
4579
+ type: 'string'
4580
+ }
4581
+ },
4582
+ url: {
4583
+ type: 'string',
4584
+ description: 'Platform URL',
4585
+ example: 'https://www.binance.com'
4586
+ },
4587
+ type: {
4588
+ type: 'string',
4589
+ description: 'Platform type',
4590
+ enum: [
4591
+ 'BANK',
4592
+ 'BROKERAGE',
4593
+ 'CRYPTO_EXCHANGE',
4594
+ 'PAYMENT',
4595
+ 'INVESTMENT',
4596
+ 'INSURANCE',
4597
+ 'OTHER'
4598
+ ],
4599
+ example: 'CRYPTO_EXCHANGE'
4600
+ },
4601
+ logoUrl: {
4602
+ type: 'string',
4603
+ description: 'Platform logo URL',
4604
+ example: 'https://example.com/logos/binance.png'
4605
+ },
4606
+ isActive: {
4607
+ type: 'boolean',
4608
+ description: 'Whether the platform is active'
4609
+ }
4610
+ }
4611
+ } as const;
4612
+
3198
4613
  export const $ProviderSyncConfigDto = {
3199
4614
  type: 'object',
3200
4615
  properties: {
@@ -3329,7 +4744,8 @@ export const $SupportedProvidersResponseDto = {
3329
4744
  'gocardless',
3330
4745
  'simplefin',
3331
4746
  'yodlee',
3332
- 'beancount-direct'
4747
+ 'beancount-direct',
4748
+ 'parsed-bill'
3333
4749
  ],
3334
4750
  type: 'array',
3335
4751
  items: {
@@ -3340,6 +4756,11 @@ export const $SupportedProvidersResponseDto = {
3340
4756
  required: ['providers']
3341
4757
  } as const;
3342
4758
 
4759
+ export const $ParserTelemetryReportDto = {
4760
+ type: 'object',
4761
+ properties: {}
4762
+ } as const;
4763
+
3343
4764
  export const $ProcessNlpDto = {
3344
4765
  type: 'object',
3345
4766
  properties: {
@@ -3354,6 +4775,16 @@ export const $ProcessNlpDto = {
3354
4775
  description:
3355
4776
  'Session ID for multi-turn conversation (auto-generated if not provided)',
3356
4777
  example: 'session_abc123'
4778
+ },
4779
+ parsedData: {
4780
+ type: 'object',
4781
+ description:
4782
+ 'Parsed data from previous NLP response for session recovery. Send back the parsedData received in confirm_payee/confirm responses.',
4783
+ example: {
4784
+ amount: 35,
4785
+ currency: 'CNY',
4786
+ payee: 'Starbucks'
4787
+ }
3357
4788
  }
3358
4789
  },
3359
4790
  required: ['message']