@firela/api-types 0.0.0-canary.22c2a1bb → 0.0.0-canary.25256f34

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.
@@ -51,6 +51,14 @@ export const $CreateAccountDto = {
51
51
  description: 'Icon identifier (overrides template)',
52
52
  example: 'bank-custom'
53
53
  },
54
+ displayName: {
55
+ type: 'string',
56
+ description:
57
+ 'User-set display name override (omit/null = keep the derived name)',
58
+ nullable: true,
59
+ maxLength: 50,
60
+ example: 'Salary card'
61
+ },
54
62
  openDirectiveMeta: {
55
63
  type: 'object',
56
64
  description:
@@ -181,7 +189,8 @@ export const $AccountResponseDto = {
181
189
  },
182
190
  displayName: {
183
191
  type: 'string',
184
- description: 'Localized display name (ADR-0114, read-time projection)',
192
+ description:
193
+ 'Display name with precedence: user-set name (#762) > ADR-0114 localized name > path leaf (read-time projection)',
185
194
  example: 'Checking'
186
195
  },
187
196
  icon: {
@@ -197,7 +206,7 @@ export const $AccountResponseDto = {
197
206
  }
198
207
  },
199
208
  platformId: {
200
- type: 'object',
209
+ type: 'string',
201
210
  description: 'Platform ID (null if unbound)',
202
211
  example: 'c98e5d4a-2f71-4a5a-bb3c-92c9f231d5e2'
203
212
  },
@@ -277,6 +286,14 @@ export const $UpdateAccountDto = {
277
286
  description: 'Icon identifier',
278
287
  example: 'bank-custom'
279
288
  },
289
+ displayName: {
290
+ type: 'string',
291
+ description:
292
+ 'User-set display name override (null = clear the override and fall back to the derived name, omit = unchanged)',
293
+ nullable: true,
294
+ maxLength: 50,
295
+ example: 'Salary card'
296
+ },
280
297
  openDirectiveMeta: {
281
298
  type: 'object',
282
299
  description:
@@ -377,16 +394,43 @@ export const $AccountStandardResponseDto = {
377
394
  },
378
395
  name: {
379
396
  type: 'string',
380
- description: 'Short localized display name',
397
+ description:
398
+ 'Short display name. Universal rows project to the request locale (Accept-Language); regional rows keep the authored native name — mixed-language by design (ADR-0131 class P vs class A).',
381
399
  example: 'Housing Fund'
382
400
  },
401
+ aliases: {
402
+ description:
403
+ 'Authored market-language alternative names delivered verbatim (not localized copy, not xlf-managed, not locale-projected). Flat string[] per ADR-0129 D1; ADR-0131 class A.',
404
+ example: ['Alipay', 'WeChat Pay'],
405
+ type: 'array',
406
+ items: {
407
+ type: 'string'
408
+ }
409
+ },
410
+ searchTerms: {
411
+ description:
412
+ 'Locale-projected search synonyms (e.g. the zh bank-card / debit-card everyday terms for the checking account). Pure-locale projection — absent when the locale has no seeded synonyms; English fallback rides the authored aliases field. Search-only vocabulary, not the NLP routing corpus (#698, ADR-0131 fourth-class adjudication).',
413
+ example: ['yinhangka', 'jiejika'],
414
+ type: 'array',
415
+ items: {
416
+ type: 'string'
417
+ }
418
+ },
419
+ currency: {
420
+ type: 'string',
421
+ description:
422
+ 'Product denomination as a 3-letter ISO 4217 code, authored market data delivered verbatim (not localized, not xlf-managed). ADR-0131 class A. Absent = single-currency not asserted — consumers fall back to their own region currency (#714).',
423
+ example: 'HKD'
424
+ },
383
425
  description: {
384
426
  type: 'string',
385
- description: 'Account description (stable semantics only)',
427
+ description:
428
+ 'Account description (stable semantics only). Mixed-language contract: universal rows project to the request locale via the accountDesc xlf axis with an en fallback (ADR-0131 class P, ADR-0132; unseeded locales falling back to English are expected); regional rows deliver the authored market language (ADR-0131 class A, verbatim, never xlf-managed).',
386
429
  example: 'ICBC checking account for daily transactions'
387
430
  },
388
431
  tags: {
389
- description: 'Account tags for categorization',
432
+ description:
433
+ 'Account tags for categorization — structured metadata delivered verbatim (not localized, not xlf-managed). ADR-0131 class A.',
390
434
  example: ['bank', 'checking', 'primary'],
391
435
  type: 'array',
392
436
  items: {
@@ -498,7 +542,10 @@ export const $RegionConfigDto = {
498
542
  },
499
543
  locale: {
500
544
  type: 'string',
501
- example: 'de-DE'
545
+ example: 'de-DE',
546
+ pattern: '^[a-z]{2,8}-[A-Z]{2}$',
547
+ description:
548
+ "Region-qualified BCP-47 tag whose region subtag equals the region's own ISO 3166-1 code (e.g., ja-JP, zh-CN, zh-HK)"
502
549
  }
503
550
  },
504
551
  required: ['currency', 'dateFormat', 'locale']
@@ -511,6 +558,12 @@ export const $RegionInfoDto = {
511
558
  type: 'string',
512
559
  example: 'de'
513
560
  },
561
+ open: {
562
+ type: 'boolean',
563
+ example: true,
564
+ description:
565
+ 'Whether the region is open (has a ready regional account template). Not-yet-open regions still return identity metadata and degrade to the universal-only catalog.'
566
+ },
514
567
  displayName: {
515
568
  type: 'string',
516
569
  example: 'Germany'
@@ -529,7 +582,7 @@ export const $RegionInfoDto = {
529
582
  $ref: '#/components/schemas/RegionConfigDto'
530
583
  }
531
584
  },
532
- required: ['code', 'displayName', 'chain', 'config']
585
+ required: ['code', 'open', 'displayName', 'chain', 'config']
533
586
  } as const;
534
587
 
535
588
  export const $RegionsMetadataResponseDto = {
@@ -776,7 +829,7 @@ export const $PostingResponseDto = {
776
829
  units: {
777
830
  type: 'string',
778
831
  description:
779
- 'Amount as decimal string. Typed optional but always present in responses: interpolation fills any MISSING posting before it is persisted or returned.',
832
+ 'Amount as decimal string. Typed optional but always present in responses: interpolation fills any MISSING posting before it is persisted or returned. Carries the raw Beancount sign (credit-normal accounts such as Income post negative — the accounting truth, ADR-0126); renderers must not infer economic semantics from this sign.',
780
833
  example: '100.50'
781
834
  },
782
835
  currency: {
@@ -1142,7 +1195,7 @@ export const $PostingDetailDto = {
1142
1195
  units: {
1143
1196
  type: 'string',
1144
1197
  description:
1145
- 'Amount as decimal string. Typed optional but always present in responses: interpolation fills any MISSING posting before it is persisted or returned.',
1198
+ 'Amount as decimal string. Typed optional but always present in responses: interpolation fills any MISSING posting before it is persisted or returned. Carries the raw Beancount sign (credit-normal accounts such as Income post negative — the accounting truth, ADR-0126); renderers must not infer economic semantics from this sign.',
1146
1199
  example: '100.50'
1147
1200
  },
1148
1201
  currency: {
@@ -1326,6 +1379,147 @@ export const $TransactionDetailDto = {
1326
1379
  ]
1327
1380
  } as const;
1328
1381
 
1382
+ export const $TransactionListItemDto = {
1383
+ type: 'object',
1384
+ properties: {
1385
+ id: {
1386
+ type: 'string',
1387
+ description: 'Transaction ID',
1388
+ example: 'clh1234567890abcdef'
1389
+ },
1390
+ date: {
1391
+ type: 'string',
1392
+ description: 'Transaction date',
1393
+ example: '2024-11-28'
1394
+ },
1395
+ flag: {
1396
+ type: 'string',
1397
+ description: 'Transaction flag',
1398
+ enum: [
1399
+ 'CLEARED',
1400
+ 'PENDING',
1401
+ 'PADDING',
1402
+ 'SUMMARIZE',
1403
+ 'TRANSFER',
1404
+ 'CONVERSIONS'
1405
+ ],
1406
+ example: 'CLEARED'
1407
+ },
1408
+ customFlag: {
1409
+ type: 'string',
1410
+ description: 'Custom flag (if not using standard flags)',
1411
+ example: 'R'
1412
+ },
1413
+ payee: {
1414
+ type: 'string',
1415
+ description: 'Payee name',
1416
+ example: 'Whole Foods Market'
1417
+ },
1418
+ narration: {
1419
+ type: 'string',
1420
+ description: 'Transaction narration',
1421
+ example: 'Grocery shopping'
1422
+ },
1423
+ tags: {
1424
+ description: 'Transaction tags',
1425
+ example: ['groceries'],
1426
+ type: 'array',
1427
+ items: {
1428
+ type: 'string'
1429
+ }
1430
+ },
1431
+ links: {
1432
+ description: 'Transaction links',
1433
+ example: ['invoice-2024-001'],
1434
+ type: 'array',
1435
+ items: {
1436
+ type: 'string'
1437
+ }
1438
+ },
1439
+ meta: {
1440
+ type: 'object',
1441
+ description: 'Transaction metadata'
1442
+ },
1443
+ status: {
1444
+ type: 'string',
1445
+ description: 'Transaction status',
1446
+ enum: ['ACTIVE', 'VOIDED', 'SUPERSEDED'],
1447
+ example: 'ACTIVE'
1448
+ },
1449
+ sourceType: {
1450
+ type: 'string',
1451
+ description:
1452
+ 'Source type (free-form string from transaction metadata, e.g. import, api)'
1453
+ },
1454
+ sourcePlatform: {
1455
+ type: 'string',
1456
+ description: 'Source platform (e.g., alipay, wechat)',
1457
+ example: 'alipay'
1458
+ },
1459
+ postings: {
1460
+ description: 'Transaction postings',
1461
+ type: 'array',
1462
+ items: {
1463
+ $ref: '#/components/schemas/PostingDetailDto'
1464
+ }
1465
+ },
1466
+ createdAt: {
1467
+ type: 'string',
1468
+ description: 'Created at timestamp',
1469
+ example: '2024-11-28T10:30:00.000Z'
1470
+ },
1471
+ voidedAt: {
1472
+ type: 'string',
1473
+ description: 'Voided at timestamp (if voided)',
1474
+ example: '2024-11-29T15:00:00.000Z'
1475
+ },
1476
+ voidedBy: {
1477
+ type: 'string',
1478
+ description: 'User ID who voided this transaction',
1479
+ example: 'clh1234567890abcdef'
1480
+ },
1481
+ correctionReason: {
1482
+ type: 'string',
1483
+ description: 'Correction reason (if voided or superseded)',
1484
+ example: 'Duplicate entry'
1485
+ },
1486
+ supersededBy: {
1487
+ type: 'string',
1488
+ description:
1489
+ 'ID of the transaction that supersedes this one (set when status=SUPERSEDED)',
1490
+ example: 'clh1234567890abcdef'
1491
+ },
1492
+ originalTxn: {
1493
+ type: 'string',
1494
+ description:
1495
+ 'ID of the transaction this one corrected/replaced (back-link on the replacement)',
1496
+ example: 'clh1234567890abcdef'
1497
+ },
1498
+ viewpointAmount: {
1499
+ type: 'string',
1500
+ description:
1501
+ 'Row amount under the request viewpoint (ADR-0126). Category viewpoint (category + flow): per-leg sign-normalized sum over the category account set (Income-root legs negated, Expenses-root identity) — positive under normal booking but NOT clamped (explicit negative expense legs and net-flip refund months stay negative). No viewpoint (plain list / search, no accountId): wallet money-flow net = raw-sign sum over cost-less Assets/Liabilities legs (income positive, expenses negative, transfers net ~0); color cue is the wallet sign (net < 0 = wealth-decreasing). Status-orthogonal: audit views match too (ADR-0128 amount-as-matching-key). Omitted under the account viewpoint (incl. dual) and for rows with no wallet leg.',
1502
+ example: '10000.00'
1503
+ },
1504
+ viewpointCurrency: {
1505
+ type: 'string',
1506
+ description:
1507
+ 'Currency of viewpointAmount. A row spanning multiple currencies takes the largest-magnitude currency group (known simplification, ADR-0126).',
1508
+ example: 'CNY'
1509
+ }
1510
+ },
1511
+ required: [
1512
+ 'id',
1513
+ 'date',
1514
+ 'narration',
1515
+ 'tags',
1516
+ 'links',
1517
+ 'status',
1518
+ 'postings',
1519
+ 'createdAt'
1520
+ ]
1521
+ } as const;
1522
+
1329
1523
  export const $BalanceByCurrencyDto = {
1330
1524
  type: 'object',
1331
1525
  properties: {
@@ -1371,7 +1565,7 @@ export const $TransactionListSummaryDto = {
1371
1565
  totalAmount: {
1372
1566
  type: 'string',
1373
1567
  description:
1374
- 'Partial converted total in base currency (rated currencies only, raw Beancount sign). When warnings is non-empty this excludes currencies missing an FX rate; may be "0.00" if ALL non-base currencies lack a rate. Converted at the dateTo (or current) available rate.',
1568
+ 'Partial converted total in base currency (rated currencies only). Sign by viewpoint (ADR-0126): account viewpoint keeps the raw Beancount sign (income negative); category viewpoint is per-leg sign-normalized (Income legs negated, Expenses legs identity — positive under normal booking, not clamped). When warnings is non-empty this excludes currencies missing an FX rate; may be "0.00" if ALL non-base currencies lack a rate. Converted at the dateTo (or current) available rate.',
1375
1569
  example: '-6000.00'
1376
1570
  },
1377
1571
  currency: {
@@ -1397,6 +1591,26 @@ export const $TransactionListSummaryDto = {
1397
1591
  required: ['totalAmount', 'currency', 'balanceByCurrency']
1398
1592
  } as const;
1399
1593
 
1594
+ export const $TransactionListViewpointDto = {
1595
+ type: 'object',
1596
+ properties: {
1597
+ type: {
1598
+ type: 'string',
1599
+ description:
1600
+ 'Viewpoint type (only category drill-down carries a viewpoint today)',
1601
+ enum: ['category'],
1602
+ example: 'category'
1603
+ },
1604
+ flow: {
1605
+ type: 'string',
1606
+ description: 'Flow root the category account set is restricted to',
1607
+ enum: ['income', 'expense'],
1608
+ example: 'expense'
1609
+ }
1610
+ },
1611
+ required: ['type', 'flow']
1612
+ } as const;
1613
+
1400
1614
  export const $TransactionListResponseDto = {
1401
1615
  type: 'object',
1402
1616
  properties: {
@@ -1404,7 +1618,7 @@ export const $TransactionListResponseDto = {
1404
1618
  description: 'List of transactions',
1405
1619
  type: 'array',
1406
1620
  items: {
1407
- $ref: '#/components/schemas/TransactionDetailDto'
1621
+ $ref: '#/components/schemas/TransactionListItemDto'
1408
1622
  }
1409
1623
  },
1410
1624
  total: {
@@ -1430,6 +1644,15 @@ export const $TransactionListResponseDto = {
1430
1644
  $ref: '#/components/schemas/TransactionListSummaryDto'
1431
1645
  }
1432
1646
  ]
1647
+ },
1648
+ viewpoint: {
1649
+ description:
1650
+ 'Viewpoint metadata (ADR-0126). Present only for a single category filter (category + flow, no accountId); dual-perspective requests are viewpoint-less (raw signs, no viewpointAmount).',
1651
+ allOf: [
1652
+ {
1653
+ $ref: '#/components/schemas/TransactionListViewpointDto'
1654
+ }
1655
+ ]
1433
1656
  }
1434
1657
  },
1435
1658
  required: ['data', 'total', 'limit', 'offset']
@@ -1781,13 +2004,17 @@ export const $ReviewStatsDto = {
1781
2004
  type: 'object',
1782
2005
  description: 'Count by type'
1783
2006
  },
2007
+ resolved: {
2008
+ type: 'number',
2009
+ description: 'Current count of reviews in RESOLVED status'
2010
+ },
1784
2011
  oldestPending: {
1785
2012
  format: 'date-time',
1786
2013
  type: 'string',
1787
2014
  description: 'Oldest pending review date'
1788
2015
  }
1789
2016
  },
1790
- required: ['total', 'byType']
2017
+ required: ['total', 'byType', 'resolved']
1791
2018
  } as const;
1792
2019
 
1793
2020
  export const $DecisionOptionDto = {
@@ -2340,10 +2567,10 @@ export const $UpdatePayeeDto = {
2340
2567
  meta: {
2341
2568
  type: 'object',
2342
2569
  description:
2343
- 'Metadata for extended information (location, notes, contact info, etc.). Will merge with existing metadata.',
2570
+ 'Metadata for extended information (location, notes, contact info, etc.)',
2344
2571
  example: {
2345
2572
  location: 'Zhongguancun',
2346
- note: 'Updated note',
2573
+ note: 'Near subway station',
2347
2574
  favorite: true
2348
2575
  }
2349
2576
  },
@@ -2904,568 +3131,660 @@ export const $UpdateCommodityDto = {
2904
3131
  }
2905
3132
  } as const;
2906
3133
 
2907
- export const $CreateBeanPriceDto = {
3134
+ export const $CurrencyBalanceDto = {
2908
3135
  type: 'object',
2909
3136
  properties: {
2910
3137
  currency: {
2911
3138
  type: 'string',
2912
- description: 'Currency being priced (e.g., USD, AAPL, BTC)',
2913
- example: 'USD'
2914
- },
2915
- quoteCurrency: {
2916
- type: 'string',
2917
- description: 'Quote currency (pricing currency, e.g., CNY, EUR)',
3139
+ description: 'ISO 4217 currency code',
2918
3140
  example: 'CNY'
2919
3141
  },
2920
- amount: {
2921
- type: 'number',
2922
- description:
2923
- 'Price amount (MUST be >= 0 per Beancount spec, supports up to 15 decimal places). Zero allowed for conversion entries, negative strictly prohibited.',
2924
- example: 175.5,
2925
- minimum: 0
2926
- },
2927
- date: {
3142
+ balance: {
2928
3143
  type: 'string',
2929
- description: 'Price date (ISO 8601 format)',
2930
- example: '2024-11-05'
2931
- },
2932
- metadata: {
2933
- type: 'object',
2934
- description:
2935
- 'Metadata (validated by Zod schema, max field lengths enforced)',
2936
- example: {
2937
- source: 'MANUAL',
2938
- note: 'Bank valuation report',
2939
- confidence: 0.95
2940
- }
3144
+ description: 'Balance amount',
3145
+ example: '500000.00'
2941
3146
  }
2942
3147
  },
2943
- required: ['currency', 'quoteCurrency', 'amount', 'date']
3148
+ required: ['currency', 'balance']
2944
3149
  } as const;
2945
3150
 
2946
- export const $PriceResponseDto = {
3151
+ export const $TimeSeriesPointDto = {
2947
3152
  type: 'object',
2948
3153
  properties: {
2949
- id: {
3154
+ date: {
2950
3155
  type: 'string',
2951
- description: 'Unique identifier',
2952
- example: 'uuid-123-456'
3156
+ description: 'Date in YYYY-MM-DD format',
3157
+ example: '2024-06-15'
2953
3158
  },
2954
- userId: {
3159
+ value: {
2955
3160
  type: 'string',
2956
- description: 'User ID (owner of the price)',
2957
- example: 'user-123'
3161
+ description: 'Value at this date (in base currency)',
3162
+ example: '500000.00'
2958
3163
  },
2959
- currency: {
3164
+ change: {
2960
3165
  type: 'string',
2961
- description: 'Currency being priced (e.g., USD, AAPL, BTC)',
2962
- example: 'BTC'
3166
+ description: 'Change from previous point',
3167
+ example: '5000.00'
2963
3168
  },
2964
- quoteCurrency: {
3169
+ assets: {
2965
3170
  type: 'string',
2966
- description: 'Quote currency (pricing currency, e.g., USD, CNY)',
2967
- example: 'USD'
3171
+ description: 'Total assets at this date (in base currency)',
3172
+ example: '494338.00'
2968
3173
  },
2969
- amount: {
2970
- type: 'number',
2971
- description:
2972
- 'Price amount (corresponds to Beancount Amount.number). Supports up to 15 decimal places.',
2973
- example: 50000
2974
- },
2975
- date: {
3174
+ liabilities: {
2976
3175
  type: 'string',
2977
- description:
2978
- 'Price date (ISO 8601 format). Represents the date this price was valid.',
2979
- example: '2024-01-01',
2980
- format: 'date'
3176
+ description: 'Total liabilities at this date (in base currency)',
3177
+ example: '310098.00'
2981
3178
  },
2982
- meta: {
2983
- type: 'object',
2984
- description:
2985
- 'Metadata (corresponds to Beancount meta field). Contains source, confidence, note, etc.',
2986
- example: {
2987
- source: 'MANUAL',
2988
- note: 'User-defined price',
2989
- confidence: 1
3179
+ byCurrency: {
3180
+ description: 'Multi-currency breakdown for this point',
3181
+ type: 'array',
3182
+ items: {
3183
+ $ref: '#/components/schemas/CurrencyBalanceDto'
2990
3184
  }
3185
+ }
3186
+ },
3187
+ required: ['date', 'value']
3188
+ } as const;
3189
+
3190
+ export const $TrendSummaryDto = {
3191
+ type: 'object',
3192
+ properties: {
3193
+ startValue: {
3194
+ type: 'string',
3195
+ description: 'Value at start of period',
3196
+ example: '450000.00'
2991
3197
  },
2992
- createdAt: {
2993
- format: 'date-time',
3198
+ endValue: {
2994
3199
  type: 'string',
2995
- description: 'Creation timestamp',
2996
- example: '2024-11-03T10:00:00Z'
3200
+ description: 'Value at end of period',
3201
+ example: '500000.00'
2997
3202
  },
2998
- updatedAt: {
2999
- format: 'date-time',
3203
+ totalChange: {
3000
3204
  type: 'string',
3001
- description: 'Last update timestamp',
3002
- example: '2024-11-03T10:00:00Z'
3205
+ description: 'Total change over period',
3206
+ example: '50000.00'
3207
+ },
3208
+ totalChangePercentage: {
3209
+ type: 'string',
3210
+ description: 'Total change percentage',
3211
+ example: '+11.11%'
3003
3212
  }
3004
3213
  },
3005
- required: [
3006
- 'id',
3007
- 'userId',
3008
- 'currency',
3009
- 'quoteCurrency',
3010
- 'amount',
3011
- 'date',
3012
- 'meta',
3013
- 'createdAt',
3014
- 'updatedAt'
3015
- ]
3214
+ required: ['startValue', 'endValue', 'totalChange', 'totalChangePercentage']
3016
3215
  } as const;
3017
3216
 
3018
- export const $PriceListResponseDto = {
3217
+ export const $MultiCurrencyPointDto = {
3019
3218
  type: 'object',
3020
3219
  properties: {
3021
- items: {
3022
- description: 'List of prices',
3220
+ date: {
3221
+ type: 'string',
3222
+ description: 'Date in YYYY-MM-DD format',
3223
+ example: '2024-06-15'
3224
+ },
3225
+ byCurrency: {
3226
+ description: 'Balances by currency',
3023
3227
  type: 'array',
3024
3228
  items: {
3025
- $ref: '#/components/schemas/PriceResponseDto'
3229
+ $ref: '#/components/schemas/CurrencyBalanceDto'
3026
3230
  }
3027
- },
3028
- total: {
3029
- type: 'number',
3030
- description: 'Total number of prices',
3031
- example: 42
3032
3231
  }
3033
3232
  },
3034
- required: ['items', 'total']
3233
+ required: ['date', 'byCurrency']
3035
3234
  } as const;
3036
3235
 
3037
- export const $UpdateBeanPriceDto = {
3236
+ export const $PortfolioTrendsResponseDto = {
3038
3237
  type: 'object',
3039
3238
  properties: {
3040
- currency: {
3041
- type: 'string',
3042
- description: 'Currency being priced'
3239
+ series: {
3240
+ description: 'Time series data points',
3241
+ type: 'array',
3242
+ items: {
3243
+ $ref: '#/components/schemas/TimeSeriesPointDto'
3244
+ }
3043
3245
  },
3044
- quoteCurrency: {
3246
+ summary: {
3247
+ description: 'Period summary',
3248
+ allOf: [
3249
+ {
3250
+ $ref: '#/components/schemas/TrendSummaryDto'
3251
+ }
3252
+ ]
3253
+ },
3254
+ period: {
3045
3255
  type: 'string',
3046
- description: 'Quote currency (pricing currency)'
3256
+ description: 'Period requested',
3257
+ example: '6m'
3047
3258
  },
3048
- amount: {
3049
- type: 'number',
3050
- description: 'Price amount (MUST be >= 0 per Beancount spec)',
3051
- minimum: 0
3259
+ granularity: {
3260
+ type: 'string',
3261
+ description: 'Data granularity',
3262
+ example: 'month'
3052
3263
  },
3053
- date: {
3264
+ currency: {
3054
3265
  type: 'string',
3055
- description: 'Price date (ISO 8601 format)'
3266
+ description: 'Base currency for converted values',
3267
+ example: 'CNY'
3056
3268
  },
3057
- metadata: {
3058
- type: 'object',
3059
- description: 'Metadata'
3269
+ byCurrency: {
3270
+ description:
3271
+ 'Multi-currency time series (each point has currency breakdown)',
3272
+ type: 'array',
3273
+ items: {
3274
+ $ref: '#/components/schemas/MultiCurrencyPointDto'
3275
+ }
3276
+ },
3277
+ warnings: {
3278
+ description: 'Exchange rate warnings',
3279
+ type: 'array',
3280
+ items: {
3281
+ $ref: '#/components/schemas/ExchangeRateWarningDto'
3282
+ }
3060
3283
  }
3061
- }
3284
+ },
3285
+ required: ['series', 'summary', 'period', 'granularity', 'currency']
3062
3286
  } as const;
3063
3287
 
3064
- export const $CreateRecurringRuleDto = {
3288
+ export const $CashFlowPointDto = {
3065
3289
  type: 'object',
3066
3290
  properties: {
3067
- name: {
3068
- type: 'string',
3069
- description: 'Rule name (unique per user)',
3070
- maxLength: 100
3071
- },
3072
- icon: {
3073
- type: 'string',
3074
- description: 'Icon emoji',
3075
- maxLength: 10
3076
- },
3077
- frequency: {
3291
+ month: {
3078
3292
  type: 'string',
3079
- description: 'Recurring frequency',
3080
- enum: [
3081
- 'WEEKLY',
3082
- 'BIWEEKLY',
3083
- 'MONTHLY',
3084
- 'BIMONTHLY',
3085
- 'QUARTERLY',
3086
- 'YEARLY',
3087
- 'CUSTOM'
3088
- ]
3089
- },
3090
- expectedAmount: {
3091
- type: 'number',
3092
- description: 'Expected amount (positive number)',
3093
- minimum: 0
3094
- },
3095
- expectedDay: {
3096
- type: 'number',
3097
- description: 'Expected day of month (1-31)',
3098
- minimum: 1,
3099
- maximum: 31
3100
- },
3101
- customIntervalDays: {
3102
- type: 'number',
3103
- description: 'Custom interval in days (required for CUSTOM frequency)',
3104
- minimum: 1
3293
+ description: 'Month key (YYYY-MM)',
3294
+ example: '2024-03'
3105
3295
  },
3106
- currency: {
3296
+ income: {
3107
3297
  type: 'string',
3108
- description: 'Currency code',
3109
- default: 'CNY',
3110
- maxLength: 10
3298
+ description: 'Income in base currency (absolute, converted)',
3299
+ example: '10000.00'
3111
3300
  },
3112
- matchPayeePattern: {
3301
+ expense: {
3113
3302
  type: 'string',
3114
- description: 'Payee matching pattern (supports wildcards)',
3115
- maxLength: 200
3116
- },
3117
- matchAmountTolerance: {
3118
- type: 'number',
3119
- description: 'Amount tolerance percentage (0-1)',
3120
- default: 0.075,
3121
- minimum: 0,
3122
- maximum: 1
3303
+ description: 'Expense in base currency (absolute, converted)',
3304
+ example: '5000.00'
3123
3305
  },
3124
- defaultExpenseAccount: {
3306
+ netSavings: {
3125
3307
  type: 'string',
3126
- description: 'Default expense account for auto-create',
3127
- maxLength: 200
3128
- },
3129
- defaultPaymentAccount: {
3308
+ description: 'netSavings = income − expense (savings positive)',
3309
+ example: '5000.00'
3310
+ }
3311
+ },
3312
+ required: ['month', 'income', 'expense', 'netSavings']
3313
+ } as const;
3314
+
3315
+ export const $CashFlowTrendSummaryDto = {
3316
+ type: 'object',
3317
+ properties: {
3318
+ totalIncome: {
3130
3319
  type: 'string',
3131
- description: 'Default payment account for auto-create',
3132
- maxLength: 200
3320
+ description: 'Total income across the period',
3321
+ example: '60000.00'
3133
3322
  },
3134
- defaultPayee: {
3323
+ totalExpense: {
3135
3324
  type: 'string',
3136
- description: 'Default payee for auto-create',
3137
- maxLength: 200
3138
- },
3139
- autoCreate: {
3140
- type: 'boolean',
3141
- description: 'Auto-create transaction when expected date arrives',
3142
- default: false
3325
+ description: 'Total expense across the period',
3326
+ example: '30000.00'
3143
3327
  },
3144
- startDate: {
3328
+ totalNetSavings: {
3145
3329
  type: 'string',
3146
- description: 'Rule start date (ISO format)'
3330
+ description: 'income − expense across the period',
3331
+ example: '30000.00'
3147
3332
  },
3148
- endDate: {
3333
+ averageMonthlyNetSavings: {
3149
3334
  type: 'string',
3150
- description: 'Rule end date (ISO format)'
3335
+ description:
3336
+ 'totalNetSavings divided by the window length (N months, incl. zero-filled)',
3337
+ example: '5000.00'
3151
3338
  }
3152
3339
  },
3153
3340
  required: [
3154
- 'name',
3155
- 'frequency',
3156
- 'expectedAmount',
3157
- 'currency',
3158
- 'matchAmountTolerance',
3159
- 'autoCreate'
3341
+ 'totalIncome',
3342
+ 'totalExpense',
3343
+ 'totalNetSavings',
3344
+ 'averageMonthlyNetSavings'
3160
3345
  ]
3161
3346
  } as const;
3162
3347
 
3163
- export const $RecurringRuleResponseDto = {
3348
+ export const $CashFlowTrendsResponseDto = {
3164
3349
  type: 'object',
3165
3350
  properties: {
3166
- id: {
3167
- type: 'string',
3168
- description: 'Rule ID'
3351
+ series: {
3352
+ description:
3353
+ 'Monthly cash-flow series (fixed N-month window, zero-filled)',
3354
+ type: 'array',
3355
+ items: {
3356
+ $ref: '#/components/schemas/CashFlowPointDto'
3357
+ }
3169
3358
  },
3170
- userId: {
3171
- type: 'string',
3172
- description: 'User ID'
3359
+ summary: {
3360
+ description: 'Period totals',
3361
+ allOf: [
3362
+ {
3363
+ $ref: '#/components/schemas/CashFlowTrendSummaryDto'
3364
+ }
3365
+ ]
3173
3366
  },
3174
- name: {
3367
+ period: {
3175
3368
  type: 'string',
3176
- description: 'Rule name'
3177
- },
3178
- icon: {
3179
- type: 'object',
3180
- description: 'Icon emoji'
3369
+ description: 'Period requested',
3370
+ example: '6m'
3181
3371
  },
3182
- frequency: {
3372
+ granularity: {
3183
3373
  type: 'string',
3184
- description: 'Recurring frequency'
3185
- },
3186
- expectedAmount: {
3187
- type: 'number',
3188
- description: 'Expected amount'
3189
- },
3190
- expectedDay: {
3191
- type: 'object',
3192
- description: 'Expected day of month'
3374
+ description: 'Data granularity (v1 returns month buckets)',
3375
+ example: 'month'
3193
3376
  },
3194
- customIntervalDays: {
3195
- type: 'object',
3196
- description: 'Custom interval in days'
3377
+ currency: {
3378
+ type: 'string',
3379
+ description: 'Base currency for converted values',
3380
+ example: 'CNY'
3197
3381
  },
3382
+ warnings: {
3383
+ description: 'Exchange rate warnings (e.g. missing rate for a currency)',
3384
+ type: 'array',
3385
+ items: {
3386
+ $ref: '#/components/schemas/ExchangeRateWarningDto'
3387
+ }
3388
+ }
3389
+ },
3390
+ required: ['series', 'summary', 'period', 'granularity', 'currency']
3391
+ } as const;
3392
+
3393
+ export const $GenerateSnapshotBody = {
3394
+ type: 'object',
3395
+ properties: {}
3396
+ } as const;
3397
+
3398
+ export const $GenerateSnapshotResponse = {
3399
+ type: 'object',
3400
+ properties: {}
3401
+ } as const;
3402
+
3403
+ export const $BackfillSnapshotsBody = {
3404
+ type: 'object',
3405
+ properties: {}
3406
+ } as const;
3407
+
3408
+ export const $BackfillSnapshotsResponse = {
3409
+ type: 'object',
3410
+ properties: {}
3411
+ } as const;
3412
+
3413
+ export const $CreateBeanPriceDto = {
3414
+ type: 'object',
3415
+ properties: {
3198
3416
  currency: {
3199
3417
  type: 'string',
3200
- description: 'Currency code'
3418
+ description: 'Currency being priced (e.g., USD, AAPL, BTC)',
3419
+ example: 'USD'
3201
3420
  },
3202
- matchPayeePattern: {
3203
- type: 'object',
3204
- description: 'Payee matching pattern'
3421
+ quoteCurrency: {
3422
+ type: 'string',
3423
+ description: 'Quote currency (pricing currency, e.g., CNY, EUR)',
3424
+ example: 'CNY'
3205
3425
  },
3206
- matchAmountTolerance: {
3426
+ amount: {
3207
3427
  type: 'number',
3208
- description: 'Amount tolerance percentage'
3209
- },
3210
- defaultExpenseAccount: {
3211
- type: 'object',
3212
- description: 'Default expense account'
3428
+ description:
3429
+ 'Price amount (MUST be >= 0 per Beancount spec, supports up to 15 decimal places). Zero allowed for conversion entries, negative strictly prohibited.',
3430
+ example: 175.5,
3431
+ minimum: 0
3213
3432
  },
3214
- defaultPaymentAccount: {
3215
- type: 'object',
3216
- description: 'Default payment account'
3433
+ date: {
3434
+ type: 'string',
3435
+ description: 'Price date (ISO 8601 format)',
3436
+ example: '2024-11-05'
3217
3437
  },
3218
- defaultPayee: {
3438
+ metadata: {
3219
3439
  type: 'object',
3220
- description: 'Default payee'
3440
+ description:
3441
+ 'Metadata (validated by Zod schema, max field lengths enforced)',
3442
+ example: {
3443
+ source: 'MANUAL',
3444
+ note: 'Bank valuation report',
3445
+ confidence: 0.95
3446
+ }
3447
+ }
3448
+ },
3449
+ required: ['currency', 'quoteCurrency', 'amount', 'date']
3450
+ } as const;
3451
+
3452
+ export const $PriceResponseDto = {
3453
+ type: 'object',
3454
+ properties: {
3455
+ id: {
3456
+ type: 'string',
3457
+ description: 'Unique identifier',
3458
+ example: 'uuid-123-456'
3221
3459
  },
3222
- isActive: {
3223
- type: 'boolean',
3224
- description: 'Whether rule is active'
3460
+ userId: {
3461
+ type: 'string',
3462
+ description: 'User ID (owner of the price)',
3463
+ example: 'user-123'
3225
3464
  },
3226
- startDate: {
3465
+ currency: {
3227
3466
  type: 'string',
3228
- description: 'Rule start date (YYYY-MM-DD)'
3467
+ description: 'Currency being priced (e.g., USD, AAPL, BTC)',
3468
+ example: 'BTC'
3229
3469
  },
3230
- endDate: {
3231
- type: 'object',
3232
- description: 'Rule end date (YYYY-MM-DD)'
3470
+ quoteCurrency: {
3471
+ type: 'string',
3472
+ description: 'Quote currency (pricing currency, e.g., USD, CNY)',
3473
+ example: 'USD'
3233
3474
  },
3234
- autoCreate: {
3235
- type: 'boolean',
3236
- description: 'Auto-create transaction on expected date'
3475
+ amount: {
3476
+ type: 'number',
3477
+ description:
3478
+ 'Price amount (corresponds to Beancount Amount.number). Supports up to 15 decimal places.',
3479
+ example: 50000
3237
3480
  },
3238
- lastOccurrence: {
3239
- type: 'object',
3240
- description: 'Last matched occurrence date (YYYY-MM-DD)'
3481
+ date: {
3482
+ type: 'string',
3483
+ description:
3484
+ 'Price date (ISO 8601 format). Represents the date this price was valid.',
3485
+ example: '2024-01-01',
3486
+ format: 'date'
3241
3487
  },
3242
- totalCount: {
3243
- type: 'number',
3244
- description: 'Total matched transactions count'
3488
+ meta: {
3489
+ type: 'object',
3490
+ description:
3491
+ 'Metadata (corresponds to Beancount meta field). Contains source, confidence, note, etc.',
3492
+ example: {
3493
+ source: 'MANUAL',
3494
+ note: 'User-defined price',
3495
+ confidence: 1
3496
+ }
3245
3497
  },
3246
3498
  createdAt: {
3247
3499
  format: 'date-time',
3248
3500
  type: 'string',
3249
- description: 'Created at timestamp'
3501
+ description: 'Creation timestamp',
3502
+ example: '2024-11-03T10:00:00Z'
3250
3503
  },
3251
3504
  updatedAt: {
3252
3505
  format: 'date-time',
3253
3506
  type: 'string',
3254
- description: 'Updated at timestamp'
3507
+ description: 'Last update timestamp',
3508
+ example: '2024-11-03T10:00:00Z'
3255
3509
  }
3256
3510
  },
3257
3511
  required: [
3258
3512
  'id',
3259
3513
  'userId',
3260
- 'name',
3261
- 'frequency',
3262
- 'expectedAmount',
3263
3514
  'currency',
3264
- 'matchAmountTolerance',
3265
- 'isActive',
3266
- 'startDate',
3267
- 'autoCreate',
3268
- 'totalCount',
3515
+ 'quoteCurrency',
3516
+ 'amount',
3517
+ 'date',
3518
+ 'meta',
3269
3519
  'createdAt',
3270
3520
  'updatedAt'
3271
3521
  ]
3272
3522
  } as const;
3273
3523
 
3274
- export const $CreateRuleFromTransactionDto = {
3524
+ export const $PriceListResponseDto = {
3275
3525
  type: 'object',
3276
3526
  properties: {
3277
- frequency: {
3527
+ items: {
3528
+ description: 'List of prices',
3529
+ type: 'array',
3530
+ items: {
3531
+ $ref: '#/components/schemas/PriceResponseDto'
3532
+ }
3533
+ },
3534
+ total: {
3535
+ type: 'number',
3536
+ description: 'Total number of prices',
3537
+ example: 42
3538
+ }
3539
+ },
3540
+ required: ['items', 'total']
3541
+ } as const;
3542
+
3543
+ export const $UpdateBeanPriceDto = {
3544
+ type: 'object',
3545
+ properties: {
3546
+ currency: {
3278
3547
  type: 'string',
3279
- description: 'Recurring frequency',
3280
- enum: [
3281
- 'WEEKLY',
3282
- 'BIWEEKLY',
3283
- 'MONTHLY',
3284
- 'BIMONTHLY',
3285
- 'QUARTERLY',
3286
- 'YEARLY',
3287
- 'CUSTOM'
3288
- ],
3289
- example: 'MONTHLY'
3548
+ description: 'Currency being priced'
3290
3549
  },
3291
- name: {
3550
+ quoteCurrency: {
3292
3551
  type: 'string',
3293
- description: 'Optional name override (default: transaction payee)',
3294
- maxLength: 100
3552
+ description: 'Quote currency (pricing currency)'
3295
3553
  },
3296
- icon: {
3554
+ amount: {
3555
+ type: 'number',
3556
+ description: 'Price amount (MUST be >= 0 per Beancount spec)',
3557
+ minimum: 0
3558
+ },
3559
+ date: {
3297
3560
  type: 'string',
3298
- description: 'Optional icon emoji',
3299
- maxLength: 10
3561
+ description: 'Price date (ISO 8601 format)'
3562
+ },
3563
+ metadata: {
3564
+ type: 'object',
3565
+ description: 'Metadata'
3566
+ }
3567
+ }
3568
+ } as const;
3569
+
3570
+ export const $DeleteOwnUserDto = {
3571
+ type: 'object',
3572
+ properties: {
3573
+ accessToken: {
3574
+ type: 'string',
3575
+ description: 'Access token for user verification',
3576
+ example: 'abc123xyz'
3300
3577
  }
3301
3578
  },
3302
- required: ['frequency']
3579
+ required: ['accessToken']
3303
3580
  } as const;
3304
3581
 
3305
- export const $RecurringRuleWithStatsResponseDto = {
3582
+ export const $UserSettingsResponseDto = {
3306
3583
  type: 'object',
3307
3584
  properties: {
3308
- id: {
3585
+ baseCurrency: {
3309
3586
  type: 'string',
3310
- description: 'Rule ID'
3311
- },
3312
- userId: {
3587
+ description:
3588
+ 'Stored base currency choice (ISO 4217) for net-worth/report aggregation. null = user never chose; aggregates fall back to the region default at display time (#713).',
3589
+ example: 'USD',
3590
+ nullable: true
3591
+ }
3592
+ },
3593
+ required: ['baseCurrency']
3594
+ } as const;
3595
+
3596
+ export const $UserResponseDto = {
3597
+ type: 'object',
3598
+ properties: {
3599
+ id: {
3313
3600
  type: 'string',
3314
3601
  description: 'User ID'
3315
3602
  },
3316
- name: {
3603
+ role: {
3317
3604
  type: 'string',
3318
- description: 'Rule name'
3605
+ description: 'Assigned user role'
3319
3606
  },
3320
- icon: {
3321
- type: 'object',
3322
- description: 'Icon emoji'
3607
+ permissions: {
3608
+ description: 'Permission strings',
3609
+ type: 'array',
3610
+ items: {
3611
+ type: 'string'
3612
+ }
3323
3613
  },
3324
- frequency: {
3614
+ settings: {
3615
+ description: 'User settings',
3616
+ allOf: [
3617
+ {
3618
+ $ref: '#/components/schemas/UserSettingsResponseDto'
3619
+ }
3620
+ ]
3621
+ }
3622
+ },
3623
+ required: ['id', 'role', 'permissions', 'settings']
3624
+ } as const;
3625
+
3626
+ export const $SignupDto = {
3627
+ type: 'object',
3628
+ properties: {
3629
+ turnstileToken: {
3325
3630
  type: 'string',
3326
- description: 'Recurring frequency'
3327
- },
3328
- expectedAmount: {
3329
- type: 'number',
3330
- description: 'Expected amount'
3331
- },
3332
- expectedDay: {
3333
- type: 'object',
3334
- description: 'Expected day of month'
3335
- },
3336
- customIntervalDays: {
3337
- type: 'object',
3338
- description: 'Custom interval in days'
3339
- },
3340
- currency: {
3631
+ description:
3632
+ 'Cloudflare Turnstile verification token (optional when Turnstile disabled)',
3633
+ example: '0.abc123def456...'
3634
+ }
3635
+ }
3636
+ } as const;
3637
+
3638
+ export const $SignupResponseDto = {
3639
+ type: 'object',
3640
+ properties: {
3641
+ authToken: {
3341
3642
  type: 'string',
3342
- description: 'Currency code'
3643
+ description: 'JWT auth token',
3644
+ example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
3343
3645
  },
3344
- matchPayeePattern: {
3345
- type: 'object',
3346
- description: 'Payee matching pattern'
3646
+ accessToken: {
3647
+ type: 'string',
3648
+ description: 'Auto-generated access token'
3347
3649
  },
3348
- matchAmountTolerance: {
3650
+ role: {
3651
+ type: 'string',
3652
+ description: 'Assigned user role',
3653
+ enum: ['USER', 'ADMIN', 'DEMO', 'INACTIVE', 'PAID', 'OPS']
3654
+ }
3655
+ },
3656
+ required: ['authToken', 'accessToken', 'role']
3657
+ } as const;
3658
+
3659
+ export const $UpdateUserSettingDto = {
3660
+ type: 'object',
3661
+ properties: {
3662
+ secId: {
3349
3663
  type: 'number',
3350
- description: 'Amount tolerance percentage'
3351
- },
3352
- defaultExpenseAccount: {
3353
- type: 'object',
3354
- description: 'Default expense account'
3355
- },
3356
- defaultPaymentAccount: {
3357
- type: 'object',
3358
- description: 'Default payment account'
3664
+ description: 'Security ID'
3359
3665
  },
3360
- defaultPayee: {
3361
- type: 'object',
3362
- description: 'Default payee'
3666
+ annualInterestRate: {
3667
+ type: 'number',
3668
+ description: 'Annual interest rate',
3669
+ example: 0.05
3363
3670
  },
3364
- isActive: {
3365
- type: 'boolean',
3366
- description: 'Whether rule is active'
3671
+ currency: {
3672
+ type: 'string',
3673
+ description: 'Currency code',
3674
+ example: 'USD'
3367
3675
  },
3368
- startDate: {
3676
+ baseCurrency: {
3369
3677
  type: 'string',
3370
- description: 'Rule start date (YYYY-MM-DD)'
3678
+ description: 'Base currency code',
3679
+ example: 'USD'
3371
3680
  },
3372
- endDate: {
3373
- type: 'object',
3374
- description: 'Rule end date (YYYY-MM-DD)'
3681
+ benchmark: {
3682
+ type: 'string',
3683
+ description: 'Benchmark symbol',
3684
+ example: 'SPY'
3375
3685
  },
3376
- autoCreate: {
3377
- type: 'boolean',
3378
- description: 'Auto-create transaction on expected date'
3686
+ colorScheme: {
3687
+ type: 'string',
3688
+ description: 'Color scheme',
3689
+ enum: ['DARK', 'LIGHT']
3379
3690
  },
3380
- lastOccurrence: {
3381
- type: 'object',
3382
- description: 'Last matched occurrence date (YYYY-MM-DD)'
3691
+ dateRange: {
3692
+ type: 'string',
3693
+ description: 'Date range filter',
3694
+ example: '1y'
3383
3695
  },
3384
- totalCount: {
3696
+ emergencyFund: {
3385
3697
  type: 'number',
3386
- description: 'Total matched transactions count'
3698
+ description: 'Emergency fund amount',
3699
+ example: 10000
3387
3700
  },
3388
- createdAt: {
3389
- format: 'date-time',
3701
+ 'filters.accounts': {
3702
+ description: 'Account filter IDs',
3703
+ type: 'array',
3704
+ items: {
3705
+ type: 'string'
3706
+ }
3707
+ },
3708
+ 'filters.assetClasses': {
3709
+ description: 'Asset class filters',
3710
+ type: 'array',
3711
+ items: {
3712
+ type: 'string'
3713
+ }
3714
+ },
3715
+ 'filters.dataSource': {
3390
3716
  type: 'string',
3391
- description: 'Created at timestamp'
3717
+ description: 'Data source filter'
3392
3718
  },
3393
- updatedAt: {
3394
- format: 'date-time',
3719
+ 'filters.symbol': {
3395
3720
  type: 'string',
3396
- description: 'Updated at timestamp'
3721
+ description: 'Symbol filter'
3397
3722
  },
3398
- pendingCount: {
3399
- type: 'number',
3400
- description: 'Number of pending expected transactions'
3723
+ 'filters.tags': {
3724
+ description: 'Tag filters',
3725
+ type: 'array',
3726
+ items: {
3727
+ type: 'string'
3728
+ }
3401
3729
  },
3402
- overdueCount: {
3403
- type: 'number',
3404
- description: 'Number of overdue expected transactions'
3730
+ isExperimentalFeatures: {
3731
+ type: 'boolean',
3732
+ description: 'Enable experimental features'
3405
3733
  },
3406
- nextExpectedDate: {
3407
- type: 'object',
3408
- description: 'Next expected date (YYYY-MM-DD)'
3734
+ isRestrictedView: {
3735
+ type: 'boolean',
3736
+ description: 'Enable restricted view mode'
3409
3737
  },
3410
- totalAmount: {
3411
- type: 'number',
3412
- description: 'Total amount of all matched transactions'
3738
+ language: {
3739
+ type: 'string',
3740
+ description: 'Language code',
3741
+ example: 'en'
3413
3742
  },
3414
- averageAmount: {
3415
- type: 'number',
3416
- description: 'Average amount per transaction'
3743
+ locale: {
3744
+ type: 'string',
3745
+ description: 'Locale code',
3746
+ example: 'en-US'
3417
3747
  },
3418
- transactionCount: {
3748
+ projectedTotalAmount: {
3419
3749
  type: 'number',
3420
- description: 'Number of matched transactions'
3421
- },
3422
- firstDate: {
3423
- type: 'object',
3424
- description: 'First matched transaction date (YYYY-MM-DD)'
3750
+ description: 'Projected total amount',
3751
+ example: 1000000
3425
3752
  },
3426
- lastDate: {
3427
- type: 'object',
3428
- description: 'Last matched transaction date (YYYY-MM-DD)'
3753
+ retirementDate: {
3754
+ type: 'string',
3755
+ description: 'Retirement date in ISO 8601 format',
3756
+ example: '2050-01-01'
3429
3757
  },
3430
- variance: {
3758
+ savingsRate: {
3431
3759
  type: 'number',
3432
- description: 'Amount variance (standard deviation squared)'
3760
+ description: 'Savings rate percentage',
3761
+ example: 0.2
3433
3762
  },
3434
- upcomingCount: {
3435
- type: 'number',
3436
- description: 'Number of upcoming expected transactions'
3763
+ viewMode: {
3764
+ type: 'string',
3765
+ description: 'View mode',
3766
+ enum: ['DEFAULT', 'ZEN']
3767
+ }
3768
+ }
3769
+ } as const;
3770
+
3771
+ export const $UpdatePropertyDto = {
3772
+ type: 'object',
3773
+ properties: {
3774
+ value: {
3775
+ type: 'string',
3776
+ description: 'Property value'
3437
3777
  }
3438
3778
  },
3439
- required: [
3440
- 'id',
3441
- 'userId',
3442
- 'name',
3443
- 'frequency',
3444
- 'expectedAmount',
3445
- 'currency',
3446
- 'matchAmountTolerance',
3447
- 'isActive',
3448
- 'startDate',
3449
- 'autoCreate',
3450
- 'totalCount',
3451
- 'createdAt',
3452
- 'updatedAt',
3453
- 'pendingCount',
3454
- 'overdueCount',
3455
- 'totalAmount',
3456
- 'averageAmount',
3457
- 'transactionCount',
3458
- 'variance',
3459
- 'upcomingCount'
3460
- ]
3779
+ required: ['value']
3461
3780
  } as const;
3462
3781
 
3463
- export const $UpdateRecurringRuleDto = {
3782
+ export const $CreateRecurringRuleDto = {
3464
3783
  type: 'object',
3465
3784
  properties: {
3466
3785
  name: {
3467
3786
  type: 'string',
3468
- description: 'Rule name',
3787
+ description: 'Rule name (unique per user)',
3469
3788
  maxLength: 100
3470
3789
  },
3471
3790
  icon: {
@@ -3488,7 +3807,7 @@ export const $UpdateRecurringRuleDto = {
3488
3807
  },
3489
3808
  expectedAmount: {
3490
3809
  type: 'number',
3491
- description: 'Expected amount',
3810
+ description: 'Expected amount (positive number)',
3492
3811
  minimum: 0
3493
3812
  },
3494
3813
  expectedDay: {
@@ -3499,7 +3818,7 @@ export const $UpdateRecurringRuleDto = {
3499
3818
  },
3500
3819
  customIntervalDays: {
3501
3820
  type: 'number',
3502
- description: 'Custom interval in days',
3821
+ description: 'Custom interval in days (required for CUSTOM frequency)',
3503
3822
  minimum: 1
3504
3823
  },
3505
3824
  currency: {
@@ -3509,118 +3828,136 @@ export const $UpdateRecurringRuleDto = {
3509
3828
  },
3510
3829
  matchPayeePattern: {
3511
3830
  type: 'string',
3512
- description: 'Payee matching pattern',
3831
+ description: 'Payee matching pattern (supports wildcards)',
3513
3832
  maxLength: 200
3514
3833
  },
3515
3834
  matchAmountTolerance: {
3516
3835
  type: 'number',
3517
3836
  description: 'Amount tolerance percentage (0-1)',
3837
+ default: 0.075,
3518
3838
  minimum: 0,
3519
3839
  maximum: 1
3520
3840
  },
3521
3841
  defaultExpenseAccount: {
3522
3842
  type: 'string',
3523
- description: 'Default expense account',
3843
+ description: 'Default expense account for auto-create',
3524
3844
  maxLength: 200
3525
3845
  },
3526
3846
  defaultPaymentAccount: {
3527
3847
  type: 'string',
3528
- description: 'Default payment account',
3848
+ description: 'Default payment account for auto-create',
3529
3849
  maxLength: 200
3530
3850
  },
3531
3851
  defaultPayee: {
3532
3852
  type: 'string',
3533
- description: 'Default payee',
3853
+ description: 'Default payee for auto-create',
3534
3854
  maxLength: 200
3535
3855
  },
3536
3856
  autoCreate: {
3537
3857
  type: 'boolean',
3538
- description: 'Auto-create transaction'
3858
+ description: 'Auto-create transaction when expected date arrives',
3859
+ default: false
3539
3860
  },
3540
- isActive: {
3541
- type: 'boolean',
3542
- description: 'Rule active status'
3861
+ startDate: {
3862
+ type: 'string',
3863
+ description: 'Rule start date (ISO format)'
3543
3864
  },
3544
3865
  endDate: {
3545
3866
  type: 'string',
3546
3867
  description: 'Rule end date (ISO format)'
3547
3868
  }
3548
- }
3869
+ },
3870
+ required: [
3871
+ 'name',
3872
+ 'frequency',
3873
+ 'expectedAmount',
3874
+ 'matchAmountTolerance',
3875
+ 'autoCreate'
3876
+ ]
3549
3877
  } as const;
3550
3878
 
3551
- export const $ExpectedTransactionRuleDto = {
3879
+ export const $RecurringRuleResponseDto = {
3552
3880
  type: 'object',
3553
3881
  properties: {
3882
+ id: {
3883
+ type: 'string',
3884
+ description: 'Rule ID'
3885
+ },
3886
+ userId: {
3887
+ type: 'string',
3888
+ description: 'User ID'
3889
+ },
3554
3890
  name: {
3555
3891
  type: 'string',
3556
3892
  description: 'Rule name'
3557
3893
  },
3558
3894
  icon: {
3559
- type: 'object',
3560
- description: 'Rule icon'
3895
+ type: 'string',
3896
+ description: 'Icon emoji'
3561
3897
  },
3562
3898
  frequency: {
3563
3899
  type: 'string',
3564
- description: 'Rule frequency'
3900
+ description: 'Recurring frequency'
3901
+ },
3902
+ expectedAmount: {
3903
+ type: 'number',
3904
+ description: 'Expected amount'
3905
+ },
3906
+ expectedDay: {
3907
+ type: 'number',
3908
+ description: 'Expected day of month'
3909
+ },
3910
+ customIntervalDays: {
3911
+ type: 'number',
3912
+ description: 'Custom interval in days'
3565
3913
  },
3566
3914
  currency: {
3567
3915
  type: 'string',
3568
3916
  description: 'Currency code'
3569
- }
3570
- },
3571
- required: ['name', 'frequency', 'currency']
3572
- } as const;
3573
-
3574
- export const $ExpectedTransactionResponseDto = {
3575
- type: 'object',
3576
- properties: {
3577
- id: {
3578
- type: 'string',
3579
- description: 'Expected transaction ID'
3580
3917
  },
3581
- userId: {
3918
+ matchPayeePattern: {
3582
3919
  type: 'string',
3583
- description: 'User ID'
3920
+ description: 'Payee matching pattern'
3584
3921
  },
3585
- ruleId: {
3586
- type: 'string',
3587
- description: 'Associated rule ID'
3922
+ matchAmountTolerance: {
3923
+ type: 'number',
3924
+ description: 'Amount tolerance percentage'
3588
3925
  },
3589
- expectedDate: {
3926
+ defaultExpenseAccount: {
3590
3927
  type: 'string',
3591
- description: 'Expected date (YYYY-MM-DD)'
3928
+ description: 'Default expense account'
3592
3929
  },
3593
- expectedAmount: {
3594
- type: 'number',
3595
- description: 'Expected amount'
3930
+ defaultPaymentAccount: {
3931
+ type: 'string',
3932
+ description: 'Default payment account'
3596
3933
  },
3597
- status: {
3934
+ defaultPayee: {
3598
3935
  type: 'string',
3599
- description: 'Status (PENDING, COMPLETED, SKIPPED)'
3936
+ description: 'Default payee'
3600
3937
  },
3601
- matchedTransactionId: {
3602
- type: 'object',
3603
- description: 'Matched transaction ID'
3938
+ isActive: {
3939
+ type: 'boolean',
3940
+ description: 'Whether rule is active'
3604
3941
  },
3605
- matchedAt: {
3606
- type: 'object',
3607
- description: 'Match timestamp (ISO 8601)'
3942
+ startDate: {
3943
+ type: 'string',
3944
+ description: 'Rule start date (YYYY-MM-DD)'
3608
3945
  },
3609
- matchConfidence: {
3610
- type: 'object',
3611
- description: 'Match confidence score (0-1)'
3946
+ endDate: {
3947
+ type: 'string',
3948
+ description: 'Rule end date (YYYY-MM-DD)'
3612
3949
  },
3613
- isOverdue: {
3950
+ autoCreate: {
3614
3951
  type: 'boolean',
3615
- description: 'Whether this expected transaction is overdue'
3952
+ description: 'Auto-create transaction on expected date'
3616
3953
  },
3617
- rule: {
3618
- description: 'Rule information',
3619
- allOf: [
3620
- {
3621
- $ref: '#/components/schemas/ExpectedTransactionRuleDto'
3622
- }
3623
- ]
3954
+ lastOccurrence: {
3955
+ type: 'string',
3956
+ description: 'Last matched occurrence date (YYYY-MM-DD)'
3957
+ },
3958
+ totalCount: {
3959
+ type: 'number',
3960
+ description: 'Total matched transactions count'
3624
3961
  },
3625
3962
  createdAt: {
3626
3963
  format: 'date-time',
@@ -3636,691 +3973,581 @@ export const $ExpectedTransactionResponseDto = {
3636
3973
  required: [
3637
3974
  'id',
3638
3975
  'userId',
3639
- 'ruleId',
3640
- 'expectedDate',
3976
+ 'name',
3977
+ 'frequency',
3641
3978
  'expectedAmount',
3642
- 'status',
3643
- 'isOverdue',
3644
- 'rule',
3979
+ 'currency',
3980
+ 'matchAmountTolerance',
3981
+ 'isActive',
3982
+ 'startDate',
3983
+ 'autoCreate',
3984
+ 'totalCount',
3645
3985
  'createdAt',
3646
3986
  'updatedAt'
3647
3987
  ]
3648
3988
  } as const;
3649
3989
 
3650
- export const $ExpectedTransactionListResponseDto = {
3990
+ export const $CreateRuleFromTransactionDto = {
3651
3991
  type: 'object',
3652
3992
  properties: {
3653
- items: {
3654
- type: 'array',
3655
- items: {
3656
- $ref: '#/components/schemas/ExpectedTransactionResponseDto'
3657
- }
3993
+ frequency: {
3994
+ type: 'string',
3995
+ description: 'Recurring frequency',
3996
+ enum: [
3997
+ 'WEEKLY',
3998
+ 'BIWEEKLY',
3999
+ 'MONTHLY',
4000
+ 'BIMONTHLY',
4001
+ 'QUARTERLY',
4002
+ 'YEARLY',
4003
+ 'CUSTOM'
4004
+ ],
4005
+ example: 'MONTHLY'
3658
4006
  },
3659
- total: {
3660
- type: 'number',
3661
- description: 'Total count'
3662
- }
3663
- },
3664
- required: ['items', 'total']
3665
- } as const;
3666
-
3667
- export const $ConfirmMatchDto = {
3668
- type: 'object',
3669
- properties: {
3670
- transactionId: {
4007
+ name: {
3671
4008
  type: 'string',
3672
- description: 'Transaction ID to match with'
4009
+ description: 'Optional name override (default: transaction payee)',
4010
+ maxLength: 100
4011
+ },
4012
+ icon: {
4013
+ type: 'string',
4014
+ description: 'Optional icon emoji',
4015
+ maxLength: 10
3673
4016
  }
3674
4017
  },
3675
- required: ['transactionId']
4018
+ required: ['frequency']
3676
4019
  } as const;
3677
4020
 
3678
- export const $EnterNowDto = {
4021
+ export const $RecurringRuleWithStatsResponseDto = {
3679
4022
  type: 'object',
3680
4023
  properties: {
3681
- expenseAccount: {
4024
+ id: {
3682
4025
  type: 'string',
3683
- description:
3684
- 'Override expense account (uses rule default if not provided)',
3685
- maxLength: 200
4026
+ description: 'Rule ID'
3686
4027
  },
3687
- paymentAccount: {
4028
+ userId: {
3688
4029
  type: 'string',
3689
- description:
3690
- 'Override payment account (uses rule default if not provided)',
3691
- maxLength: 200
4030
+ description: 'User ID'
3692
4031
  },
3693
- amount: {
3694
- type: 'number',
3695
- description: 'Override amount (uses expected amount if not provided)',
3696
- minimum: 0
4032
+ name: {
4033
+ type: 'string',
4034
+ description: 'Rule name'
3697
4035
  },
3698
- payee: {
4036
+ icon: {
3699
4037
  type: 'string',
3700
- description: 'Override payee (uses rule default if not provided)',
3701
- maxLength: 200
4038
+ description: 'Icon emoji'
3702
4039
  },
3703
- narration: {
4040
+ frequency: {
3704
4041
  type: 'string',
3705
- description: 'Optional narration',
3706
- maxLength: 500
3707
- }
3708
- }
3709
- } as const;
3710
-
3711
- export const $ForecastItemDto = {
3712
- type: 'object',
3713
- properties: {
3714
- rule: {
4042
+ description: 'Recurring frequency'
4043
+ },
4044
+ expectedAmount: {
4045
+ type: 'number',
4046
+ description: 'Expected amount'
4047
+ },
4048
+ expectedDay: {
4049
+ type: 'number',
4050
+ description: 'Expected day of month'
4051
+ },
4052
+ customIntervalDays: {
4053
+ type: 'number',
4054
+ description: 'Custom interval in days'
4055
+ },
4056
+ currency: {
3715
4057
  type: 'string',
3716
- description: 'Rule name',
3717
- example: 'Rent'
4058
+ description: 'Currency code'
3718
4059
  },
3719
- ruleId: {
4060
+ matchPayeePattern: {
3720
4061
  type: 'string',
3721
- description: 'Rule ID',
3722
- example: 'clx123...'
4062
+ description: 'Payee matching pattern'
3723
4063
  },
3724
- amount: {
4064
+ matchAmountTolerance: {
3725
4065
  type: 'number',
3726
- description: 'Expected amount',
3727
- example: 3000
4066
+ description: 'Amount tolerance percentage'
3728
4067
  },
3729
- date: {
4068
+ defaultExpenseAccount: {
3730
4069
  type: 'string',
3731
- description: 'Expected date (YYYY-MM-DD)',
3732
- example: '2024-04-01'
4070
+ description: 'Default expense account'
3733
4071
  },
3734
- icon: {
4072
+ defaultPaymentAccount: {
3735
4073
  type: 'string',
3736
- description: 'Rule icon emoji',
3737
- example: '🏠',
3738
- nullable: true
4074
+ description: 'Default payment account'
3739
4075
  },
3740
- currency: {
4076
+ defaultPayee: {
3741
4077
  type: 'string',
3742
- description: 'Currency code',
3743
- example: 'CNY'
3744
- }
3745
- },
3746
- required: ['rule', 'ruleId', 'amount', 'date', 'icon', 'currency']
3747
- } as const;
3748
-
3749
- export const $MonthlyForecastDto = {
3750
- type: 'object',
3751
- properties: {
3752
- month: {
4078
+ description: 'Default payee'
4079
+ },
4080
+ isActive: {
4081
+ type: 'boolean',
4082
+ description: 'Whether rule is active'
4083
+ },
4084
+ startDate: {
3753
4085
  type: 'string',
3754
- description: 'Month (YYYY-MM)',
3755
- example: '2024-04'
4086
+ description: 'Rule start date (YYYY-MM-DD)'
3756
4087
  },
3757
- expectedOutflow: {
4088
+ endDate: {
4089
+ type: 'string',
4090
+ description: 'Rule end date (YYYY-MM-DD)'
4091
+ },
4092
+ autoCreate: {
4093
+ type: 'boolean',
4094
+ description: 'Auto-create transaction on expected date'
4095
+ },
4096
+ lastOccurrence: {
4097
+ type: 'string',
4098
+ description: 'Last matched occurrence date (YYYY-MM-DD)'
4099
+ },
4100
+ totalCount: {
3758
4101
  type: 'number',
3759
- description: 'Total expected outflow for the month',
3760
- example: 8500
4102
+ description: 'Total matched transactions count'
3761
4103
  },
3762
- itemCount: {
4104
+ createdAt: {
4105
+ format: 'date-time',
4106
+ type: 'string',
4107
+ description: 'Created at timestamp'
4108
+ },
4109
+ updatedAt: {
4110
+ format: 'date-time',
4111
+ type: 'string',
4112
+ description: 'Updated at timestamp'
4113
+ },
4114
+ pendingCount: {
3763
4115
  type: 'number',
3764
- description: 'Number of expected transactions',
3765
- example: 3
4116
+ description: 'Number of pending expected transactions'
3766
4117
  },
3767
- byCurrency: {
3768
- type: 'object',
3769
- description: 'Breakdown by currency',
3770
- example: {
3771
- CNY: 8500,
3772
- USD: 100
3773
- }
4118
+ overdueCount: {
4119
+ type: 'number',
4120
+ description: 'Number of overdue expected transactions'
3774
4121
  },
3775
- items: {
3776
- description: 'Individual forecast items',
3777
- type: 'array',
3778
- items: {
3779
- $ref: '#/components/schemas/ForecastItemDto'
3780
- }
3781
- }
3782
- },
3783
- required: ['month', 'expectedOutflow', 'itemCount', 'byCurrency', 'items']
3784
- } as const;
3785
-
3786
- export const $ForecastResponseDto = {
3787
- type: 'object',
3788
- properties: {
3789
- forecast: {
3790
- description: 'Monthly forecast data',
3791
- type: 'array',
3792
- items: {
3793
- $ref: '#/components/schemas/MonthlyForecastDto'
3794
- }
4122
+ nextExpectedDate: {
4123
+ type: 'string',
4124
+ description: 'Next expected date (YYYY-MM-DD)'
3795
4125
  },
3796
- totalOutflow: {
4126
+ totalAmount: {
3797
4127
  type: 'number',
3798
- description: 'Total expected outflow across all months',
3799
- example: 25500
4128
+ description: 'Total amount of all matched transactions'
3800
4129
  },
3801
- totalByCurrency: {
3802
- type: 'object',
3803
- description: 'Total by currency across all months',
3804
- example: {
3805
- CNY: 25500,
3806
- USD: 300
3807
- }
4130
+ averageAmount: {
4131
+ type: 'number',
4132
+ description: 'Average amount per transaction'
3808
4133
  },
3809
- rulesCount: {
4134
+ transactionCount: {
3810
4135
  type: 'number',
3811
- description: 'Number of active recurring rules included',
3812
- example: 5
4136
+ description: 'Number of matched transactions'
3813
4137
  },
3814
- periodStart: {
4138
+ firstDate: {
3815
4139
  type: 'string',
3816
- description: 'Forecast period start date',
3817
- example: '2024-04-01'
4140
+ description: 'First matched transaction date (YYYY-MM-DD)'
3818
4141
  },
3819
- periodEnd: {
4142
+ lastDate: {
3820
4143
  type: 'string',
3821
- description: 'Forecast period end date',
3822
- example: '2024-06-30'
4144
+ description: 'Last matched transaction date (YYYY-MM-DD)'
4145
+ },
4146
+ variance: {
4147
+ type: 'number',
4148
+ description: 'Amount variance (standard deviation squared)'
4149
+ },
4150
+ upcomingCount: {
4151
+ type: 'number',
4152
+ description: 'Number of upcoming expected transactions'
3823
4153
  }
3824
4154
  },
3825
4155
  required: [
3826
- 'forecast',
3827
- 'totalOutflow',
3828
- 'totalByCurrency',
3829
- 'rulesCount',
3830
- 'periodStart',
3831
- 'periodEnd'
4156
+ 'id',
4157
+ 'userId',
4158
+ 'name',
4159
+ 'frequency',
4160
+ 'expectedAmount',
4161
+ 'currency',
4162
+ 'matchAmountTolerance',
4163
+ 'isActive',
4164
+ 'startDate',
4165
+ 'autoCreate',
4166
+ 'totalCount',
4167
+ 'createdAt',
4168
+ 'updatedAt',
4169
+ 'pendingCount',
4170
+ 'overdueCount',
4171
+ 'totalAmount',
4172
+ 'averageAmount',
4173
+ 'transactionCount',
4174
+ 'variance',
4175
+ 'upcomingCount'
3832
4176
  ]
3833
4177
  } as const;
3834
4178
 
3835
- export const $CurrencyBalanceDto = {
4179
+ export const $UpdateRecurringRuleDto = {
3836
4180
  type: 'object',
3837
4181
  properties: {
3838
- currency: {
4182
+ name: {
3839
4183
  type: 'string',
3840
- description: 'ISO 4217 currency code',
3841
- example: 'CNY'
4184
+ description: 'Rule name (unique per user)',
4185
+ maxLength: 100
3842
4186
  },
3843
- balance: {
3844
- type: 'string',
3845
- description: 'Balance amount',
3846
- example: '500000.00'
3847
- }
3848
- },
3849
- required: ['currency', 'balance']
3850
- } as const;
3851
-
3852
- export const $TimeSeriesPointDto = {
3853
- type: 'object',
3854
- properties: {
3855
- date: {
4187
+ icon: {
3856
4188
  type: 'string',
3857
- description: 'Date in YYYY-MM-DD format',
3858
- example: '2024-06-15'
4189
+ description: 'Icon emoji',
4190
+ maxLength: 10
3859
4191
  },
3860
- value: {
4192
+ frequency: {
3861
4193
  type: 'string',
3862
- description: 'Value at this date (in base currency)',
3863
- example: '500000.00'
4194
+ description: 'Recurring frequency',
4195
+ enum: [
4196
+ 'WEEKLY',
4197
+ 'BIWEEKLY',
4198
+ 'MONTHLY',
4199
+ 'BIMONTHLY',
4200
+ 'QUARTERLY',
4201
+ 'YEARLY',
4202
+ 'CUSTOM'
4203
+ ]
3864
4204
  },
3865
- change: {
3866
- type: 'object',
3867
- description: 'Change from previous point',
3868
- example: '5000.00'
4205
+ expectedAmount: {
4206
+ type: 'number',
4207
+ description: 'Expected amount (positive number)',
4208
+ minimum: 0
3869
4209
  },
3870
- assets: {
3871
- type: 'string',
3872
- description: 'Total assets at this date (in base currency)',
3873
- example: '494338.00'
4210
+ expectedDay: {
4211
+ type: 'number',
4212
+ description: 'Expected day of month (1-31)',
4213
+ minimum: 1,
4214
+ maximum: 31
3874
4215
  },
3875
- liabilities: {
4216
+ currency: {
3876
4217
  type: 'string',
3877
- description: 'Total liabilities at this date (in base currency)',
3878
- example: '310098.00'
4218
+ description: 'Currency code',
4219
+ maxLength: 10
3879
4220
  },
3880
- byCurrency: {
3881
- description: 'Multi-currency breakdown for this point',
3882
- type: 'array',
3883
- items: {
3884
- $ref: '#/components/schemas/CurrencyBalanceDto'
3885
- }
3886
- }
3887
- },
3888
- required: ['date', 'value']
3889
- } as const;
3890
-
3891
- export const $TrendSummaryDto = {
3892
- type: 'object',
3893
- properties: {
3894
- startValue: {
4221
+ matchPayeePattern: {
3895
4222
  type: 'string',
3896
- description: 'Value at start of period',
3897
- example: '450000.00'
4223
+ description: 'Payee matching pattern (supports wildcards)',
4224
+ maxLength: 200
3898
4225
  },
3899
- endValue: {
4226
+ matchAmountTolerance: {
4227
+ type: 'number',
4228
+ description: 'Amount tolerance percentage (0-1)',
4229
+ default: 0.075,
4230
+ minimum: 0,
4231
+ maximum: 1
4232
+ },
4233
+ defaultExpenseAccount: {
3900
4234
  type: 'string',
3901
- description: 'Value at end of period',
3902
- example: '500000.00'
4235
+ description: 'Default expense account for auto-create',
4236
+ maxLength: 200
3903
4237
  },
3904
- totalChange: {
4238
+ defaultPaymentAccount: {
3905
4239
  type: 'string',
3906
- description: 'Total change over period',
3907
- example: '50000.00'
4240
+ description: 'Default payment account for auto-create',
4241
+ maxLength: 200
3908
4242
  },
3909
- totalChangePercentage: {
4243
+ defaultPayee: {
3910
4244
  type: 'string',
3911
- description: 'Total change percentage',
3912
- example: '+11.11%'
3913
- }
3914
- },
3915
- required: ['startValue', 'endValue', 'totalChange', 'totalChangePercentage']
3916
- } as const;
3917
-
3918
- export const $MultiCurrencyPointDto = {
3919
- type: 'object',
3920
- properties: {
3921
- date: {
4245
+ description: 'Default payee for auto-create',
4246
+ maxLength: 200
4247
+ },
4248
+ autoCreate: {
4249
+ type: 'boolean',
4250
+ description: 'Auto-create transaction when expected date arrives',
4251
+ default: false
4252
+ },
4253
+ endDate: {
3922
4254
  type: 'string',
3923
- description: 'Date in YYYY-MM-DD format',
3924
- example: '2024-06-15'
4255
+ description: 'Rule end date (ISO format)'
3925
4256
  },
3926
- byCurrency: {
3927
- description: 'Balances by currency',
3928
- type: 'array',
3929
- items: {
3930
- $ref: '#/components/schemas/CurrencyBalanceDto'
3931
- }
4257
+ customIntervalDays: {
4258
+ type: 'number',
4259
+ description: 'Custom interval in days',
4260
+ minimum: 1
4261
+ },
4262
+ isActive: {
4263
+ type: 'boolean',
4264
+ description: 'Rule active status'
3932
4265
  }
3933
- },
3934
- required: ['date', 'byCurrency']
4266
+ }
3935
4267
  } as const;
3936
4268
 
3937
- export const $PortfolioTrendsResponseDto = {
4269
+ export const $ExpectedTransactionRuleDto = {
3938
4270
  type: 'object',
3939
4271
  properties: {
3940
- series: {
3941
- description: 'Time series data points',
3942
- type: 'array',
3943
- items: {
3944
- $ref: '#/components/schemas/TimeSeriesPointDto'
3945
- }
3946
- },
3947
- summary: {
3948
- description: 'Period summary',
3949
- allOf: [
3950
- {
3951
- $ref: '#/components/schemas/TrendSummaryDto'
3952
- }
3953
- ]
4272
+ name: {
4273
+ type: 'string',
4274
+ description: 'Rule name'
3954
4275
  },
3955
- period: {
4276
+ icon: {
3956
4277
  type: 'string',
3957
- description: 'Period requested',
3958
- example: '6m'
4278
+ description: 'Rule icon'
3959
4279
  },
3960
- granularity: {
4280
+ frequency: {
3961
4281
  type: 'string',
3962
- description: 'Data granularity',
3963
- example: 'month'
4282
+ description: 'Rule frequency'
3964
4283
  },
3965
4284
  currency: {
3966
4285
  type: 'string',
3967
- description: 'Base currency for converted values',
3968
- example: 'CNY'
3969
- },
3970
- byCurrency: {
3971
- description:
3972
- 'Multi-currency time series (each point has currency breakdown)',
3973
- type: 'array',
3974
- items: {
3975
- $ref: '#/components/schemas/MultiCurrencyPointDto'
3976
- }
3977
- },
3978
- warnings: {
3979
- description: 'Exchange rate warnings',
3980
- type: 'array',
3981
- items: {
3982
- $ref: '#/components/schemas/ExchangeRateWarningDto'
3983
- }
4286
+ description: 'Currency code'
3984
4287
  }
3985
4288
  },
3986
- required: ['series', 'summary', 'period', 'granularity', 'currency']
4289
+ required: ['name', 'frequency', 'currency']
3987
4290
  } as const;
3988
4291
 
3989
- export const $CashFlowPointDto = {
4292
+ export const $ExpectedTransactionResponseDto = {
3990
4293
  type: 'object',
3991
4294
  properties: {
3992
- month: {
4295
+ id: {
3993
4296
  type: 'string',
3994
- description: 'Month key (YYYY-MM)',
3995
- example: '2024-03'
4297
+ description: 'Expected transaction ID'
3996
4298
  },
3997
- income: {
4299
+ userId: {
3998
4300
  type: 'string',
3999
- description: 'Income in base currency (absolute, converted)',
4000
- example: '10000.00'
4301
+ description: 'User ID'
4001
4302
  },
4002
- expense: {
4303
+ ruleId: {
4003
4304
  type: 'string',
4004
- description: 'Expense in base currency (absolute, converted)',
4005
- example: '5000.00'
4305
+ description: 'Associated rule ID'
4006
4306
  },
4007
- netSavings: {
4008
- type: 'string',
4009
- description: 'netSavings = income − expense (savings positive)',
4010
- example: '5000.00'
4011
- }
4012
- },
4013
- required: ['month', 'income', 'expense', 'netSavings']
4014
- } as const;
4015
-
4016
- export const $CashFlowTrendSummaryDto = {
4017
- type: 'object',
4018
- properties: {
4019
- totalIncome: {
4307
+ expectedDate: {
4020
4308
  type: 'string',
4021
- description: 'Total income across the period',
4022
- example: '60000.00'
4309
+ description: 'Expected date (YYYY-MM-DD)'
4310
+ },
4311
+ expectedAmount: {
4312
+ type: 'number',
4313
+ description: 'Expected amount'
4023
4314
  },
4024
- totalExpense: {
4315
+ status: {
4025
4316
  type: 'string',
4026
- description: 'Total expense across the period',
4027
- example: '30000.00'
4317
+ description: 'Status (PENDING, COMPLETED, SKIPPED)'
4028
4318
  },
4029
- totalNetSavings: {
4319
+ matchedTransactionId: {
4030
4320
  type: 'string',
4031
- description: 'income − expense across the period',
4032
- example: '30000.00'
4321
+ description: 'Matched transaction ID'
4033
4322
  },
4034
- averageMonthlyNetSavings: {
4323
+ matchedAt: {
4035
4324
  type: 'string',
4036
- description:
4037
- 'totalNetSavings divided by the window length (N months, incl. zero-filled)',
4038
- example: '5000.00'
4039
- }
4040
- },
4041
- required: [
4042
- 'totalIncome',
4043
- 'totalExpense',
4044
- 'totalNetSavings',
4045
- 'averageMonthlyNetSavings'
4046
- ]
4047
- } as const;
4048
-
4049
- export const $CashFlowTrendsResponseDto = {
4050
- type: 'object',
4051
- properties: {
4052
- series: {
4053
- description:
4054
- 'Monthly cash-flow series (fixed N-month window, zero-filled)',
4055
- type: 'array',
4056
- items: {
4057
- $ref: '#/components/schemas/CashFlowPointDto'
4058
- }
4325
+ description: 'Match timestamp (ISO 8601)'
4059
4326
  },
4060
- summary: {
4061
- description: 'Period totals',
4327
+ matchConfidence: {
4328
+ type: 'number',
4329
+ description: 'Match confidence score (0-1)'
4330
+ },
4331
+ isOverdue: {
4332
+ type: 'boolean',
4333
+ description: 'Whether this expected transaction is overdue'
4334
+ },
4335
+ rule: {
4336
+ description: 'Rule information',
4062
4337
  allOf: [
4063
4338
  {
4064
- $ref: '#/components/schemas/CashFlowTrendSummaryDto'
4339
+ $ref: '#/components/schemas/ExpectedTransactionRuleDto'
4065
4340
  }
4066
4341
  ]
4067
4342
  },
4068
- period: {
4069
- type: 'string',
4070
- description: 'Period requested',
4071
- example: '6m'
4072
- },
4073
- granularity: {
4343
+ createdAt: {
4344
+ format: 'date-time',
4074
4345
  type: 'string',
4075
- description: 'Data granularity (v1 returns month buckets)',
4076
- example: 'month'
4346
+ description: 'Created at timestamp'
4077
4347
  },
4078
- currency: {
4348
+ updatedAt: {
4349
+ format: 'date-time',
4079
4350
  type: 'string',
4080
- description: 'Base currency for converted values',
4081
- example: 'CNY'
4082
- },
4083
- warnings: {
4084
- description: 'Exchange rate warnings (e.g. missing rate for a currency)',
4085
- type: 'array',
4086
- items: {
4087
- $ref: '#/components/schemas/ExchangeRateWarningDto'
4088
- }
4351
+ description: 'Updated at timestamp'
4089
4352
  }
4090
4353
  },
4091
- required: ['series', 'summary', 'period', 'granularity', 'currency']
4092
- } as const;
4093
-
4094
- export const $GenerateSnapshotBody = {
4095
- type: 'object',
4096
- properties: {}
4097
- } as const;
4098
-
4099
- export const $GenerateSnapshotResponse = {
4100
- type: 'object',
4101
- properties: {}
4102
- } as const;
4103
-
4104
- export const $BackfillSnapshotsBody = {
4105
- type: 'object',
4106
- properties: {}
4107
- } as const;
4108
-
4109
- export const $BackfillSnapshotsResponse = {
4110
- type: 'object',
4111
- properties: {}
4354
+ required: [
4355
+ 'id',
4356
+ 'userId',
4357
+ 'ruleId',
4358
+ 'expectedDate',
4359
+ 'expectedAmount',
4360
+ 'status',
4361
+ 'isOverdue',
4362
+ 'rule',
4363
+ 'createdAt',
4364
+ 'updatedAt'
4365
+ ]
4112
4366
  } as const;
4113
4367
 
4114
- export const $DeleteOwnUserDto = {
4368
+ export const $ExpectedTransactionListResponseDto = {
4115
4369
  type: 'object',
4116
4370
  properties: {
4117
- accessToken: {
4118
- type: 'string',
4119
- description: 'Access token for user verification',
4120
- example: 'abc123xyz'
4371
+ items: {
4372
+ type: 'array',
4373
+ items: {
4374
+ $ref: '#/components/schemas/ExpectedTransactionResponseDto'
4375
+ }
4376
+ },
4377
+ total: {
4378
+ type: 'number',
4379
+ description: 'Total count'
4121
4380
  }
4122
4381
  },
4123
- required: ['accessToken']
4382
+ required: ['items', 'total']
4124
4383
  } as const;
4125
4384
 
4126
- export const $UserSettingsResponseDto = {
4385
+ export const $ConfirmMatchDto = {
4127
4386
  type: 'object',
4128
4387
  properties: {
4129
- baseCurrency: {
4388
+ transactionId: {
4130
4389
  type: 'string',
4131
- description:
4132
- 'Base currency (ISO 4217) for net-worth/report aggregation. Independent of region (ADR-0006).',
4133
- example: 'USD',
4134
- nullable: true
4390
+ description: 'Transaction ID to match with'
4135
4391
  }
4136
4392
  },
4137
- required: ['baseCurrency']
4393
+ required: ['transactionId']
4138
4394
  } as const;
4139
4395
 
4140
- export const $UserResponseDto = {
4396
+ export const $EnterNowDto = {
4141
4397
  type: 'object',
4142
4398
  properties: {
4143
- id: {
4399
+ expenseAccount: {
4144
4400
  type: 'string',
4145
- description: 'User ID'
4401
+ description:
4402
+ 'Override expense account (uses rule default if not provided)',
4403
+ maxLength: 200
4146
4404
  },
4147
- role: {
4405
+ paymentAccount: {
4148
4406
  type: 'string',
4149
- description: 'Assigned user role'
4407
+ description:
4408
+ 'Override payment account (uses rule default if not provided)',
4409
+ maxLength: 200
4150
4410
  },
4151
- permissions: {
4152
- description: 'Permission strings',
4153
- type: 'array',
4154
- items: {
4155
- type: 'string'
4156
- }
4411
+ amount: {
4412
+ type: 'number',
4413
+ description: 'Override amount (uses expected amount if not provided)',
4414
+ minimum: 0
4157
4415
  },
4158
- settings: {
4159
- description: 'User settings',
4160
- allOf: [
4161
- {
4162
- $ref: '#/components/schemas/UserSettingsResponseDto'
4163
- }
4164
- ]
4165
- }
4166
- },
4167
- required: ['id', 'role', 'permissions', 'settings']
4168
- } as const;
4169
-
4170
- export const $SignupDto = {
4171
- type: 'object',
4172
- properties: {
4173
- turnstileToken: {
4416
+ payee: {
4174
4417
  type: 'string',
4175
- description:
4176
- 'Cloudflare Turnstile verification token (optional when Turnstile disabled)',
4177
- example: '0.abc123def456...'
4418
+ description: 'Override payee (uses rule default if not provided)',
4419
+ maxLength: 200
4420
+ },
4421
+ narration: {
4422
+ type: 'string',
4423
+ description: 'Optional narration',
4424
+ maxLength: 500
4178
4425
  }
4179
4426
  }
4180
4427
  } as const;
4181
4428
 
4182
- export const $SignupResponseDto = {
4429
+ export const $ForecastItemDto = {
4183
4430
  type: 'object',
4184
4431
  properties: {
4185
- authToken: {
4186
- type: 'string',
4187
- description: 'JWT auth token',
4188
- example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
4189
- },
4190
- accessToken: {
4432
+ rule: {
4191
4433
  type: 'string',
4192
- description: 'Auto-generated access token'
4434
+ description: 'Rule name',
4435
+ example: 'Rent'
4193
4436
  },
4194
- role: {
4437
+ ruleId: {
4195
4438
  type: 'string',
4196
- description: 'Assigned user role',
4197
- enum: ['USER', 'ADMIN', 'DEMO', 'INACTIVE', 'PAID', 'OPS']
4198
- }
4199
- },
4200
- required: ['authToken', 'accessToken', 'role']
4201
- } as const;
4202
-
4203
- export const $UpdateUserSettingDto = {
4204
- type: 'object',
4205
- properties: {
4206
- secId: {
4207
- type: 'number',
4208
- description: 'Security ID'
4439
+ description: 'Rule ID',
4440
+ example: 'clx123...'
4209
4441
  },
4210
- annualInterestRate: {
4442
+ amount: {
4211
4443
  type: 'number',
4212
- description: 'Annual interest rate',
4213
- example: 0.05
4214
- },
4215
- currency: {
4216
- type: 'string',
4217
- description: 'Currency code',
4218
- example: 'USD'
4444
+ description: 'Expected amount',
4445
+ example: 3000
4219
4446
  },
4220
- baseCurrency: {
4447
+ date: {
4221
4448
  type: 'string',
4222
- description: 'Base currency code',
4223
- example: 'USD'
4449
+ description: 'Expected date (YYYY-MM-DD)',
4450
+ example: '2024-04-01'
4224
4451
  },
4225
- benchmark: {
4452
+ icon: {
4226
4453
  type: 'string',
4227
- description: 'Benchmark symbol',
4228
- example: 'SPY'
4454
+ description: 'Rule icon emoji',
4455
+ example: '🏠',
4456
+ nullable: true
4229
4457
  },
4230
- colorScheme: {
4458
+ currency: {
4231
4459
  type: 'string',
4232
- description: 'Color scheme',
4233
- enum: ['DARK', 'LIGHT']
4234
- },
4235
- dateRange: {
4460
+ description: 'Currency code',
4461
+ example: 'CNY'
4462
+ }
4463
+ },
4464
+ required: ['rule', 'ruleId', 'amount', 'date', 'icon', 'currency']
4465
+ } as const;
4466
+
4467
+ export const $MonthlyForecastDto = {
4468
+ type: 'object',
4469
+ properties: {
4470
+ month: {
4236
4471
  type: 'string',
4237
- description: 'Date range filter',
4238
- example: '1y'
4472
+ description: 'Month (YYYY-MM)',
4473
+ example: '2024-04'
4239
4474
  },
4240
- emergencyFund: {
4475
+ expectedOutflow: {
4241
4476
  type: 'number',
4242
- description: 'Emergency fund amount',
4243
- example: 10000
4477
+ description: 'Total expected outflow for the month',
4478
+ example: 8500
4244
4479
  },
4245
- 'filters.accounts': {
4246
- description: 'Account filter IDs',
4247
- type: 'array',
4248
- items: {
4249
- type: 'string'
4480
+ itemCount: {
4481
+ type: 'number',
4482
+ description: 'Number of expected transactions',
4483
+ example: 3
4484
+ },
4485
+ byCurrency: {
4486
+ type: 'object',
4487
+ description: 'Breakdown by currency',
4488
+ example: {
4489
+ CNY: 8500,
4490
+ USD: 100
4250
4491
  }
4251
4492
  },
4252
- 'filters.assetClasses': {
4253
- description: 'Asset class filters',
4493
+ items: {
4494
+ description: 'Individual forecast items',
4254
4495
  type: 'array',
4255
4496
  items: {
4256
- type: 'string'
4497
+ $ref: '#/components/schemas/ForecastItemDto'
4257
4498
  }
4258
- },
4259
- 'filters.dataSource': {
4260
- type: 'string',
4261
- description: 'Data source filter'
4262
- },
4263
- 'filters.symbol': {
4264
- type: 'string',
4265
- description: 'Symbol filter'
4266
- },
4267
- 'filters.tags': {
4268
- description: 'Tag filters',
4499
+ }
4500
+ },
4501
+ required: ['month', 'expectedOutflow', 'itemCount', 'byCurrency', 'items']
4502
+ } as const;
4503
+
4504
+ export const $ForecastResponseDto = {
4505
+ type: 'object',
4506
+ properties: {
4507
+ forecast: {
4508
+ description: 'Monthly forecast data',
4269
4509
  type: 'array',
4270
4510
  items: {
4271
- type: 'string'
4511
+ $ref: '#/components/schemas/MonthlyForecastDto'
4272
4512
  }
4273
4513
  },
4274
- isExperimentalFeatures: {
4275
- type: 'boolean',
4276
- description: 'Enable experimental features'
4277
- },
4278
- isRestrictedView: {
4279
- type: 'boolean',
4280
- description: 'Enable restricted view mode'
4281
- },
4282
- language: {
4283
- type: 'string',
4284
- description: 'Language code',
4285
- example: 'en'
4286
- },
4287
- locale: {
4288
- type: 'string',
4289
- description: 'Locale code',
4290
- example: 'en-US'
4291
- },
4292
- projectedTotalAmount: {
4514
+ totalOutflow: {
4293
4515
  type: 'number',
4294
- description: 'Projected total amount',
4295
- example: 1000000
4516
+ description: 'Total expected outflow across all months',
4517
+ example: 25500
4296
4518
  },
4297
- retirementDate: {
4298
- type: 'string',
4299
- description: 'Retirement date in ISO 8601 format',
4300
- example: '2050-01-01'
4519
+ totalByCurrency: {
4520
+ type: 'object',
4521
+ description: 'Total by currency across all months',
4522
+ example: {
4523
+ CNY: 25500,
4524
+ USD: 300
4525
+ }
4301
4526
  },
4302
- savingsRate: {
4527
+ rulesCount: {
4303
4528
  type: 'number',
4304
- description: 'Savings rate percentage',
4305
- example: 0.2
4529
+ description: 'Number of active recurring rules included',
4530
+ example: 5
4306
4531
  },
4307
- viewMode: {
4532
+ periodStart: {
4308
4533
  type: 'string',
4309
- description: 'View mode',
4310
- enum: ['DEFAULT', 'ZEN']
4311
- }
4312
- }
4313
- } as const;
4314
-
4315
- export const $UpdatePropertyDto = {
4316
- type: 'object',
4317
- properties: {
4318
- value: {
4534
+ description: 'Forecast period start date',
4535
+ example: '2024-04-01'
4536
+ },
4537
+ periodEnd: {
4319
4538
  type: 'string',
4320
- description: 'Property value'
4539
+ description: 'Forecast period end date',
4540
+ example: '2024-06-30'
4321
4541
  }
4322
4542
  },
4323
- required: ['value']
4543
+ required: [
4544
+ 'forecast',
4545
+ 'totalOutflow',
4546
+ 'totalByCurrency',
4547
+ 'rulesCount',
4548
+ 'periodStart',
4549
+ 'periodEnd'
4550
+ ]
4324
4551
  } as const;
4325
4552
 
4326
4553
  export const $CreateTransactionRuleDto = {
@@ -4882,7 +5109,8 @@ export const $UpdateTransactionRuleDto = {
4882
5109
  },
4883
5110
  matchLogic: {
4884
5111
  type: 'string',
4885
- enum: ['OR', 'AND']
5112
+ enum: ['OR', 'AND'],
5113
+ default: 'OR'
4886
5114
  },
4887
5115
  amountMin: {
4888
5116
  type: 'number',
@@ -4896,13 +5124,10 @@ export const $UpdateTransactionRuleDto = {
4896
5124
  },
4897
5125
  priority: {
4898
5126
  type: 'number',
5127
+ default: 50,
4899
5128
  minimum: 0,
4900
5129
  maximum: 1000
4901
5130
  },
4902
- enabled: {
4903
- type: 'boolean',
4904
- description: 'Enable or disable the rule'
4905
- },
4906
5131
  additionalTags: {
4907
5132
  items: {
4908
5133
  type: 'array'
@@ -4912,6 +5137,10 @@ export const $UpdateTransactionRuleDto = {
4912
5137
  },
4913
5138
  additionalMetadata: {
4914
5139
  type: 'object'
5140
+ },
5141
+ enabled: {
5142
+ type: 'boolean',
5143
+ description: 'Enable or disable the rule'
4915
5144
  }
4916
5145
  }
4917
5146
  } as const;
@@ -5005,9 +5234,23 @@ export const $CategoryCatalogEntryDto = {
5005
5234
  items: {
5006
5235
  type: 'string'
5007
5236
  }
5237
+ },
5238
+ categoryAccounts: {
5239
+ description:
5240
+ "Beancount account paths (categoryAccount) of the region-enabled system rules whose categoryKeywords include this slug (#816). System rules only (public endpoint — user rules excluded); one-to-many by design (e.g. 'utilities' → Electricity/Water/Internet/Gas), sorted, [] when no rule maps the slug.",
5241
+ example: [
5242
+ 'Expenses:Utilities:Electricity',
5243
+ 'Expenses:Utilities:Gas',
5244
+ 'Expenses:Utilities:Internet',
5245
+ 'Expenses:Utilities:Water'
5246
+ ],
5247
+ type: 'array',
5248
+ items: {
5249
+ type: 'string'
5250
+ }
5008
5251
  }
5009
5252
  },
5010
- required: ['slug', 'scenario', 'icon', 'regions']
5253
+ required: ['slug', 'scenario', 'icon', 'regions', 'categoryAccounts']
5011
5254
  } as const;
5012
5255
 
5013
5256
  export const $CategoryCatalogListResponseDto = {
@@ -5198,6 +5441,14 @@ export const $OnboardingAccountDto = {
5198
5441
  description:
5199
5442
  'Platform ID to bind the account to (references Platform.id); omit for unbound',
5200
5443
  example: 'c98e5d4a-2f71-4a5a-bb3c-92c9f231d5e2'
5444
+ },
5445
+ displayName: {
5446
+ type: 'string',
5447
+ description:
5448
+ 'User-set display name override (omit/null = keep the derived name)',
5449
+ nullable: true,
5450
+ maxLength: 50,
5451
+ example: 'Salary card'
5201
5452
  }
5202
5453
  },
5203
5454
  required: ['path', 'currency']
@@ -6118,8 +6369,9 @@ export const $ClientParsedDataDto = {
6118
6369
  },
6119
6370
  category: {
6120
6371
  type: 'string',
6121
- description: 'Category slug',
6122
- example: 'food_restaurant'
6372
+ description:
6373
+ 'Category in canonical form (catalog slug or Stage-2 rule keyword token, ADR-0116) — echo back verbatim from parsedData.category. Foreign forms (locale display names, account paths) are rejected with nlp.category.invalid.',
6374
+ example: 'food'
6123
6375
  },
6124
6376
  incomeType: {
6125
6377
  type: 'string',
@@ -6217,8 +6469,27 @@ export const $ProcessNlpDto = {
6217
6469
  selectedAccount: {
6218
6470
  type: 'string',
6219
6471
  description:
6220
- 'confirm_account echo-back: account path selected from the prior confirm_account response (suggestedAccount, similarAccounts[i], or a typed path). Applied directly when the session is confirming_account — no NL re-parse.',
6472
+ 'confirm_account echo-back: account path selected from the prior confirm_account response (suggestedAccount, similarAccounts[i].path, or a typed path). Applied directly when the session is confirming_account — no NL re-parse.',
6221
6473
  example: 'Expenses:Food:Coffee'
6474
+ },
6475
+ viewpointAccount: {
6476
+ type: 'string',
6477
+ description:
6478
+ 'Viewpoint account hint: the beancount path the user drilled into (e.g. from an account drill-down). Tie-break only — never overrides accounts resolved from the text. Must be an owned, OPEN Assets:/Liabilities: account; unresolvable hints are silently ignored.',
6479
+ example: 'Assets:CN:Bank:ICBC'
6480
+ },
6481
+ viewpointCategory: {
6482
+ type: 'string',
6483
+ description:
6484
+ "Viewpoint category hint: the ADR-0075 Group segment the user drilled into (e.g. 'Food'). Resolved to a concrete OPEN account in that group; tie-break only — never overrides a category resolved from the text.",
6485
+ example: 'Food'
6486
+ },
6487
+ viewpointFlow: {
6488
+ type: 'string',
6489
+ description:
6490
+ "Companion flow root for viewpointCategory ('income' | 'expense'), mirroring the ADR-0126 list-endpoint invariant. Derived from the session's routed intent (multi-turn) when absent; a first-turn flow-less category hint is dropped — send the flow explicitly.",
6491
+ enum: ['income', 'expense'],
6492
+ example: 'expense'
6222
6493
  }
6223
6494
  }
6224
6495
  } as const;
@@ -6286,7 +6557,9 @@ export const $NlpParsedDataDto = {
6286
6557
  },
6287
6558
  category: {
6288
6559
  type: 'string',
6289
- description: 'Category'
6560
+ description:
6561
+ 'Category in canonical form: a CATEGORY_CATALOG slug (GET /{region}/bean/categories) or a Stage-2 rule categoryKeywords token (ADR-0116 D2). Never a locale display name or a beancount account path. Echo back verbatim on confirm.',
6562
+ example: 'food'
6290
6563
  },
6291
6564
  incomeType: {
6292
6565
  type: 'string',
@@ -6532,6 +6805,24 @@ export const $NlpRuleConfirmationDataDto = {
6532
6805
  ]
6533
6806
  } as const;
6534
6807
 
6808
+ export const $NlpAccountCandidateDto = {
6809
+ type: 'object',
6810
+ properties: {
6811
+ path: {
6812
+ type: 'string',
6813
+ description: 'Canonical beancount account path (echo back on selection)',
6814
+ example: 'Expenses:Food:Dining'
6815
+ },
6816
+ name: {
6817
+ type: 'string',
6818
+ description:
6819
+ 'Localized display name (ADR-0114 read-time projection, user locale)',
6820
+ example: '餐饮'
6821
+ }
6822
+ },
6823
+ required: ['path', 'name']
6824
+ } as const;
6825
+
6535
6826
  export const $NlpAccountConfirmationDataDto = {
6536
6827
  type: 'object',
6537
6828
  properties: {
@@ -6547,10 +6838,11 @@ export const $NlpAccountConfirmationDataDto = {
6547
6838
  example: 'Expenses:Food:Drinks'
6548
6839
  },
6549
6840
  similarAccounts: {
6550
- description: 'Similar accounts for user selection',
6841
+ description:
6842
+ 'Similar accounts for user selection (path + localized name, #680)',
6551
6843
  type: 'array',
6552
6844
  items: {
6553
- type: 'string'
6845
+ $ref: '#/components/schemas/NlpAccountCandidateDto'
6554
6846
  }
6555
6847
  },
6556
6848
  errorMessage: {
@@ -7127,55 +7419,128 @@ export const $PlatformMatchResultDto = {
7127
7419
  category: {
7128
7420
  type: 'string',
7129
7421
  description:
7130
- 'Region-aware category (institution vocab, e.g. DigitalWallet/Bank). null = no region-aware suggestion; fall back to type.',
7422
+ 'Region-aware category (institution vocab, e.g. DigitalWallet/Bank). null = no region-aware suggestion; fall back to type.',
7423
+ nullable: true,
7424
+ example: 'DigitalWallet'
7425
+ },
7426
+ matchType: {
7427
+ type: 'string',
7428
+ description: "How this row matched: 'exact' > 'prefix' > 'substring'",
7429
+ enum: ['exact', 'prefix', 'substring']
7430
+ }
7431
+ },
7432
+ required: [
7433
+ 'id',
7434
+ 'name',
7435
+ 'canonical',
7436
+ 'type',
7437
+ 'suggestedSegment',
7438
+ 'logoUrl',
7439
+ 'countryCode',
7440
+ 'category',
7441
+ 'matchType'
7442
+ ]
7443
+ } as const;
7444
+
7445
+ export const $PlatformMatchResponseDto = {
7446
+ type: 'object',
7447
+ properties: {
7448
+ platforms: {
7449
+ description: 'Ranked matches, best tier first (at most 10 rows)',
7450
+ type: 'array',
7451
+ items: {
7452
+ $ref: '#/components/schemas/PlatformMatchResultDto'
7453
+ }
7454
+ },
7455
+ matchType: {
7456
+ type: 'string',
7457
+ description:
7458
+ "Overall match quality — top row's tier, or 'none' when no hits",
7459
+ enum: ['none', 'exact', 'prefix', 'substring']
7460
+ },
7461
+ total: {
7462
+ type: 'number',
7463
+ description: 'Total matches before LIMIT (truncation transparency)'
7464
+ },
7465
+ hasMore: {
7466
+ type: 'boolean',
7467
+ description: 'true when total > platforms.length (more matches exist)'
7468
+ }
7469
+ },
7470
+ required: ['platforms', 'matchType', 'total', 'hasMore']
7471
+ } as const;
7472
+
7473
+ export const $PlatformStandardsPlatformDto = {
7474
+ type: 'object',
7475
+ properties: {
7476
+ id: {
7477
+ type: 'string',
7478
+ description: 'Global platform ID'
7479
+ },
7480
+ name: {
7481
+ type: 'string',
7482
+ description: 'Platform name (e.g., "ICBC")'
7483
+ },
7484
+ canonical: {
7485
+ type: 'string',
7486
+ description: 'Canonical identifier in ACCOUNT_RE format (e.g., "icbc")'
7487
+ },
7488
+ suggestedSegment: {
7489
+ type: 'string',
7490
+ description:
7491
+ 'Suggested path segment — canonical PascalCased per hyphen-part, hyphens preserved (e.g. "Apple-Pay")'
7492
+ },
7493
+ type: {
7494
+ type: 'string',
7495
+ description: 'Platform type',
7496
+ enum: [
7497
+ 'BANK',
7498
+ 'BROKERAGE',
7499
+ 'CRYPTO_EXCHANGE',
7500
+ 'PAYMENT',
7501
+ 'INVESTMENT',
7502
+ 'INSURANCE',
7503
+ 'OTHER'
7504
+ ]
7505
+ },
7506
+ category: {
7507
+ type: 'string',
7508
+ description:
7509
+ 'Region-aware category (institution vocab, e.g. DigitalWallet/Bank) resolved against the final region. null = no region-aware suggestion; fall back to type.',
7131
7510
  nullable: true,
7132
- example: 'DigitalWallet'
7133
- },
7134
- matchType: {
7135
- type: 'string',
7136
- description: "How this row matched: 'exact' > 'prefix' > 'substring'",
7137
- enum: ['exact', 'prefix', 'substring']
7511
+ example: 'Bank'
7138
7512
  }
7139
7513
  },
7140
- required: [
7141
- 'id',
7142
- 'name',
7143
- 'canonical',
7144
- 'type',
7145
- 'suggestedSegment',
7146
- 'logoUrl',
7147
- 'countryCode',
7148
- 'category',
7149
- 'matchType'
7150
- ]
7514
+ required: ['id', 'name', 'canonical', 'suggestedSegment', 'type', 'category']
7151
7515
  } as const;
7152
7516
 
7153
- export const $PlatformMatchResponseDto = {
7517
+ export const $PlatformStandardsResponseDto = {
7154
7518
  type: 'object',
7155
7519
  properties: {
7156
- platforms: {
7157
- description: 'Ranked matches, best tier first (at most 10 rows)',
7158
- type: 'array',
7159
- items: {
7160
- $ref: '#/components/schemas/PlatformMatchResultDto'
7161
- }
7520
+ platform: {
7521
+ description: 'The selected platform (institution lock source)',
7522
+ allOf: [
7523
+ {
7524
+ $ref: '#/components/schemas/PlatformStandardsPlatformDto'
7525
+ }
7526
+ ]
7162
7527
  },
7163
- matchType: {
7528
+ region: {
7164
7529
  type: 'string',
7165
7530
  description:
7166
- "Overall match quality — top row's tier, or 'none' when no hits",
7167
- enum: ['none', 'exact', 'prefix', 'substring']
7168
- },
7169
- total: {
7170
- type: 'number',
7171
- description: 'Total matches before LIMIT (truncation transparency)'
7531
+ "Resolved template region (ISO 3166-1 alpha-2, UPPERCASE): the platform's own countryCode when set, else the region query param. For regions without a regional template file the template list falls back to the universal-only catalog while region still echoes the code.",
7532
+ example: 'CN'
7172
7533
  },
7173
- hasMore: {
7174
- type: 'boolean',
7175
- description: 'true when total > platforms.length (more matches exist)'
7534
+ templates: {
7535
+ description:
7536
+ 'Candidate account-standard templates of the resolved region (groupable by productCategory client-side)',
7537
+ type: 'array',
7538
+ items: {
7539
+ $ref: '#/components/schemas/AccountStandardResponseDto'
7540
+ }
7176
7541
  }
7177
7542
  },
7178
- required: ['platforms', 'matchType', 'total', 'hasMore']
7543
+ required: ['platform', 'region', 'templates']
7179
7544
  } as const;
7180
7545
 
7181
7546
  export const $CreatePlatformDto = {
@@ -7279,7 +7644,8 @@ export const $UpdatePlatformDto = {
7279
7644
  },
7280
7645
  isActive: {
7281
7646
  type: 'boolean',
7282
- description: 'Whether the platform is active'
7647
+ description: 'Whether the platform is active',
7648
+ default: true
7283
7649
  }
7284
7650
  }
7285
7651
  } as const;
@@ -7442,7 +7808,8 @@ export const $AccountItemDto = {
7442
7808
  },
7443
7809
  displayName: {
7444
7810
  type: 'string',
7445
- description: 'Display name (last part of account path)',
7811
+ description:
7812
+ 'Display name: user-set name if provided (#762), else the ADR-0114 chain — request-locale catalog name, en pivot, then the last part of the account path (#771)',
7446
7813
  example: 'Savings'
7447
7814
  },
7448
7815
  balance: {
@@ -7478,7 +7845,8 @@ export const $PlatformGroupDto = {
7478
7845
  example: 'CMB Bank'
7479
7846
  },
7480
7847
  accounts: {
7481
- description: 'Accounts within this platform',
7848
+ description:
7849
+ 'Accounts within this platform (Assets and Liabilities rows, #696)',
7482
7850
  type: 'array',
7483
7851
  items: {
7484
7852
  $ref: '#/components/schemas/AccountItemDto'
@@ -7486,7 +7854,8 @@ export const $PlatformGroupDto = {
7486
7854
  },
7487
7855
  totalBalance: {
7488
7856
  type: 'string',
7489
- description: 'FX-converted total balance in base currency',
7857
+ description:
7858
+ 'FX-converted total balance in base currency (nets Assets + Liabilities rows; can be negative)',
7490
7859
  example: '100000.00'
7491
7860
  },
7492
7861
  balanceByCurrency: {
@@ -7505,7 +7874,7 @@ export const $PlatformGroupDto = {
7505
7874
  sharePct: {
7506
7875
  type: 'number',
7507
7876
  description:
7508
- 'Share of the grand converted total (0-100); 0 when grand total is 0',
7877
+ 'Share of the converted asset-side grand total (0-100); liability balances are excluded from the basis; 0 when grand total is 0 (#696)',
7509
7878
  example: 42.5
7510
7879
  }
7511
7880
  },
@@ -7553,7 +7922,8 @@ export const $AccountsSummaryDto = {
7553
7922
  properties: {
7554
7923
  totalAccounts: {
7555
7924
  type: 'number',
7556
- description: 'Total number of accounts'
7925
+ description:
7926
+ 'Total number of accounts (balance sheet: Assets + Liabilities, #696)'
7557
7927
  },
7558
7928
  totalPlatforms: {
7559
7929
  type: 'number',
@@ -7611,7 +7981,8 @@ export const $AccountItemWithAssetClassDto = {
7611
7981
  },
7612
7982
  displayName: {
7613
7983
  type: 'string',
7614
- description: 'Display name (last part of account path)',
7984
+ description:
7985
+ 'Display name: user-set name if provided (#762), else the ADR-0114 chain — request-locale catalog name, en pivot, then the last part of the account path (#771)',
7615
7986
  example: 'Savings'
7616
7987
  },
7617
7988
  balance: {
@@ -8097,7 +8468,7 @@ export const $MonetaryDto = {
8097
8468
  example: 'USD'
8098
8469
  },
8099
8470
  baseCcyEquivalent: {
8100
- type: 'object',
8471
+ type: 'string',
8101
8472
  description: 'Converted to user base currency (Decimal string)',
8102
8473
  example: '21600',
8103
8474
  nullable: true
@@ -8173,13 +8544,13 @@ export const $HoldingPnlRowDto = {
8173
8544
  example: 'Assets:US:Broker:AAPL'
8174
8545
  },
8175
8546
  accountCcy: {
8176
- type: 'object',
8547
+ type: 'string',
8177
8548
  description: 'Account settlement currency (ISO 4217), from cost currency',
8178
8549
  nullable: true,
8179
8550
  example: 'USD'
8180
8551
  },
8181
8552
  brokerType: {
8182
- type: 'object',
8553
+ type: 'string',
8183
8554
  description: 'Broker type derived from Platform.type',
8184
8555
  nullable: true,
8185
8556
  example: 'broker'
@@ -8200,7 +8571,7 @@ export const $HoldingPnlRowDto = {
8200
8571
  example: 'EQUITY'
8201
8572
  },
8202
8573
  assetSubClass: {
8203
- type: 'object',
8574
+ type: 'string',
8204
8575
  nullable: true,
8205
8576
  example: 'STOCK'
8206
8577
  },
@@ -8247,14 +8618,14 @@ export const $HoldingPnlRowDto = {
8247
8618
  ]
8248
8619
  },
8249
8620
  unrealizedPnlBase: {
8250
- type: 'object',
8621
+ type: 'string',
8251
8622
  description:
8252
8623
  'Unrealized P&L in base currency (Decimal string); null when any FX/price missing',
8253
8624
  nullable: true,
8254
8625
  example: '6000'
8255
8626
  },
8256
8627
  unrealizedPnlPct: {
8257
- type: 'object',
8628
+ type: 'string',
8258
8629
  description: 'Unrealized P&L % (Decimal string)',
8259
8630
  nullable: true,
8260
8631
  example: '25'
@@ -8278,7 +8649,7 @@ export const $HoldingPnlRowDto = {
8278
8649
  ]
8279
8650
  },
8280
8651
  pctOfInvestedAssets: {
8281
- type: 'object',
8652
+ type: 'string',
8282
8653
  description:
8283
8654
  'Share of invested assets % (Decimal string); only for invested chartTokens',
8284
8655
  nullable: true,
@@ -8323,15 +8694,15 @@ export const $HoldingPnlWarningDto = {
8323
8694
  ]
8324
8695
  },
8325
8696
  symbol: {
8326
- type: 'object',
8697
+ type: 'string',
8327
8698
  nullable: true
8328
8699
  },
8329
8700
  accountId: {
8330
- type: 'object',
8701
+ type: 'string',
8331
8702
  nullable: true
8332
8703
  },
8333
8704
  currency: {
8334
- type: 'object',
8705
+ type: 'string',
8335
8706
  nullable: true
8336
8707
  }
8337
8708
  },
@@ -8395,6 +8766,216 @@ export const $AnonymousLoginResponseDto = {
8395
8766
  required: ['authToken']
8396
8767
  } as const;
8397
8768
 
8769
+ export const $ParserContributionMetaDto = {
8770
+ type: 'object',
8771
+ properties: {
8772
+ institution: {
8773
+ type: 'string',
8774
+ description: 'Institution slug (lowercase kebab-case)',
8775
+ pattern: '^[a-z0-9]+(-[a-z0-9]+)*$',
8776
+ example: 'icbc'
8777
+ },
8778
+ region: {
8779
+ type: 'string',
8780
+ enum: [
8781
+ 'cn',
8782
+ 'us',
8783
+ 'de',
8784
+ 'fr',
8785
+ 'gb',
8786
+ 'hk',
8787
+ 'jp',
8788
+ 'sg',
8789
+ 'au',
8790
+ 'ca',
8791
+ 'other'
8792
+ ]
8793
+ },
8794
+ accountType: {
8795
+ type: 'string',
8796
+ enum: ['checking', 'savings', 'credit', 'debit', 'investment']
8797
+ },
8798
+ format: {
8799
+ type: 'string',
8800
+ enum: ['csv', 'xlsx', 'pdf', 'ofx', 'qif']
8801
+ },
8802
+ institutionDisplayName: {
8803
+ type: 'string',
8804
+ example: '中国工商银行'
8805
+ },
8806
+ encoding: {
8807
+ type: 'string',
8808
+ example: 'utf-8'
8809
+ },
8810
+ delimiter: {
8811
+ type: 'string',
8812
+ description: 'CSV delimiter character: ",", ";", "\\t" or "|"'
8813
+ },
8814
+ headerRows: {
8815
+ type: 'number',
8816
+ default: 1,
8817
+ description: 'Header row count; the client omits the field when it is 1'
8818
+ },
8819
+ notes: {
8820
+ type: 'string',
8821
+ maxLength: 2000
8822
+ }
8823
+ },
8824
+ required: ['institution', 'region', 'accountType', 'format']
8825
+ } as const;
8826
+
8827
+ export const $ParserContributionSamplesDto = {
8828
+ type: 'object',
8829
+ properties: {
8830
+ rows: {
8831
+ description:
8832
+ 'Client-sanitized sample rows (key = column name, value = cell)',
8833
+ type: 'array',
8834
+ items: {
8835
+ type: 'object'
8836
+ }
8837
+ },
8838
+ rawHeaders: {
8839
+ type: 'array',
8840
+ items: {
8841
+ type: 'string'
8842
+ }
8843
+ }
8844
+ },
8845
+ required: ['rows']
8846
+ } as const;
8847
+
8848
+ export const $FieldHintDto = {
8849
+ type: 'object',
8850
+ properties: {
8851
+ columnName: {
8852
+ type: 'string',
8853
+ example: '交易日期'
8854
+ },
8855
+ format: {
8856
+ type: 'string',
8857
+ description: 'Date format, e.g. yyyy-MM-dd HH:mm',
8858
+ example: 'yyyy-MM-dd'
8859
+ },
8860
+ signConvention: {
8861
+ type: 'string',
8862
+ enum: ['negative-expense', 'positive-expense', 'separate-columns']
8863
+ },
8864
+ creditColumn: {
8865
+ type: 'string'
8866
+ },
8867
+ debitColumn: {
8868
+ type: 'string'
8869
+ }
8870
+ },
8871
+ required: ['columnName']
8872
+ } as const;
8873
+
8874
+ export const $ParserContributionFieldHintsDto = {
8875
+ type: 'object',
8876
+ properties: {
8877
+ date: {
8878
+ $ref: '#/components/schemas/FieldHintDto'
8879
+ },
8880
+ amount: {
8881
+ $ref: '#/components/schemas/FieldHintDto'
8882
+ },
8883
+ description: {
8884
+ $ref: '#/components/schemas/FieldHintDto'
8885
+ },
8886
+ balance: {
8887
+ $ref: '#/components/schemas/FieldHintDto'
8888
+ },
8889
+ payee: {
8890
+ $ref: '#/components/schemas/FieldHintDto'
8891
+ },
8892
+ reference: {
8893
+ $ref: '#/components/schemas/FieldHintDto'
8894
+ },
8895
+ category: {
8896
+ $ref: '#/components/schemas/FieldHintDto'
8897
+ }
8898
+ },
8899
+ required: ['date', 'amount']
8900
+ } as const;
8901
+
8902
+ export const $ExpectedTransactionDto = {
8903
+ type: 'object',
8904
+ properties: {
8905
+ date: {
8906
+ type: 'string',
8907
+ example: '2026-08-01'
8908
+ },
8909
+ amount: {
8910
+ type: 'number',
8911
+ example: -45.5
8912
+ },
8913
+ description: {
8914
+ type: 'string',
8915
+ example: '星巴克-***店'
8916
+ },
8917
+ payee: {
8918
+ type: 'string'
8919
+ },
8920
+ category: {
8921
+ type: 'string'
8922
+ }
8923
+ },
8924
+ required: ['date', 'amount', 'description']
8925
+ } as const;
8926
+
8927
+ export const $ParserContributionExamplesDto = {
8928
+ type: 'object',
8929
+ properties: {
8930
+ expectedTransactions: {
8931
+ type: 'array',
8932
+ items: {
8933
+ $ref: '#/components/schemas/ExpectedTransactionDto'
8934
+ }
8935
+ }
8936
+ },
8937
+ required: ['expectedTransactions']
8938
+ } as const;
8939
+
8940
+ export const $ParserContributionRequestDto = {
8941
+ type: 'object',
8942
+ properties: {
8943
+ meta: {
8944
+ $ref: '#/components/schemas/ParserContributionMetaDto'
8945
+ },
8946
+ samples: {
8947
+ $ref: '#/components/schemas/ParserContributionSamplesDto'
8948
+ },
8949
+ fieldHints: {
8950
+ $ref: '#/components/schemas/ParserContributionFieldHintsDto'
8951
+ },
8952
+ examples: {
8953
+ description: 'Omitted entirely by the client when empty',
8954
+ allOf: [
8955
+ {
8956
+ $ref: '#/components/schemas/ParserContributionExamplesDto'
8957
+ }
8958
+ ]
8959
+ }
8960
+ },
8961
+ required: ['meta', 'samples', 'fieldHints']
8962
+ } as const;
8963
+
8964
+ export const $ParserContributionRelayResponseDto = {
8965
+ type: 'object',
8966
+ properties: {
8967
+ issueUrl: {
8968
+ type: 'string',
8969
+ example: 'https://github.com/fire-zu/firela-vlt/issues/42'
8970
+ },
8971
+ issueNumber: {
8972
+ type: 'number',
8973
+ example: 42
8974
+ }
8975
+ },
8976
+ required: ['issueUrl', 'issueNumber']
8977
+ } as const;
8978
+
8398
8979
  export const $SymbolSearchResultDto = {
8399
8980
  type: 'object',
8400
8981
  properties: {
@@ -8403,35 +8984,35 @@ export const $SymbolSearchResultDto = {
8403
8984
  example: 'AAPL'
8404
8985
  },
8405
8986
  name: {
8406
- type: 'object',
8987
+ type: 'string',
8407
8988
  example: 'Apple Inc.',
8408
8989
  nullable: true
8409
8990
  },
8410
8991
  exchange: {
8411
- type: 'object',
8992
+ type: 'string',
8412
8993
  example: 'US',
8413
8994
  nullable: true
8414
8995
  },
8415
8996
  assetType: {
8416
- type: 'object',
8997
+ type: 'string',
8417
8998
  description: 'OpenBB asset_type (e.g. stock, etf)',
8418
8999
  example: 'stock',
8419
9000
  nullable: true
8420
9001
  },
8421
9002
  assetClass: {
8422
- type: 'object',
9003
+ type: 'string',
8423
9004
  description: 'IGN asset class (region.types.ts ASSET_CLASSES)',
8424
9005
  example: 'EQUITY',
8425
9006
  nullable: true
8426
9007
  },
8427
9008
  assetSubClass: {
8428
- type: 'object',
9009
+ type: 'string',
8429
9010
  description: 'IGN asset sub-class (region.types.ts ASSET_SUB_CLASSES)',
8430
9011
  example: 'STOCK',
8431
9012
  nullable: true
8432
9013
  },
8433
9014
  currency: {
8434
- type: 'object',
9015
+ type: 'string',
8435
9016
  description: 'Trading currency (extra_data or inferred from exchange)',
8436
9017
  example: 'USD',
8437
9018
  nullable: true
@@ -8448,90 +9029,90 @@ export const $SymbolQuoteDto = {
8448
9029
  example: 'AAPL'
8449
9030
  },
8450
9031
  name: {
8451
- type: 'object',
9032
+ type: 'string',
8452
9033
  example: 'Apple Inc.',
8453
9034
  nullable: true
8454
9035
  },
8455
9036
  exchange: {
8456
- type: 'object',
9037
+ type: 'string',
8457
9038
  example: 'US',
8458
9039
  nullable: true
8459
9040
  },
8460
9041
  assetType: {
8461
- type: 'object',
9042
+ type: 'string',
8462
9043
  description: 'OpenBB asset_type',
8463
9044
  example: 'stock',
8464
9045
  nullable: true
8465
9046
  },
8466
9047
  assetClass: {
8467
- type: 'object',
9048
+ type: 'string',
8468
9049
  description: 'IGN asset class',
8469
9050
  example: 'EQUITY',
8470
9051
  nullable: true
8471
9052
  },
8472
9053
  assetSubClass: {
8473
- type: 'object',
9054
+ type: 'string',
8474
9055
  description: 'IGN asset sub-class',
8475
9056
  example: 'STOCK',
8476
9057
  nullable: true
8477
9058
  },
8478
9059
  currency: {
8479
- type: 'object',
9060
+ type: 'string',
8480
9061
  description: 'Trading currency (extra_data or inferred from exchange)',
8481
9062
  example: 'USD',
8482
9063
  nullable: true
8483
9064
  },
8484
9065
  price: {
8485
- type: 'object',
9066
+ type: 'string',
8486
9067
  description: 'Latest price (Decimal string)',
8487
9068
  example: '189.84',
8488
9069
  nullable: true
8489
9070
  },
8490
9071
  priceDate: {
8491
- type: 'object',
9072
+ type: 'string',
8492
9073
  description: 'Date the price was observed (ISO yyyy-MM-dd)',
8493
9074
  example: '2026-08-05',
8494
9075
  nullable: true
8495
9076
  },
8496
9077
  changePercent: {
8497
- type: 'object',
9078
+ type: 'number',
8498
9079
  description:
8499
9080
  'Change vs previous close, in percentage points (1.7 == 1.7%). openbb stores change_percent as a normalized decimal; this exposes percentage points for frontend convenience.',
8500
9081
  example: 1.7,
8501
9082
  nullable: true
8502
9083
  },
8503
9084
  prevClose: {
8504
- type: 'object',
9085
+ type: 'string',
8505
9086
  description: 'Previous close (Decimal string)',
8506
9087
  nullable: true
8507
9088
  },
8508
9089
  open: {
8509
- type: 'object',
9090
+ type: 'string',
8510
9091
  description: 'Day open (Decimal string)',
8511
9092
  nullable: true
8512
9093
  },
8513
9094
  high: {
8514
- type: 'object',
9095
+ type: 'string',
8515
9096
  description: 'Day high (Decimal string)',
8516
9097
  nullable: true
8517
9098
  },
8518
9099
  low: {
8519
- type: 'object',
9100
+ type: 'string',
8520
9101
  description: 'Day low (Decimal string)',
8521
9102
  nullable: true
8522
9103
  },
8523
9104
  volume: {
8524
- type: 'object',
9105
+ type: 'string',
8525
9106
  description: 'Day volume (Decimal string)',
8526
9107
  nullable: true
8527
9108
  },
8528
9109
  yearHigh: {
8529
- type: 'object',
9110
+ type: 'string',
8530
9111
  description: '52-week high (Decimal string)',
8531
9112
  nullable: true
8532
9113
  },
8533
9114
  yearLow: {
8534
- type: 'object',
9115
+ type: 'string',
8535
9116
  description: '52-week low (Decimal string)',
8536
9117
  nullable: true
8537
9118
  }