@firela/api-types 0.0.0-canary.b3b7767b → 0.0.0-canary.ba0a88d9

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,158 @@ 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
+ description: {
333
+ type: 'string',
334
+ description: 'Account description',
335
+ example: 'ICBC checking account for daily transactions'
336
+ },
337
+ tags: {
338
+ description: 'Account tags for categorization',
339
+ example: ['bank', 'checking', 'primary'],
340
+ type: 'array',
341
+ items: {
342
+ type: 'string'
343
+ }
344
+ },
345
+ icon: {
346
+ type: 'string',
347
+ description: 'Icon identifier for UI display',
348
+ example: 'bank-icbc'
349
+ }
350
+ },
351
+ required: ['path', 'type']
352
+ } as const;
353
+
354
+ export const $AccountStandardListResponseDto = {
355
+ type: 'object',
356
+ properties: {
357
+ items: {
358
+ description: 'Array of account templates',
359
+ type: 'array',
360
+ items: {
361
+ $ref: '#/components/schemas/AccountStandardResponseDto'
362
+ }
363
+ },
364
+ total: {
365
+ type: 'number',
366
+ description: 'Total number of account templates',
367
+ example: 150
368
+ },
369
+ region: {
370
+ type: 'string',
371
+ description: 'Region code',
372
+ example: 'CN'
373
+ }
374
+ },
375
+ required: ['items', 'total', 'region']
376
+ } as const;
377
+
378
+ export const $TemplateMetadataDto = {
379
+ type: 'object',
380
+ properties: {
381
+ extendable: {
382
+ type: 'boolean',
383
+ description: 'Whether this path can be extended',
384
+ example: true
385
+ },
386
+ rootType: {
387
+ type: 'string',
388
+ description: 'Root account type',
389
+ example: 'Assets'
390
+ }
391
+ },
392
+ required: ['extendable', 'rootType']
393
+ } as const;
394
+
395
+ export const $TemplateMetadataResponseDto = {
396
+ type: 'object',
397
+ properties: {
398
+ metadata: {
399
+ $ref: '#/components/schemas/TemplateMetadataDto'
400
+ }
401
+ }
402
+ } as const;
403
+
404
+ export const $RegionConfigDto = {
405
+ type: 'object',
406
+ properties: {
407
+ currency: {
408
+ type: 'string',
409
+ example: 'EUR'
410
+ },
411
+ dateFormat: {
412
+ type: 'string',
413
+ example: 'DD.MM.YYYY'
414
+ },
415
+ locale: {
416
+ type: 'string',
417
+ example: 'de-DE'
418
+ }
419
+ },
420
+ required: ['currency', 'dateFormat', 'locale']
421
+ } as const;
422
+
423
+ export const $RegionInfoDto = {
424
+ type: 'object',
425
+ properties: {
426
+ code: {
427
+ type: 'string',
428
+ example: 'de'
429
+ },
430
+ displayName: {
431
+ type: 'string',
432
+ example: 'Germany'
433
+ },
434
+ parent: {
435
+ type: 'string',
436
+ example: 'eu-core'
437
+ },
438
+ chain: {
439
+ example: ['eu-core', 'de'],
440
+ type: 'array',
441
+ items: {
442
+ type: 'string'
443
+ }
444
+ },
445
+ config: {
446
+ $ref: '#/components/schemas/RegionConfigDto'
447
+ }
448
+ },
449
+ required: ['code', 'displayName', 'chain', 'config']
450
+ } as const;
451
+
452
+ export const $RegionsMetadataResponseDto = {
453
+ type: 'object',
454
+ properties: {
455
+ regions: {
456
+ type: 'array',
457
+ items: {
458
+ $ref: '#/components/schemas/RegionInfoDto'
459
+ }
460
+ }
461
+ },
462
+ required: ['regions']
463
+ } as const;
464
+
295
465
  export const $CreatePostingDto = {
296
466
  type: 'object',
297
467
  properties: {
@@ -607,6 +777,60 @@ export const $ApiProblemResponseDto = {
607
777
  required: ['type', 'title', 'status', 'detail']
608
778
  } as const;
609
779
 
780
+ export const $BatchCreateTransactionDto = {
781
+ type: 'object',
782
+ properties: {
783
+ transactions: {
784
+ description: 'Array of transactions to create',
785
+ minItems: 1,
786
+ maxItems: 100,
787
+ type: 'array',
788
+ items: {
789
+ $ref: '#/components/schemas/CreateTransactionDto'
790
+ }
791
+ }
792
+ },
793
+ required: ['transactions']
794
+ } as const;
795
+
796
+ export const $BatchTransactionErrorDto = {
797
+ type: 'object',
798
+ properties: {
799
+ index: {
800
+ type: 'number',
801
+ description: 'Index of failed transaction in the input array',
802
+ example: 0
803
+ },
804
+ error: {
805
+ type: 'string',
806
+ description: 'Error message describing the failure',
807
+ example: 'Transaction does not balance'
808
+ }
809
+ },
810
+ required: ['index', 'error']
811
+ } as const;
812
+
813
+ export const $BatchTransactionResponseDto = {
814
+ type: 'object',
815
+ properties: {
816
+ succeeded: {
817
+ description: 'Successfully created transactions',
818
+ type: 'array',
819
+ items: {
820
+ $ref: '#/components/schemas/TransactionResponseDto'
821
+ }
822
+ },
823
+ failed: {
824
+ description: 'Failed transactions with error details',
825
+ type: 'array',
826
+ items: {
827
+ $ref: '#/components/schemas/BatchTransactionErrorDto'
828
+ }
829
+ }
830
+ },
831
+ required: ['succeeded', 'failed']
832
+ } as const;
833
+
610
834
  export const $PostingDetailDto = {
611
835
  type: 'object',
612
836
  properties: {
@@ -876,185 +1100,59 @@ export const $UpdateTransactionDto = {
876
1100
  }
877
1101
  } as const;
878
1102
 
879
- export const $AccountStandardResponseDto = {
1103
+ export const $BalanceResponseDto = {
880
1104
  type: 'object',
881
1105
  properties: {
882
- path: {
1106
+ account: {
883
1107
  type: 'string',
884
- description: 'Account path (hierarchical, colon-separated)',
885
- example: 'Assets:CN:Bank:ICBC:Checking'
1108
+ description: 'Account name',
1109
+ example: 'Assets:Bank:Checking'
886
1110
  },
887
- type: {
1111
+ balance: {
888
1112
  type: 'string',
889
- description: 'Account type in Beancount hierarchy',
890
- enum: ['Assets', 'Liabilities', 'Income', 'Expenses', 'Equity'],
891
- example: 'Assets'
1113
+ description: 'Balance amount (decimal string for precision)',
1114
+ example: '12345.67'
892
1115
  },
893
- i18nKey: {
1116
+ currency: {
894
1117
  type: 'string',
895
- description: 'i18n key for localized display name',
896
- example: 'account.assets.cn.bank.icbc.checking'
1118
+ description: 'Currency code',
1119
+ example: 'USD'
897
1120
  },
898
- description: {
1121
+ date: {
899
1122
  type: 'string',
900
- description: 'Account description',
901
- example: 'ICBC checking account for daily transactions'
1123
+ description: 'Date of the balance calculation (ISO 8601)',
1124
+ example: '2024-12-31T00:00:00.000Z'
1125
+ }
1126
+ },
1127
+ required: ['account', 'balance', 'currency', 'date']
1128
+ } as const;
1129
+
1130
+ export const $MultiCurrencyBalanceResponseDto = {
1131
+ type: 'object',
1132
+ properties: {
1133
+ account: {
1134
+ type: 'string',
1135
+ description: 'Account name',
1136
+ example: 'Assets:Bank:Checking'
902
1137
  },
903
- tags: {
904
- description: 'Account tags for categorization',
905
- example: ['bank', 'checking', 'primary'],
906
- type: 'array',
907
- items: {
908
- type: 'string'
1138
+ balances: {
1139
+ type: 'object',
1140
+ description: 'Balances by currency',
1141
+ example: {
1142
+ USD: '12345.67',
1143
+ CNY: '100000.00'
909
1144
  }
910
1145
  },
911
- icon: {
1146
+ date: {
912
1147
  type: 'string',
913
- description: 'Icon identifier for UI display',
914
- example: 'bank-icbc'
1148
+ description: 'Date of the balance calculation (ISO 8601)',
1149
+ example: '2024-12-31T00:00:00.000Z'
915
1150
  }
916
1151
  },
917
- required: ['path', 'type']
1152
+ required: ['account', 'balances', 'date']
918
1153
  } as const;
919
1154
 
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']
1030
- } as const;
1031
-
1032
- export const $MultiCurrencyBalanceResponseDto = {
1033
- type: 'object',
1034
- properties: {
1035
- account: {
1036
- type: 'string',
1037
- description: 'Account name',
1038
- example: 'Assets:Bank:Checking'
1039
- },
1040
- balances: {
1041
- type: 'object',
1042
- description: 'Balances by currency',
1043
- example: {
1044
- USD: '12345.67',
1045
- CNY: '100000.00'
1046
- }
1047
- },
1048
- date: {
1049
- type: 'string',
1050
- description: 'Date of the balance calculation (ISO 8601)',
1051
- example: '2024-12-31T00:00:00.000Z'
1052
- }
1053
- },
1054
- required: ['account', 'balances', 'date']
1055
- } as const;
1056
-
1057
- export const $TransactionSummaryDto = {
1155
+ export const $TransactionSummaryDto = {
1058
1156
  type: 'object',
1059
1157
  properties: {
1060
1158
  id: {
@@ -1418,131 +1516,307 @@ export const $ReviewDetailDto = {
1418
1516
  ]
1419
1517
  } as const;
1420
1518
 
1421
- export const $PayeeResponseDto = {
1519
+ export const $ResolveReviewDto = {
1422
1520
  type: 'object',
1423
1521
  properties: {
1424
- id: {
1522
+ action: {
1425
1523
  type: 'string',
1426
- description: 'Unique identifier (UUID)',
1427
- example: 'uuid-123-456'
1524
+ description:
1525
+ 'Decision action. Available actions vary by review type: DUPLICATE: UPGRADE_REPLACE, KEEP_EXISTING, KEEP_BOTH | PAYEE_MATCH: ACCEPT, REJECT, ACCEPT_AND_LEARN | ACCOUNT_VALIDATION: FIX, REJECT | RULE_MATCH: ACCEPT, REJECT, ACCEPT_AND_LEARN',
1526
+ example: 'ACCEPT'
1428
1527
  },
1429
- userId: {
1430
- type: 'string',
1431
- description: 'User ID (owner of this payee mapping)',
1432
- example: 'user-123'
1528
+ data: {
1529
+ type: 'object',
1530
+ description:
1531
+ 'Additional data for the decision (e.g., selected account ID)',
1532
+ example: {
1533
+ accountId: 'acc-123'
1534
+ }
1535
+ }
1536
+ },
1537
+ required: ['action']
1538
+ } as const;
1539
+
1540
+ export const $ResolveResultDto = {
1541
+ type: 'object',
1542
+ properties: {
1543
+ success: {
1544
+ type: 'boolean',
1545
+ description: 'Whether resolution was successful'
1433
1546
  },
1434
- payee: {
1547
+ messageKey: {
1435
1548
  type: 'string',
1436
- description: "User's original payee name (e.g., 'Starbucks', 'McDonald')",
1437
- example: 'Starbucks'
1438
- },
1439
- payeeProfileId: {
1440
- type: 'object',
1441
1549
  description:
1442
- 'Reference to global PayeeProfile (merchant info, i18n keys, categories)',
1443
- example: 'uuid-789',
1444
- nullable: true
1550
+ 'i18n message key for result message (e.g., review.payee.result.mapped)'
1445
1551
  },
1446
- customCategory: {
1552
+ messageParams: {
1447
1553
  type: 'object',
1448
1554
  description:
1449
- "User's custom category (overrides PayeeProfile category if set)",
1450
- example: 'Dining:Coffee',
1451
- nullable: true
1452
- },
1453
- customTags: {
1454
- description: "User's custom tags (e.g., ['favorite', 'work_meal'])",
1455
- example: ['favorite', 'work_meal'],
1456
- type: 'array',
1457
- items: {
1555
+ 'Parameters for message interpolation (e.g., { name: "PayeeName" })',
1556
+ additionalProperties: {
1458
1557
  type: 'string'
1459
1558
  }
1460
1559
  },
1461
- useCount: {
1462
- type: 'number',
1463
- description:
1464
- 'Usage count (number of times this payee was used in transactions)',
1465
- example: 42
1560
+ resolutionId: {
1561
+ type: 'string',
1562
+ description: 'Resolution ID for undo'
1466
1563
  },
1467
- lastUsedAt: {
1564
+ canUndo: {
1565
+ type: 'boolean',
1566
+ description: 'Whether this decision can be undone'
1567
+ },
1568
+ undoDeadline: {
1468
1569
  format: 'date-time',
1469
1570
  type: 'string',
1470
- description: 'Last used timestamp',
1471
- example: '2024-11-20T10:00:00Z'
1472
- },
1473
- meta: {
1474
- type: 'object',
1475
- description: 'Extended metadata (location, notes, contact info, etc.)',
1476
- example: {
1477
- location: 'Zhongguancun',
1478
- note: 'Near subway station',
1479
- favorite: true
1480
- }
1571
+ description: 'Deadline for undo (24h from resolution)'
1481
1572
  },
1482
- isActive: {
1573
+ learnedRuleId: {
1574
+ type: 'string',
1575
+ description:
1576
+ 'Rule ID if learning was triggered (ACCEPT_AND_LEARN actions). Use this to deep-link to the rule management page.',
1577
+ example: 'rule_01HXK5V8N2M3P4Q5R6S7T8U9V0'
1578
+ }
1579
+ },
1580
+ required: ['success', 'resolutionId', 'canUndo', 'undoDeadline']
1581
+ } as const;
1582
+
1583
+ export const $UndoResultDto = {
1584
+ type: 'object',
1585
+ properties: {
1586
+ success: {
1483
1587
  type: 'boolean',
1484
- description: 'Active status (inactive payees hidden from autocomplete)',
1485
- example: true
1588
+ description: 'Whether undo was successful'
1486
1589
  },
1487
- createdAt: {
1488
- format: 'date-time',
1590
+ message: {
1489
1591
  type: 'string',
1490
- description: 'Creation timestamp (first time this payee was used)',
1491
- example: '2024-01-01T10:00:00Z'
1592
+ description: 'Message'
1492
1593
  },
1493
- updatedAt: {
1494
- format: 'date-time',
1594
+ reviewId: {
1495
1595
  type: 'string',
1496
- description: 'Last update timestamp',
1497
- example: '2024-11-20T10:00:00Z'
1596
+ description: 'Review item ID that was restored'
1498
1597
  }
1499
1598
  },
1500
- required: [
1501
- 'id',
1502
- 'userId',
1503
- 'payee',
1504
- 'customTags',
1505
- 'useCount',
1506
- 'lastUsedAt',
1507
- 'meta',
1508
- 'isActive',
1509
- 'createdAt',
1510
- 'updatedAt'
1511
- ]
1599
+ required: ['success', 'reviewId']
1512
1600
  } as const;
1513
1601
 
1514
- export const $PayeeListResponseDto = {
1602
+ export const $BatchResolveDto = {
1515
1603
  type: 'object',
1516
1604
  properties: {
1517
- items: {
1518
- description: 'List of payees',
1605
+ reviewIds: {
1606
+ description: 'Review item IDs to resolve',
1607
+ example: ['review-1', 'review-2', 'review-3'],
1519
1608
  type: 'array',
1520
1609
  items: {
1521
- $ref: '#/components/schemas/PayeeResponseDto'
1610
+ type: 'string'
1522
1611
  }
1523
1612
  },
1524
- total: {
1525
- type: 'number',
1526
- description: 'Total number of payees',
1527
- example: 42
1613
+ action: {
1614
+ type: 'string',
1615
+ description: 'Decision action to apply to all items',
1616
+ example: 'ACCEPT'
1617
+ },
1618
+ data: {
1619
+ type: 'object',
1620
+ description: 'Additional data for the decision'
1528
1621
  }
1529
1622
  },
1530
- required: ['items', 'total']
1623
+ required: ['reviewIds', 'action']
1531
1624
  } as const;
1532
1625
 
1533
- export const $PayeeAutocompleteResponseDto = {
1626
+ export const $BatchResolveResultDto = {
1534
1627
  type: 'object',
1535
1628
  properties: {
1536
- suggestions: {
1537
- description: 'List of matching payee names',
1538
- example: ['Starbucks', 'Starbucks Coffee', 'Starbucks Reserve'],
1629
+ successCount: {
1630
+ type: 'number',
1631
+ description: 'Number of successfully resolved items'
1632
+ },
1633
+ failedCount: {
1634
+ type: 'number',
1635
+ description: 'Number of failed items'
1636
+ },
1637
+ results: {
1638
+ description: 'Details for each item',
1539
1639
  type: 'array',
1540
1640
  items: {
1541
1641
  type: 'string'
1542
1642
  }
1543
1643
  }
1544
1644
  },
1545
- required: ['suggestions']
1645
+ required: ['successCount', 'failedCount', 'results']
1646
+ } as const;
1647
+
1648
+ export const $CreatePayeeDto = {
1649
+ type: 'object',
1650
+ properties: {
1651
+ payee: {
1652
+ type: 'string',
1653
+ description:
1654
+ "User's original payee name (e.g., 'Starbucks', 'McDonald'). This is the raw payee string as entered by the user.",
1655
+ example: 'Starbucks',
1656
+ maxLength: 200
1657
+ },
1658
+ payeeProfileId: {
1659
+ type: 'string',
1660
+ description:
1661
+ 'Optional reference to global PayeeProfile for standardized data (merchant info, i18n keys, categories)',
1662
+ example: 'uuid-123',
1663
+ format: 'uuid'
1664
+ },
1665
+ customCategory: {
1666
+ type: 'string',
1667
+ description:
1668
+ "User's custom category for this payee (overrides PayeeProfile category)",
1669
+ example: 'Dining:Coffee',
1670
+ maxLength: 100
1671
+ },
1672
+ customTags: {
1673
+ description:
1674
+ "User's custom tags for this payee (e.g., ['favorite', 'work_meal'])",
1675
+ example: ['favorite', 'work_meal'],
1676
+ type: 'array',
1677
+ items: {
1678
+ type: 'string'
1679
+ }
1680
+ },
1681
+ meta: {
1682
+ type: 'object',
1683
+ description:
1684
+ 'Metadata for extended information (location, notes, contact info, etc.)',
1685
+ example: {
1686
+ location: 'Zhongguancun',
1687
+ note: 'Near subway station',
1688
+ favorite: true
1689
+ }
1690
+ }
1691
+ },
1692
+ required: ['payee']
1693
+ } as const;
1694
+
1695
+ export const $PayeeResponseDto = {
1696
+ type: 'object',
1697
+ properties: {
1698
+ id: {
1699
+ type: 'string',
1700
+ description: 'Unique identifier (UUID)',
1701
+ example: 'uuid-123-456'
1702
+ },
1703
+ userId: {
1704
+ type: 'string',
1705
+ description: 'User ID (owner of this payee mapping)',
1706
+ example: 'user-123'
1707
+ },
1708
+ payee: {
1709
+ type: 'string',
1710
+ description: "User's original payee name (e.g., 'Starbucks', 'McDonald')",
1711
+ example: 'Starbucks'
1712
+ },
1713
+ payeeProfileId: {
1714
+ type: 'string',
1715
+ description:
1716
+ 'Reference to global PayeeProfile (merchant info, i18n keys, categories)',
1717
+ example: 'uuid-789',
1718
+ nullable: true
1719
+ },
1720
+ customCategory: {
1721
+ type: 'string',
1722
+ description:
1723
+ "User's custom category (overrides PayeeProfile category if set)",
1724
+ example: 'Dining:Coffee',
1725
+ nullable: true
1726
+ },
1727
+ customTags: {
1728
+ description: "User's custom tags (e.g., ['favorite', 'work_meal'])",
1729
+ example: ['favorite', 'work_meal'],
1730
+ type: 'array',
1731
+ items: {
1732
+ type: 'string'
1733
+ }
1734
+ },
1735
+ useCount: {
1736
+ type: 'number',
1737
+ description:
1738
+ 'Usage count (number of times this payee was used in transactions)',
1739
+ example: 42
1740
+ },
1741
+ lastUsedAt: {
1742
+ format: 'date-time',
1743
+ type: 'string',
1744
+ description: 'Last used timestamp',
1745
+ example: '2024-11-20T10:00:00Z'
1746
+ },
1747
+ meta: {
1748
+ type: 'object',
1749
+ description: 'Extended metadata (location, notes, contact info, etc.)',
1750
+ example: {
1751
+ location: 'Zhongguancun',
1752
+ note: 'Near subway station',
1753
+ favorite: true
1754
+ }
1755
+ },
1756
+ isActive: {
1757
+ type: 'boolean',
1758
+ description: 'Active status (inactive payees hidden from autocomplete)',
1759
+ example: true
1760
+ },
1761
+ createdAt: {
1762
+ format: 'date-time',
1763
+ type: 'string',
1764
+ description: 'Creation timestamp (first time this payee was used)',
1765
+ example: '2024-01-01T10:00:00Z'
1766
+ },
1767
+ updatedAt: {
1768
+ format: 'date-time',
1769
+ type: 'string',
1770
+ description: 'Last update timestamp',
1771
+ example: '2024-11-20T10:00:00Z'
1772
+ }
1773
+ },
1774
+ required: [
1775
+ 'id',
1776
+ 'userId',
1777
+ 'payee',
1778
+ 'customTags',
1779
+ 'useCount',
1780
+ 'lastUsedAt',
1781
+ 'meta',
1782
+ 'isActive',
1783
+ 'createdAt',
1784
+ 'updatedAt'
1785
+ ]
1786
+ } as const;
1787
+
1788
+ export const $PayeeListResponseDto = {
1789
+ type: 'object',
1790
+ properties: {
1791
+ items: {
1792
+ description: 'List of payees',
1793
+ type: 'array',
1794
+ items: {
1795
+ $ref: '#/components/schemas/PayeeResponseDto'
1796
+ }
1797
+ },
1798
+ total: {
1799
+ type: 'number',
1800
+ description: 'Total number of payees',
1801
+ example: 42
1802
+ }
1803
+ },
1804
+ required: ['items', 'total']
1805
+ } as const;
1806
+
1807
+ export const $PayeeAutocompleteResponseDto = {
1808
+ type: 'object',
1809
+ properties: {
1810
+ suggestions: {
1811
+ description: 'List of matching payee names',
1812
+ example: ['Starbucks', 'Starbucks Coffee', 'Starbucks Reserve'],
1813
+ type: 'array',
1814
+ items: {
1815
+ type: 'string'
1816
+ }
1817
+ }
1818
+ },
1819
+ required: ['suggestions']
1546
1820
  } as const;
1547
1821
 
1548
1822
  export const $PayeeStatsResponseDto = {
@@ -1550,22 +1824,187 @@ export const $PayeeStatsResponseDto = {
1550
1824
  properties: {
1551
1825
  payee: {
1552
1826
  type: 'string',
1553
- description: 'Payee name',
1554
- example: 'Starbucks'
1827
+ description: 'Payee name',
1828
+ example: 'Starbucks'
1829
+ },
1830
+ transactionCount: {
1831
+ type: 'number',
1832
+ description: 'Total transaction count',
1833
+ example: 42
1834
+ },
1835
+ lastUsedAt: {
1836
+ format: 'date-time',
1837
+ type: 'string',
1838
+ description: 'Last used timestamp',
1839
+ example: '2024-11-20T10:00:00Z'
1840
+ }
1841
+ },
1842
+ required: ['payee', 'transactionCount', 'lastUsedAt']
1843
+ } as const;
1844
+
1845
+ export const $UpdatePayeeDto = {
1846
+ type: 'object',
1847
+ properties: {
1848
+ payeeProfileId: {
1849
+ type: 'string',
1850
+ description:
1851
+ 'Optional reference to global PayeeProfile for standardized data (merchant info, i18n keys, categories)',
1852
+ example: 'uuid-123',
1853
+ format: 'uuid'
1854
+ },
1855
+ customCategory: {
1856
+ type: 'string',
1857
+ description:
1858
+ "User's custom category for this payee (overrides PayeeProfile category)",
1859
+ example: 'Dining:Coffee',
1860
+ maxLength: 100
1861
+ },
1862
+ customTags: {
1863
+ description:
1864
+ "User's custom tags for this payee (e.g., ['favorite', 'work_meal'])",
1865
+ example: ['favorite', 'work_meal'],
1866
+ type: 'array',
1867
+ items: {
1868
+ type: 'string'
1869
+ }
1870
+ },
1871
+ meta: {
1872
+ type: 'object',
1873
+ description:
1874
+ 'Metadata for extended information (location, notes, contact info, etc.). Will merge with existing metadata.',
1875
+ example: {
1876
+ location: 'Zhongguancun',
1877
+ note: 'Updated note',
1878
+ favorite: true
1879
+ }
1880
+ },
1881
+ isActive: {
1882
+ type: 'boolean',
1883
+ description:
1884
+ 'Enable or disable this payee. Disabled payees will not appear in autocomplete suggestions.',
1885
+ example: true
1886
+ }
1887
+ }
1888
+ } as const;
1889
+
1890
+ export const $CreatePayeeProfileDto = {
1891
+ type: 'object',
1892
+ properties: {
1893
+ canonical: {
1894
+ type: 'string',
1895
+ description:
1896
+ 'Canonical payee name (unique, case-insensitive). This is the primary identifier for the payee.',
1897
+ example: 'Starbucks',
1898
+ maxLength: 200
1899
+ },
1900
+ aliases: {
1901
+ description:
1902
+ 'Multi-language aliases for the payee. Used for matching user input in different languages.',
1903
+ example: ['Starbucks Coffee', 'SBUX'],
1904
+ type: 'array',
1905
+ items: {
1906
+ type: 'string'
1907
+ }
1908
+ },
1909
+ i18nKey: {
1910
+ type: 'string',
1911
+ description:
1912
+ 'Translation key for i18n integration (XLIFF translation system)',
1913
+ example: 'payee.starbucks',
1914
+ maxLength: 100
1915
+ },
1916
+ category: {
1917
+ type: 'string',
1918
+ description: 'Payee category classification',
1919
+ enum: [
1920
+ 'RESTAURANT',
1921
+ 'CAFE',
1922
+ 'FAST_FOOD',
1923
+ 'BAR',
1924
+ 'SUPERMARKET',
1925
+ 'CONVENIENCE_STORE',
1926
+ 'SHOPPING_MALL',
1927
+ 'ONLINE_SHOPPING',
1928
+ 'TAXI',
1929
+ 'RIDE_SHARING',
1930
+ 'PUBLIC_TRANSPORT',
1931
+ 'PARKING',
1932
+ 'GAS_STATION',
1933
+ 'UTILITIES',
1934
+ 'TELECOM',
1935
+ 'STREAMING',
1936
+ 'HEALTHCARE',
1937
+ 'EDUCATION',
1938
+ 'ENTERTAINMENT',
1939
+ 'SPORTS',
1940
+ 'TRAVEL',
1941
+ 'HOTEL',
1942
+ 'OTHER'
1943
+ ],
1944
+ example: 'CAFE'
1945
+ },
1946
+ subCategory: {
1947
+ type: 'string',
1948
+ description: 'Sub-category for more specific classification',
1949
+ example: 'coffee_chain',
1950
+ maxLength: 100
1951
+ },
1952
+ countries: {
1953
+ description:
1954
+ 'Country/region codes where the payee operates (ISO 3166-1 alpha-2)',
1955
+ example: ['CN', 'US', 'JP'],
1956
+ type: 'array',
1957
+ items: {
1958
+ type: 'string'
1959
+ }
1960
+ },
1961
+ primaryCountry: {
1962
+ type: 'string',
1963
+ description: 'Primary operating country (ISO 3166-1 alpha-2)',
1964
+ example: 'US',
1965
+ maxLength: 2
1555
1966
  },
1556
- transactionCount: {
1557
- type: 'number',
1558
- description: 'Total transaction count',
1559
- example: 42
1967
+ keywords: {
1968
+ description: 'Search keywords for fuzzy matching',
1969
+ example: ['coffee', 'cafe', 'drinks'],
1970
+ type: 'array',
1971
+ items: {
1972
+ type: 'string'
1973
+ }
1560
1974
  },
1561
- lastUsedAt: {
1562
- format: 'date-time',
1975
+ logoUrl: {
1563
1976
  type: 'string',
1564
- description: 'Last used timestamp',
1565
- example: '2024-11-20T10:00:00Z'
1977
+ description: 'Payee logo URL',
1978
+ example: 'https://example.com/logo.png'
1979
+ },
1980
+ website: {
1981
+ type: 'string',
1982
+ description: 'Official website URL',
1983
+ example: 'https://www.starbucks.com'
1984
+ },
1985
+ description: {
1986
+ type: 'string',
1987
+ description: 'Payee description',
1988
+ example: 'Global coffeehouse chain headquartered in Seattle',
1989
+ maxLength: 1000
1990
+ },
1991
+ meta: {
1992
+ type: 'object',
1993
+ description:
1994
+ 'Extended metadata (business hours, contact info, additional details)',
1995
+ example: {
1996
+ businessHours: '07:00-22:00',
1997
+ phone: '+1-800-782-7282'
1998
+ }
1999
+ },
2000
+ dataSource: {
2001
+ type: 'string',
2002
+ description: 'Data source for this profile',
2003
+ enum: ['MANUAL', 'IMPORT', 'API', 'CROWDSOURCED'],
2004
+ default: 'MANUAL'
1566
2005
  }
1567
2006
  },
1568
- required: ['payee', 'transactionCount', 'lastUsedAt']
2007
+ required: ['canonical', 'category']
1569
2008
  } as const;
1570
2009
 
1571
2010
  export const $PayeeProfileResponseDto = {
@@ -1590,7 +2029,7 @@ export const $PayeeProfileResponseDto = {
1590
2029
  }
1591
2030
  },
1592
2031
  i18nKey: {
1593
- type: 'object',
2032
+ type: 'string',
1594
2033
  description: 'Translation key for i18n',
1595
2034
  example: 'payee.starbucks',
1596
2035
  nullable: true
@@ -1626,7 +2065,7 @@ export const $PayeeProfileResponseDto = {
1626
2065
  example: 'CAFE'
1627
2066
  },
1628
2067
  subCategory: {
1629
- type: 'object',
2068
+ type: 'string',
1630
2069
  description: 'Sub-category',
1631
2070
  example: 'coffee_chain',
1632
2071
  nullable: true
@@ -1640,7 +2079,7 @@ export const $PayeeProfileResponseDto = {
1640
2079
  }
1641
2080
  },
1642
2081
  primaryCountry: {
1643
- type: 'object',
2082
+ type: 'string',
1644
2083
  description: 'Primary operating country',
1645
2084
  example: 'US',
1646
2085
  nullable: true
@@ -1654,19 +2093,19 @@ export const $PayeeProfileResponseDto = {
1654
2093
  }
1655
2094
  },
1656
2095
  logoUrl: {
1657
- type: 'object',
2096
+ type: 'string',
1658
2097
  description: 'Logo URL',
1659
2098
  example: 'https://example.com/logo.png',
1660
2099
  nullable: true
1661
2100
  },
1662
2101
  website: {
1663
- type: 'object',
2102
+ type: 'string',
1664
2103
  description: 'Official website',
1665
2104
  example: 'https://www.starbucks.com',
1666
2105
  nullable: true
1667
2106
  },
1668
2107
  description: {
1669
- type: 'object',
2108
+ type: 'string',
1670
2109
  description: 'Description',
1671
2110
  example: 'Global coffeehouse chain',
1672
2111
  nullable: true
@@ -1682,9 +2121,10 @@ export const $PayeeProfileResponseDto = {
1682
2121
  example: 'MANUAL'
1683
2122
  },
1684
2123
  verifiedAt: {
1685
- type: 'object',
2124
+ type: 'string',
1686
2125
  description: 'Verification timestamp (null if not verified)',
1687
2126
  example: '2025-01-01T00:00:00.000Z',
2127
+ format: 'date-time',
1688
2128
  nullable: true
1689
2129
  },
1690
2130
  isActive: {
@@ -1739,6 +2179,164 @@ export const $PayeeProfileListResponseDto = {
1739
2179
  required: ['items', 'total']
1740
2180
  } as const;
1741
2181
 
2182
+ export const $UpdatePayeeProfileDto = {
2183
+ type: 'object',
2184
+ properties: {
2185
+ aliases: {
2186
+ description:
2187
+ 'Multi-language aliases for the payee. Used for matching user input in different languages.',
2188
+ example: ['Starbucks Coffee', 'SBUX'],
2189
+ type: 'array',
2190
+ items: {
2191
+ type: 'string'
2192
+ }
2193
+ },
2194
+ i18nKey: {
2195
+ type: 'string',
2196
+ description:
2197
+ 'Translation key for i18n integration (XLIFF translation system)',
2198
+ example: 'payee.starbucks',
2199
+ maxLength: 100
2200
+ },
2201
+ category: {
2202
+ type: 'string',
2203
+ description: 'Payee category classification',
2204
+ enum: [
2205
+ 'RESTAURANT',
2206
+ 'CAFE',
2207
+ 'FAST_FOOD',
2208
+ 'BAR',
2209
+ 'SUPERMARKET',
2210
+ 'CONVENIENCE_STORE',
2211
+ 'SHOPPING_MALL',
2212
+ 'ONLINE_SHOPPING',
2213
+ 'TAXI',
2214
+ 'RIDE_SHARING',
2215
+ 'PUBLIC_TRANSPORT',
2216
+ 'PARKING',
2217
+ 'GAS_STATION',
2218
+ 'UTILITIES',
2219
+ 'TELECOM',
2220
+ 'STREAMING',
2221
+ 'HEALTHCARE',
2222
+ 'EDUCATION',
2223
+ 'ENTERTAINMENT',
2224
+ 'SPORTS',
2225
+ 'TRAVEL',
2226
+ 'HOTEL',
2227
+ 'OTHER'
2228
+ ],
2229
+ example: 'CAFE'
2230
+ },
2231
+ subCategory: {
2232
+ type: 'string',
2233
+ description: 'Sub-category for more specific classification',
2234
+ example: 'coffee_chain',
2235
+ maxLength: 100
2236
+ },
2237
+ countries: {
2238
+ description:
2239
+ 'Country/region codes where the payee operates (ISO 3166-1 alpha-2)',
2240
+ example: ['CN', 'US', 'JP'],
2241
+ type: 'array',
2242
+ items: {
2243
+ type: 'string'
2244
+ }
2245
+ },
2246
+ primaryCountry: {
2247
+ type: 'string',
2248
+ description: 'Primary operating country (ISO 3166-1 alpha-2)',
2249
+ example: 'US',
2250
+ maxLength: 2
2251
+ },
2252
+ keywords: {
2253
+ description: 'Search keywords for fuzzy matching',
2254
+ example: ['coffee', 'cafe', 'drinks'],
2255
+ type: 'array',
2256
+ items: {
2257
+ type: 'string'
2258
+ }
2259
+ },
2260
+ logoUrl: {
2261
+ type: 'string',
2262
+ description: 'Payee logo URL',
2263
+ example: 'https://example.com/logo.png'
2264
+ },
2265
+ website: {
2266
+ type: 'string',
2267
+ description: 'Official website URL',
2268
+ example: 'https://www.starbucks.com'
2269
+ },
2270
+ description: {
2271
+ type: 'string',
2272
+ description: 'Payee description',
2273
+ example: 'Global coffeehouse chain headquartered in Seattle',
2274
+ maxLength: 1000
2275
+ },
2276
+ meta: {
2277
+ type: 'object',
2278
+ description:
2279
+ 'Extended metadata (business hours, contact info, additional details)',
2280
+ example: {
2281
+ businessHours: '07:00-22:00',
2282
+ phone: '+1-800-782-7282'
2283
+ }
2284
+ },
2285
+ dataSource: {
2286
+ type: 'string',
2287
+ description: 'Data source for this profile',
2288
+ enum: ['MANUAL', 'IMPORT', 'API', 'CROWDSOURCED'],
2289
+ default: 'MANUAL'
2290
+ },
2291
+ isActive: {
2292
+ type: 'boolean',
2293
+ description: 'Whether the payee profile is active (soft delete)',
2294
+ example: true
2295
+ },
2296
+ verifiedAt: {
2297
+ type: 'string',
2298
+ description:
2299
+ 'Verification timestamp. Set to current time to verify, or null to unverify.',
2300
+ example: '2025-01-01T00:00:00.000Z',
2301
+ format: 'date-time',
2302
+ nullable: true
2303
+ }
2304
+ }
2305
+ } as const;
2306
+
2307
+ export const $CreateCommodityDto = {
2308
+ type: 'object',
2309
+ properties: {
2310
+ symbol: {
2311
+ type: 'string',
2312
+ description:
2313
+ 'Commodity symbol (e.g., AAPL, USD, BTC) - corresponds to Beancount currency field',
2314
+ example: 'AAPL',
2315
+ maxLength: 50
2316
+ },
2317
+ date: {
2318
+ type: 'string',
2319
+ description:
2320
+ 'Commodity definition date (ISO 8601, required per Beancount spec). Represents when this commodity was first defined in the accounting system.',
2321
+ example: '2024-01-01',
2322
+ format: 'date'
2323
+ },
2324
+ metadata: {
2325
+ type: 'object',
2326
+ description:
2327
+ 'Metadata (corresponds to Beancount meta field). Can contain name, assetClass, precision, note, tags, etc.',
2328
+ example: {
2329
+ name: 'Apple Inc.',
2330
+ assetClass: 'stock',
2331
+ precision: 2,
2332
+ note: 'Long-term investment',
2333
+ tags: ['tech', 'dividend']
2334
+ }
2335
+ }
2336
+ },
2337
+ required: ['symbol', 'date']
2338
+ } as const;
2339
+
1742
2340
  export const $CommodityResponseDto = {
1743
2341
  type: 'object',
1744
2342
  properties: {
@@ -1748,7 +2346,7 @@ export const $CommodityResponseDto = {
1748
2346
  example: 'uuid-123-456'
1749
2347
  },
1750
2348
  userId: {
1751
- type: 'object',
2349
+ type: 'string',
1752
2350
  description: 'User ID (owner of the commodity)',
1753
2351
  example: 'user-123',
1754
2352
  nullable: true
@@ -1777,13 +2375,6 @@ export const $CommodityResponseDto = {
1777
2375
  source: 'AUTO_CREATED'
1778
2376
  }
1779
2377
  },
1780
- symbolProfileId: {
1781
- type: 'object',
1782
- description:
1783
- 'Reference to SymbolProfile (market data integration, SaaS feature)',
1784
- example: 'uuid-789',
1785
- nullable: true
1786
- },
1787
2378
  createdAt: {
1788
2379
  format: 'date-time',
1789
2380
  type: 'string',
@@ -1810,13 +2401,137 @@ export const $CommodityListResponseDto = {
1810
2401
  $ref: '#/components/schemas/CommodityResponseDto'
1811
2402
  }
1812
2403
  },
1813
- total: {
1814
- type: 'number',
1815
- description: 'Total number of commodities',
1816
- example: 42
2404
+ total: {
2405
+ type: 'number',
2406
+ description: 'Total number of commodities',
2407
+ example: 42
2408
+ }
2409
+ },
2410
+ required: ['items', 'total']
2411
+ } as const;
2412
+
2413
+ export const $UpdateCommodityDto = {
2414
+ type: 'object',
2415
+ properties: {
2416
+ date: {
2417
+ type: 'string',
2418
+ description:
2419
+ 'Commodity definition date (ISO 8601). Represents when this commodity was first defined in the accounting system.',
2420
+ example: '2024-01-01',
2421
+ format: 'date'
2422
+ },
2423
+ metadata: {
2424
+ type: 'object',
2425
+ description:
2426
+ 'Metadata (corresponds to Beancount meta field). Will merge with existing metadata. Can contain name, assetClass, precision, note, tags, etc.',
2427
+ example: {
2428
+ name: 'Updated Apple Inc.',
2429
+ assetClass: 'equity',
2430
+ precision: 4,
2431
+ note: 'Updated investment strategy',
2432
+ lastReviewed: '2024-11-03'
2433
+ }
2434
+ }
2435
+ }
2436
+ } as const;
2437
+
2438
+ export const $CreateRecurringRuleDto = {
2439
+ type: 'object',
2440
+ properties: {
2441
+ name: {
2442
+ type: 'string',
2443
+ description: 'Rule name (unique per user)',
2444
+ maxLength: 100
2445
+ },
2446
+ icon: {
2447
+ type: 'string',
2448
+ description: 'Icon emoji',
2449
+ maxLength: 10
2450
+ },
2451
+ frequency: {
2452
+ type: 'string',
2453
+ description: 'Recurring frequency',
2454
+ enum: [
2455
+ 'WEEKLY',
2456
+ 'BIWEEKLY',
2457
+ 'MONTHLY',
2458
+ 'BIMONTHLY',
2459
+ 'QUARTERLY',
2460
+ 'YEARLY',
2461
+ 'CUSTOM'
2462
+ ]
2463
+ },
2464
+ expectedAmount: {
2465
+ type: 'number',
2466
+ description: 'Expected amount (positive number)',
2467
+ minimum: 0
2468
+ },
2469
+ expectedDay: {
2470
+ type: 'number',
2471
+ description: 'Expected day of month (1-31)',
2472
+ minimum: 1,
2473
+ maximum: 31
2474
+ },
2475
+ customIntervalDays: {
2476
+ type: 'number',
2477
+ description: 'Custom interval in days (required for CUSTOM frequency)',
2478
+ minimum: 1
2479
+ },
2480
+ currency: {
2481
+ type: 'string',
2482
+ description: 'Currency code',
2483
+ default: 'CNY',
2484
+ maxLength: 10
2485
+ },
2486
+ matchPayeePattern: {
2487
+ type: 'string',
2488
+ description: 'Payee matching pattern (supports wildcards)',
2489
+ maxLength: 200
2490
+ },
2491
+ matchAmountTolerance: {
2492
+ type: 'number',
2493
+ description: 'Amount tolerance percentage (0-1)',
2494
+ default: 0.075,
2495
+ minimum: 0,
2496
+ maximum: 1
2497
+ },
2498
+ defaultExpenseAccount: {
2499
+ type: 'string',
2500
+ description: 'Default expense account for auto-create',
2501
+ maxLength: 200
2502
+ },
2503
+ defaultPaymentAccount: {
2504
+ type: 'string',
2505
+ description: 'Default payment account for auto-create',
2506
+ maxLength: 200
2507
+ },
2508
+ defaultPayee: {
2509
+ type: 'string',
2510
+ description: 'Default payee for auto-create',
2511
+ maxLength: 200
2512
+ },
2513
+ autoCreate: {
2514
+ type: 'boolean',
2515
+ description: 'Auto-create transaction when expected date arrives',
2516
+ default: false
2517
+ },
2518
+ startDate: {
2519
+ type: 'string',
2520
+ description: 'Rule start date (ISO format)'
2521
+ },
2522
+ endDate: {
2523
+ type: 'string',
2524
+ description: 'Rule end date (ISO format)'
1817
2525
  }
1818
2526
  },
1819
- required: ['items', 'total']
2527
+ required: [
2528
+ 'name',
2529
+ 'frequency',
2530
+ 'expectedAmount',
2531
+ 'currency',
2532
+ 'matchAmountTolerance',
2533
+ 'autoCreate'
2534
+ ]
1820
2535
  } as const;
1821
2536
 
1822
2537
  export const $RecurringRuleResponseDto = {
@@ -1930,6 +2645,37 @@ export const $RecurringRuleResponseDto = {
1930
2645
  ]
1931
2646
  } as const;
1932
2647
 
2648
+ export const $CreateRuleFromTransactionDto = {
2649
+ type: 'object',
2650
+ properties: {
2651
+ frequency: {
2652
+ type: 'string',
2653
+ description: 'Recurring frequency',
2654
+ enum: [
2655
+ 'WEEKLY',
2656
+ 'BIWEEKLY',
2657
+ 'MONTHLY',
2658
+ 'BIMONTHLY',
2659
+ 'QUARTERLY',
2660
+ 'YEARLY',
2661
+ 'CUSTOM'
2662
+ ],
2663
+ example: 'MONTHLY'
2664
+ },
2665
+ name: {
2666
+ type: 'string',
2667
+ description: 'Optional name override (default: transaction payee)',
2668
+ maxLength: 100
2669
+ },
2670
+ icon: {
2671
+ type: 'string',
2672
+ description: 'Optional icon emoji',
2673
+ maxLength: 10
2674
+ }
2675
+ },
2676
+ required: ['frequency']
2677
+ } as const;
2678
+
1933
2679
  export const $RecurringRuleWithStatsResponseDto = {
1934
2680
  type: 'object',
1935
2681
  properties: {
@@ -2088,6 +2834,94 @@ export const $RecurringRuleWithStatsResponseDto = {
2088
2834
  ]
2089
2835
  } as const;
2090
2836
 
2837
+ export const $UpdateRecurringRuleDto = {
2838
+ type: 'object',
2839
+ properties: {
2840
+ name: {
2841
+ type: 'string',
2842
+ description: 'Rule name',
2843
+ maxLength: 100
2844
+ },
2845
+ icon: {
2846
+ type: 'string',
2847
+ description: 'Icon emoji',
2848
+ maxLength: 10
2849
+ },
2850
+ frequency: {
2851
+ type: 'string',
2852
+ description: 'Recurring frequency',
2853
+ enum: [
2854
+ 'WEEKLY',
2855
+ 'BIWEEKLY',
2856
+ 'MONTHLY',
2857
+ 'BIMONTHLY',
2858
+ 'QUARTERLY',
2859
+ 'YEARLY',
2860
+ 'CUSTOM'
2861
+ ]
2862
+ },
2863
+ expectedAmount: {
2864
+ type: 'number',
2865
+ description: 'Expected amount',
2866
+ minimum: 0
2867
+ },
2868
+ expectedDay: {
2869
+ type: 'number',
2870
+ description: 'Expected day of month (1-31)',
2871
+ minimum: 1,
2872
+ maximum: 31
2873
+ },
2874
+ customIntervalDays: {
2875
+ type: 'number',
2876
+ description: 'Custom interval in days',
2877
+ minimum: 1
2878
+ },
2879
+ currency: {
2880
+ type: 'string',
2881
+ description: 'Currency code',
2882
+ maxLength: 10
2883
+ },
2884
+ matchPayeePattern: {
2885
+ type: 'string',
2886
+ description: 'Payee matching pattern',
2887
+ maxLength: 200
2888
+ },
2889
+ matchAmountTolerance: {
2890
+ type: 'number',
2891
+ description: 'Amount tolerance percentage (0-1)',
2892
+ minimum: 0,
2893
+ maximum: 1
2894
+ },
2895
+ defaultExpenseAccount: {
2896
+ type: 'string',
2897
+ description: 'Default expense account',
2898
+ maxLength: 200
2899
+ },
2900
+ defaultPaymentAccount: {
2901
+ type: 'string',
2902
+ description: 'Default payment account',
2903
+ maxLength: 200
2904
+ },
2905
+ defaultPayee: {
2906
+ type: 'string',
2907
+ description: 'Default payee',
2908
+ maxLength: 200
2909
+ },
2910
+ autoCreate: {
2911
+ type: 'boolean',
2912
+ description: 'Auto-create transaction'
2913
+ },
2914
+ isActive: {
2915
+ type: 'boolean',
2916
+ description: 'Rule active status'
2917
+ },
2918
+ endDate: {
2919
+ type: 'string',
2920
+ description: 'Rule end date (ISO format)'
2921
+ }
2922
+ }
2923
+ } as const;
2924
+
2091
2925
  export const $ExpectedTransactionRuleDto = {
2092
2926
  type: 'object',
2093
2927
  properties: {
@@ -2204,6 +3038,50 @@ export const $ExpectedTransactionListResponseDto = {
2204
3038
  required: ['items', 'total']
2205
3039
  } as const;
2206
3040
 
3041
+ export const $ConfirmMatchDto = {
3042
+ type: 'object',
3043
+ properties: {
3044
+ transactionId: {
3045
+ type: 'string',
3046
+ description: 'Transaction ID to match with'
3047
+ }
3048
+ },
3049
+ required: ['transactionId']
3050
+ } as const;
3051
+
3052
+ export const $EnterNowDto = {
3053
+ type: 'object',
3054
+ properties: {
3055
+ expenseAccount: {
3056
+ type: 'string',
3057
+ description:
3058
+ 'Override expense account (uses rule default if not provided)',
3059
+ maxLength: 200
3060
+ },
3061
+ paymentAccount: {
3062
+ type: 'string',
3063
+ description:
3064
+ 'Override payment account (uses rule default if not provided)',
3065
+ maxLength: 200
3066
+ },
3067
+ amount: {
3068
+ type: 'number',
3069
+ description: 'Override amount (uses expected amount if not provided)',
3070
+ minimum: 0
3071
+ },
3072
+ payee: {
3073
+ type: 'string',
3074
+ description: 'Override payee (uses rule default if not provided)',
3075
+ maxLength: 200
3076
+ },
3077
+ narration: {
3078
+ type: 'string',
3079
+ description: 'Optional narration',
3080
+ maxLength: 500
3081
+ }
3082
+ }
3083
+ } as const;
3084
+
2207
3085
  export const $ForecastItemDto = {
2208
3086
  type: 'object',
2209
3087
  properties: {
@@ -2228,7 +3106,7 @@ export const $ForecastItemDto = {
2228
3106
  example: '2024-04-01'
2229
3107
  },
2230
3108
  icon: {
2231
- type: 'object',
3109
+ type: 'string',
2232
3110
  description: 'Rule icon emoji',
2233
3111
  example: '🏠',
2234
3112
  nullable: true
@@ -2328,6 +3206,107 @@ export const $ForecastResponseDto = {
2328
3206
  ]
2329
3207
  } as const;
2330
3208
 
3209
+ export const $CreateTransactionRuleDto = {
3210
+ type: 'object',
3211
+ properties: {
3212
+ name: {
3213
+ type: 'string',
3214
+ minLength: 1,
3215
+ maxLength: 100
3216
+ },
3217
+ description: {
3218
+ type: 'string',
3219
+ maxLength: 500
3220
+ },
3221
+ narrationKeywords: {
3222
+ items: {
3223
+ type: 'array'
3224
+ },
3225
+ maxItems: 50,
3226
+ type: 'array'
3227
+ },
3228
+ payeeKeywords: {
3229
+ items: {
3230
+ type: 'array'
3231
+ },
3232
+ maxItems: 50,
3233
+ type: 'array'
3234
+ },
3235
+ categoryKeywords: {
3236
+ items: {
3237
+ type: 'array'
3238
+ },
3239
+ maxItems: 50,
3240
+ type: 'array'
3241
+ },
3242
+ methodKeywords: {
3243
+ items: {
3244
+ type: 'array'
3245
+ },
3246
+ maxItems: 50,
3247
+ description: 'Payment method keywords (e.g., HuaBei, YuEBao)',
3248
+ type: 'array'
3249
+ },
3250
+ categoryAccount: {
3251
+ type: 'string',
3252
+ maxLength: 200,
3253
+ description:
3254
+ 'Destination account for expenses/income (e.g., Expenses:Food:Coffee)'
3255
+ },
3256
+ matchLogic: {
3257
+ type: 'string',
3258
+ enum: ['OR', 'AND'],
3259
+ default: 'OR'
3260
+ },
3261
+ amountMin: {
3262
+ type: 'number',
3263
+ minimum: 0,
3264
+ description: 'Minimum transaction amount (inclusive)'
3265
+ },
3266
+ amountMax: {
3267
+ type: 'number',
3268
+ minimum: 0,
3269
+ description: 'Maximum transaction amount (inclusive)'
3270
+ },
3271
+ priority: {
3272
+ type: 'number',
3273
+ default: 50,
3274
+ minimum: 0,
3275
+ maximum: 1000
3276
+ },
3277
+ additionalTags: {
3278
+ items: {
3279
+ type: 'array'
3280
+ },
3281
+ maxItems: 20,
3282
+ type: 'array'
3283
+ },
3284
+ additionalMetadata: {
3285
+ type: 'object'
3286
+ },
3287
+ upsertByPayee: {
3288
+ type: 'boolean',
3289
+ description:
3290
+ 'If true, update existing rule with matching payeeKeywords[0] instead of creating new rule'
3291
+ }
3292
+ },
3293
+ required: ['name', 'matchLogic', 'priority']
3294
+ } as const;
3295
+
3296
+ export const $AmountRangeDto = {
3297
+ type: 'object',
3298
+ properties: {
3299
+ min: {
3300
+ type: 'number',
3301
+ description: 'Minimum amount'
3302
+ },
3303
+ max: {
3304
+ type: 'number',
3305
+ description: 'Maximum amount'
3306
+ }
3307
+ }
3308
+ } as const;
3309
+
2331
3310
  export const $TransactionRuleResponseDto = {
2332
3311
  type: 'object',
2333
3312
  properties: {
@@ -2382,12 +3361,12 @@ export const $TransactionRuleResponseDto = {
2382
3361
  example: 'OR'
2383
3362
  },
2384
3363
  amountRange: {
2385
- type: 'object',
2386
3364
  description: 'Amount range for matching',
2387
- example: {
2388
- min: 0,
2389
- max: 100
2390
- }
3365
+ allOf: [
3366
+ {
3367
+ $ref: '#/components/schemas/AmountRangeDto'
3368
+ }
3369
+ ]
2391
3370
  },
2392
3371
  priority: {
2393
3372
  type: 'number',
@@ -2402,6 +3381,7 @@ export const $TransactionRuleResponseDto = {
2402
3381
  type: 'string',
2403
3382
  description: 'Learning source: NLP, REVIEW_CENTER, or null for manual',
2404
3383
  enum: ['NLP', 'REVIEW_CENTER'],
3384
+ nullable: true,
2405
3385
  example: 'REVIEW_CENTER'
2406
3386
  },
2407
3387
  autoApplyEnabled: {
@@ -2423,7 +3403,9 @@ export const $TransactionRuleResponseDto = {
2423
3403
  additionalMetadata: {
2424
3404
  type: 'object',
2425
3405
  description: 'Additional metadata',
2426
- example: {}
3406
+ additionalProperties: {
3407
+ type: 'string'
3408
+ }
2427
3409
  },
2428
3410
  createdAt: {
2429
3411
  format: 'date-time',
@@ -2596,6 +3578,64 @@ export const $ValidateRuleResponseDto = {
2596
3578
  required: ['valid', 'errors', 'warnings']
2597
3579
  } as const;
2598
3580
 
3581
+ export const $BulkCreateRulesDto = {
3582
+ type: 'object',
3583
+ properties: {
3584
+ rules: {
3585
+ items: {
3586
+ type: 'array'
3587
+ },
3588
+ description: 'Array of rules to import',
3589
+ type: 'array'
3590
+ },
3591
+ conflictStrategy: {
3592
+ type: 'string',
3593
+ enum: ['replace', 'skip'],
3594
+ default: 'skip',
3595
+ description:
3596
+ 'Conflict handling strategy: skip (default) ignores duplicates, replace soft-deletes existing rule'
3597
+ }
3598
+ },
3599
+ required: ['rules', 'conflictStrategy']
3600
+ } as const;
3601
+
3602
+ export const $BulkCreateRulesResponseDto = {
3603
+ type: 'object',
3604
+ properties: {
3605
+ successCount: {
3606
+ type: 'number',
3607
+ description: 'Number of successfully created rules'
3608
+ },
3609
+ failureCount: {
3610
+ type: 'number',
3611
+ description: 'Number of failed rules'
3612
+ },
3613
+ errors: {
3614
+ type: 'array',
3615
+ description: 'Error details for failed rules',
3616
+ items: {
3617
+ type: 'object',
3618
+ properties: {
3619
+ index: {
3620
+ type: 'number'
3621
+ },
3622
+ message: {
3623
+ type: 'string'
3624
+ }
3625
+ }
3626
+ }
3627
+ },
3628
+ createdRuleIds: {
3629
+ description: 'IDs of successfully created rules',
3630
+ type: 'array',
3631
+ items: {
3632
+ type: 'string'
3633
+ }
3634
+ }
3635
+ },
3636
+ required: ['successCount', 'failureCount', 'errors', 'createdRuleIds']
3637
+ } as const;
3638
+
2599
3639
  export const $ExportRulesResponseDto = {
2600
3640
  type: 'object',
2601
3641
  properties: {
@@ -2676,6 +3716,89 @@ export const $RuleStatisticsResponseDto = {
2676
3716
  ]
2677
3717
  } as const;
2678
3718
 
3719
+ export const $UpdateTransactionRuleDto = {
3720
+ type: 'object',
3721
+ properties: {
3722
+ name: {
3723
+ type: 'string',
3724
+ minLength: 1,
3725
+ maxLength: 100
3726
+ },
3727
+ description: {
3728
+ type: 'string',
3729
+ maxLength: 500
3730
+ },
3731
+ narrationKeywords: {
3732
+ items: {
3733
+ type: 'array'
3734
+ },
3735
+ maxItems: 50,
3736
+ type: 'array'
3737
+ },
3738
+ payeeKeywords: {
3739
+ items: {
3740
+ type: 'array'
3741
+ },
3742
+ maxItems: 50,
3743
+ type: 'array'
3744
+ },
3745
+ categoryKeywords: {
3746
+ items: {
3747
+ type: 'array'
3748
+ },
3749
+ maxItems: 50,
3750
+ type: 'array'
3751
+ },
3752
+ methodKeywords: {
3753
+ items: {
3754
+ type: 'array'
3755
+ },
3756
+ maxItems: 50,
3757
+ description: 'Payment method keywords (e.g., HuaBei, YuEBao)',
3758
+ type: 'array'
3759
+ },
3760
+ categoryAccount: {
3761
+ type: 'string',
3762
+ maxLength: 200,
3763
+ description:
3764
+ 'Destination account for expenses/income (e.g., Expenses:Food:Coffee)'
3765
+ },
3766
+ matchLogic: {
3767
+ type: 'string',
3768
+ enum: ['OR', 'AND']
3769
+ },
3770
+ amountMin: {
3771
+ type: 'number',
3772
+ minimum: 0,
3773
+ description: 'Minimum transaction amount (inclusive)'
3774
+ },
3775
+ amountMax: {
3776
+ type: 'number',
3777
+ minimum: 0,
3778
+ description: 'Maximum transaction amount (inclusive)'
3779
+ },
3780
+ priority: {
3781
+ type: 'number',
3782
+ minimum: 0,
3783
+ maximum: 1000
3784
+ },
3785
+ enabled: {
3786
+ type: 'boolean',
3787
+ description: 'Enable or disable the rule'
3788
+ },
3789
+ additionalTags: {
3790
+ items: {
3791
+ type: 'array'
3792
+ },
3793
+ maxItems: 20,
3794
+ type: 'array'
3795
+ },
3796
+ additionalMetadata: {
3797
+ type: 'object'
3798
+ }
3799
+ }
3800
+ } as const;
3801
+
2679
3802
  export const $TestRuleDto = {
2680
3803
  type: 'object',
2681
3804
  properties: {
@@ -2868,6 +3991,17 @@ export const $UpdateUserSettingDto = {
2868
3991
  }
2869
3992
  } as const;
2870
3993
 
3994
+ export const $UpdatePropertyDto = {
3995
+ type: 'object',
3996
+ properties: {
3997
+ value: {
3998
+ type: 'string',
3999
+ description: 'Property value'
4000
+ }
4001
+ },
4002
+ required: ['value']
4003
+ } as const;
4004
+
2871
4005
  export const $FileImportDto = {
2872
4006
  type: 'object',
2873
4007
  properties: {
@@ -3167,7 +4301,8 @@ export const $ImporterConfigDto = {
3167
4301
  'cmbc-credit',
3168
4302
  'icbc',
3169
4303
  'icbc-credit',
3170
- 'hsbc-hk'
4304
+ 'hsbc-hk-credit',
4305
+ 'hsbc-hk-debit'
3171
4306
  ]
3172
4307
  },
3173
4308
  version: {
@@ -3213,6 +4348,181 @@ export const $ImporterConfigDto = {
3213
4348
  ]
3214
4349
  } as const;
3215
4350
 
4351
+ export const $UpdateMapperDefaultsDto = {
4352
+ type: 'object',
4353
+ properties: {
4354
+ sourceAccount: {
4355
+ type: 'string',
4356
+ description: 'Source account for transactions (Beancount format)',
4357
+ example: 'Assets:Alipay:Balance',
4358
+ pattern: '^[A-Z][a-zA-Z0-9-]*:[a-zA-Z0-9-:]+$'
4359
+ },
4360
+ currency: {
4361
+ type: 'string',
4362
+ description: 'Default currency (ISO 4217 code)',
4363
+ example: 'CNY',
4364
+ minLength: 3,
4365
+ maxLength: 3,
4366
+ pattern: '^[A-Z]{3}$'
4367
+ },
4368
+ expenseAccount: {
4369
+ type: 'string',
4370
+ description: 'Default expense account (optional)',
4371
+ example: 'Expenses:Unknown',
4372
+ pattern: '^[A-Z][a-zA-Z0-9-]*:[a-zA-Z0-9-:]+$'
4373
+ },
4374
+ incomeAccount: {
4375
+ type: 'string',
4376
+ description: 'Default income account (optional)',
4377
+ example: 'Income:Unknown',
4378
+ pattern: '^[A-Z][a-zA-Z0-9-]*:[a-zA-Z0-9-:]+$'
4379
+ },
4380
+ methodAccountMapping: {
4381
+ type: 'object',
4382
+ description:
4383
+ '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).',
4384
+ example: {
4385
+ HuaBei: 'Liabilities:Alipay:Huabei',
4386
+ CreditCard: 'Liabilities:CreditCard'
4387
+ }
4388
+ }
4389
+ }
4390
+ } as const;
4391
+
4392
+ export const $UpdateConfigDataDto = {
4393
+ type: 'object',
4394
+ properties: {
4395
+ defaults: {
4396
+ description: 'Mapper defaults configuration',
4397
+ allOf: [
4398
+ {
4399
+ $ref: '#/components/schemas/UpdateMapperDefaultsDto'
4400
+ }
4401
+ ]
4402
+ }
4403
+ }
4404
+ } as const;
4405
+
4406
+ export const $UpdateImporterConfigDto = {
4407
+ type: 'object',
4408
+ properties: {
4409
+ data: {
4410
+ description: 'Configuration data (v1 schema)',
4411
+ allOf: [
4412
+ {
4413
+ $ref: '#/components/schemas/UpdateConfigDataDto'
4414
+ }
4415
+ ]
4416
+ }
4417
+ }
4418
+ } as const;
4419
+
4420
+ export const $CreatePlatformDto = {
4421
+ type: 'object',
4422
+ properties: {
4423
+ name: {
4424
+ type: 'string',
4425
+ description: 'Platform name',
4426
+ example: 'Binance'
4427
+ },
4428
+ canonical: {
4429
+ type: 'string',
4430
+ description: 'Platform canonical identifier (lowercase, kebab-case)',
4431
+ example: 'binance'
4432
+ },
4433
+ aliases: {
4434
+ description: 'Platform aliases (multi-language names for lookup)',
4435
+ example: ['Binance', 'Binance Exchange', 'BNB'],
4436
+ type: 'array',
4437
+ items: {
4438
+ type: 'string'
4439
+ }
4440
+ },
4441
+ url: {
4442
+ type: 'string',
4443
+ description: 'Platform URL',
4444
+ example: 'https://www.binance.com'
4445
+ },
4446
+ type: {
4447
+ type: 'string',
4448
+ description: 'Platform type',
4449
+ enum: [
4450
+ 'BANK',
4451
+ 'BROKERAGE',
4452
+ 'CRYPTO_EXCHANGE',
4453
+ 'PAYMENT',
4454
+ 'INVESTMENT',
4455
+ 'INSURANCE',
4456
+ 'OTHER'
4457
+ ],
4458
+ example: 'CRYPTO_EXCHANGE'
4459
+ },
4460
+ logoUrl: {
4461
+ type: 'string',
4462
+ description: 'Platform logo URL',
4463
+ example: 'https://example.com/logos/binance.png'
4464
+ },
4465
+ isActive: {
4466
+ type: 'boolean',
4467
+ description: 'Whether the platform is active',
4468
+ default: true
4469
+ }
4470
+ },
4471
+ required: ['name', 'canonical', 'aliases', 'url', 'type']
4472
+ } as const;
4473
+
4474
+ export const $UpdatePlatformDto = {
4475
+ type: 'object',
4476
+ properties: {
4477
+ name: {
4478
+ type: 'string',
4479
+ description: 'Platform name',
4480
+ example: 'Binance'
4481
+ },
4482
+ canonical: {
4483
+ type: 'string',
4484
+ description: 'Platform canonical identifier (lowercase, kebab-case)',
4485
+ example: 'binance'
4486
+ },
4487
+ aliases: {
4488
+ description: 'Platform aliases (multi-language names for lookup)',
4489
+ example: ['Binance', 'Binance Exchange', 'BNB'],
4490
+ type: 'array',
4491
+ items: {
4492
+ type: 'string'
4493
+ }
4494
+ },
4495
+ url: {
4496
+ type: 'string',
4497
+ description: 'Platform URL',
4498
+ example: 'https://www.binance.com'
4499
+ },
4500
+ type: {
4501
+ type: 'string',
4502
+ description: 'Platform type',
4503
+ enum: [
4504
+ 'BANK',
4505
+ 'BROKERAGE',
4506
+ 'CRYPTO_EXCHANGE',
4507
+ 'PAYMENT',
4508
+ 'INVESTMENT',
4509
+ 'INSURANCE',
4510
+ 'OTHER'
4511
+ ],
4512
+ example: 'CRYPTO_EXCHANGE'
4513
+ },
4514
+ logoUrl: {
4515
+ type: 'string',
4516
+ description: 'Platform logo URL',
4517
+ example: 'https://example.com/logos/binance.png'
4518
+ },
4519
+ isActive: {
4520
+ type: 'boolean',
4521
+ description: 'Whether the platform is active'
4522
+ }
4523
+ }
4524
+ } as const;
4525
+
3216
4526
  export const $ProviderSyncConfigDto = {
3217
4527
  type: 'object',
3218
4528
  properties: {