@firela/api-types 0.0.0-canary.30542238 → 0.0.0-canary.3154c0bf

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 = {
@@ -1951,13 +2004,17 @@ export const $ReviewStatsDto = {
1951
2004
  type: 'object',
1952
2005
  description: 'Count by type'
1953
2006
  },
2007
+ resolved: {
2008
+ type: 'number',
2009
+ description: 'Current count of reviews in RESOLVED status'
2010
+ },
1954
2011
  oldestPending: {
1955
2012
  format: 'date-time',
1956
2013
  type: 'string',
1957
2014
  description: 'Oldest pending review date'
1958
2015
  }
1959
2016
  },
1960
- required: ['total', 'byType']
2017
+ required: ['total', 'byType', 'resolved']
1961
2018
  } as const;
1962
2019
 
1963
2020
  export const $DecisionOptionDto = {
@@ -2262,6 +2319,44 @@ export const $BatchResolveDto = {
2262
2319
  required: ['reviewIds', 'action']
2263
2320
  } as const;
2264
2321
 
2322
+ export const $BatchResolveItemDto = {
2323
+ type: 'object',
2324
+ properties: {
2325
+ reviewId: {
2326
+ type: 'string',
2327
+ description: 'Review item ID'
2328
+ },
2329
+ success: {
2330
+ type: 'boolean',
2331
+ description: 'Whether this item was resolved successfully'
2332
+ },
2333
+ resolutionId: {
2334
+ type: 'string',
2335
+ description:
2336
+ 'Resolution ID for undo. Present only on successful items (failed items stay PENDING).'
2337
+ },
2338
+ messageKey: {
2339
+ type: 'string',
2340
+ description:
2341
+ 'i18n message key for the per-item failure reason (e.g., review.payee.error.no_suggestion), mirroring the single-item resolve response. Present only on resolver rejections, not on unexpected errors.'
2342
+ },
2343
+ messageParams: {
2344
+ type: 'object',
2345
+ description:
2346
+ 'Parameters for message interpolation (e.g., { name: "PayeeName" })',
2347
+ additionalProperties: {
2348
+ type: 'string'
2349
+ }
2350
+ },
2351
+ error: {
2352
+ type: 'string',
2353
+ description:
2354
+ 'Diagnostic string: the messageKey on the resolver-rejection path; an i18n key mapped from the exception type on the unexpected-error path (#903, raw exception detail stays in server logs).'
2355
+ }
2356
+ },
2357
+ required: ['reviewId', 'success']
2358
+ } as const;
2359
+
2265
2360
  export const $BatchResolveResultDto = {
2266
2361
  type: 'object',
2267
2362
  properties: {
@@ -2277,7 +2372,7 @@ export const $BatchResolveResultDto = {
2277
2372
  description: 'Details for each item',
2278
2373
  type: 'array',
2279
2374
  items: {
2280
- type: 'string'
2375
+ $ref: '#/components/schemas/BatchResolveItemDto'
2281
2376
  }
2282
2377
  }
2283
2378
  },
@@ -2510,10 +2605,10 @@ export const $UpdatePayeeDto = {
2510
2605
  meta: {
2511
2606
  type: 'object',
2512
2607
  description:
2513
- 'Metadata for extended information (location, notes, contact info, etc.). Will merge with existing metadata.',
2608
+ 'Metadata for extended information (location, notes, contact info, etc.)',
2514
2609
  example: {
2515
2610
  location: 'Zhongguancun',
2516
- note: 'Updated note',
2611
+ note: 'Near subway station',
2517
2612
  favorite: true
2518
2613
  }
2519
2614
  },
@@ -3074,568 +3169,660 @@ export const $UpdateCommodityDto = {
3074
3169
  }
3075
3170
  } as const;
3076
3171
 
3077
- export const $CreateBeanPriceDto = {
3172
+ export const $CurrencyBalanceDto = {
3078
3173
  type: 'object',
3079
3174
  properties: {
3080
3175
  currency: {
3081
3176
  type: 'string',
3082
- description: 'Currency being priced (e.g., USD, AAPL, BTC)',
3083
- example: 'USD'
3084
- },
3085
- quoteCurrency: {
3086
- type: 'string',
3087
- description: 'Quote currency (pricing currency, e.g., CNY, EUR)',
3177
+ description: 'ISO 4217 currency code',
3088
3178
  example: 'CNY'
3089
3179
  },
3090
- amount: {
3091
- type: 'number',
3092
- description:
3093
- 'Price amount (MUST be >= 0 per Beancount spec, supports up to 15 decimal places). Zero allowed for conversion entries, negative strictly prohibited.',
3094
- example: 175.5,
3095
- minimum: 0
3096
- },
3097
- date: {
3180
+ balance: {
3098
3181
  type: 'string',
3099
- description: 'Price date (ISO 8601 format)',
3100
- example: '2024-11-05'
3101
- },
3102
- metadata: {
3103
- type: 'object',
3104
- description:
3105
- 'Metadata (validated by Zod schema, max field lengths enforced)',
3106
- example: {
3107
- source: 'MANUAL',
3108
- note: 'Bank valuation report',
3109
- confidence: 0.95
3110
- }
3182
+ description: 'Balance amount',
3183
+ example: '500000.00'
3111
3184
  }
3112
3185
  },
3113
- required: ['currency', 'quoteCurrency', 'amount', 'date']
3186
+ required: ['currency', 'balance']
3114
3187
  } as const;
3115
3188
 
3116
- export const $PriceResponseDto = {
3189
+ export const $TimeSeriesPointDto = {
3117
3190
  type: 'object',
3118
3191
  properties: {
3119
- id: {
3192
+ date: {
3120
3193
  type: 'string',
3121
- description: 'Unique identifier',
3122
- example: 'uuid-123-456'
3194
+ description: 'Date in YYYY-MM-DD format',
3195
+ example: '2024-06-15'
3123
3196
  },
3124
- userId: {
3197
+ value: {
3125
3198
  type: 'string',
3126
- description: 'User ID (owner of the price)',
3127
- example: 'user-123'
3199
+ description: 'Value at this date (in base currency)',
3200
+ example: '500000.00'
3128
3201
  },
3129
- currency: {
3202
+ change: {
3130
3203
  type: 'string',
3131
- description: 'Currency being priced (e.g., USD, AAPL, BTC)',
3132
- example: 'BTC'
3204
+ description: 'Change from previous point',
3205
+ example: '5000.00'
3133
3206
  },
3134
- quoteCurrency: {
3207
+ assets: {
3135
3208
  type: 'string',
3136
- description: 'Quote currency (pricing currency, e.g., USD, CNY)',
3137
- example: 'USD'
3138
- },
3139
- amount: {
3140
- type: 'number',
3141
- description:
3142
- 'Price amount (corresponds to Beancount Amount.number). Supports up to 15 decimal places.',
3143
- example: 50000
3209
+ description: 'Total assets at this date (in base currency)',
3210
+ example: '494338.00'
3144
3211
  },
3145
- date: {
3212
+ liabilities: {
3146
3213
  type: 'string',
3147
- description:
3148
- 'Price date (ISO 8601 format). Represents the date this price was valid.',
3149
- example: '2024-01-01',
3150
- format: 'date'
3214
+ description: 'Total liabilities at this date (in base currency)',
3215
+ example: '310098.00'
3151
3216
  },
3152
- meta: {
3153
- type: 'object',
3154
- description:
3155
- 'Metadata (corresponds to Beancount meta field). Contains source, confidence, note, etc.',
3156
- example: {
3157
- source: 'MANUAL',
3158
- note: 'User-defined price',
3159
- confidence: 1
3217
+ byCurrency: {
3218
+ description: 'Multi-currency breakdown for this point',
3219
+ type: 'array',
3220
+ items: {
3221
+ $ref: '#/components/schemas/CurrencyBalanceDto'
3160
3222
  }
3223
+ }
3224
+ },
3225
+ required: ['date', 'value']
3226
+ } as const;
3227
+
3228
+ export const $TrendSummaryDto = {
3229
+ type: 'object',
3230
+ properties: {
3231
+ startValue: {
3232
+ type: 'string',
3233
+ description: 'Value at start of period',
3234
+ example: '450000.00'
3161
3235
  },
3162
- createdAt: {
3163
- format: 'date-time',
3236
+ endValue: {
3164
3237
  type: 'string',
3165
- description: 'Creation timestamp',
3166
- example: '2024-11-03T10:00:00Z'
3238
+ description: 'Value at end of period',
3239
+ example: '500000.00'
3167
3240
  },
3168
- updatedAt: {
3169
- format: 'date-time',
3241
+ totalChange: {
3170
3242
  type: 'string',
3171
- description: 'Last update timestamp',
3172
- example: '2024-11-03T10:00:00Z'
3243
+ description: 'Total change over period',
3244
+ example: '50000.00'
3245
+ },
3246
+ totalChangePercentage: {
3247
+ type: 'string',
3248
+ description: 'Total change percentage',
3249
+ example: '+11.11%'
3173
3250
  }
3174
3251
  },
3175
- required: [
3176
- 'id',
3177
- 'userId',
3178
- 'currency',
3179
- 'quoteCurrency',
3180
- 'amount',
3181
- 'date',
3182
- 'meta',
3183
- 'createdAt',
3184
- 'updatedAt'
3185
- ]
3252
+ required: ['startValue', 'endValue', 'totalChange', 'totalChangePercentage']
3186
3253
  } as const;
3187
3254
 
3188
- export const $PriceListResponseDto = {
3255
+ export const $MultiCurrencyPointDto = {
3189
3256
  type: 'object',
3190
3257
  properties: {
3191
- items: {
3192
- description: 'List of prices',
3258
+ date: {
3259
+ type: 'string',
3260
+ description: 'Date in YYYY-MM-DD format',
3261
+ example: '2024-06-15'
3262
+ },
3263
+ byCurrency: {
3264
+ description: 'Balances by currency',
3193
3265
  type: 'array',
3194
3266
  items: {
3195
- $ref: '#/components/schemas/PriceResponseDto'
3267
+ $ref: '#/components/schemas/CurrencyBalanceDto'
3196
3268
  }
3197
- },
3198
- total: {
3199
- type: 'number',
3200
- description: 'Total number of prices',
3201
- example: 42
3202
3269
  }
3203
3270
  },
3204
- required: ['items', 'total']
3271
+ required: ['date', 'byCurrency']
3205
3272
  } as const;
3206
3273
 
3207
- export const $UpdateBeanPriceDto = {
3274
+ export const $PortfolioTrendsResponseDto = {
3208
3275
  type: 'object',
3209
3276
  properties: {
3210
- currency: {
3211
- type: 'string',
3212
- description: 'Currency being priced'
3213
- },
3214
- quoteCurrency: {
3215
- type: 'string',
3216
- description: 'Quote currency (pricing currency)'
3277
+ series: {
3278
+ description: 'Time series data points',
3279
+ type: 'array',
3280
+ items: {
3281
+ $ref: '#/components/schemas/TimeSeriesPointDto'
3282
+ }
3217
3283
  },
3218
- amount: {
3219
- type: 'number',
3220
- description: 'Price amount (MUST be >= 0 per Beancount spec)',
3221
- minimum: 0
3284
+ summary: {
3285
+ description: 'Period summary',
3286
+ allOf: [
3287
+ {
3288
+ $ref: '#/components/schemas/TrendSummaryDto'
3289
+ }
3290
+ ]
3222
3291
  },
3223
- date: {
3292
+ period: {
3224
3293
  type: 'string',
3225
- description: 'Price date (ISO 8601 format)'
3294
+ description: 'Period requested',
3295
+ example: '6m'
3226
3296
  },
3227
- metadata: {
3228
- type: 'object',
3229
- description: 'Metadata'
3297
+ granularity: {
3298
+ type: 'string',
3299
+ description: 'Data granularity',
3300
+ example: 'month'
3301
+ },
3302
+ currency: {
3303
+ type: 'string',
3304
+ description: 'Base currency for converted values',
3305
+ example: 'CNY'
3306
+ },
3307
+ byCurrency: {
3308
+ description:
3309
+ 'Multi-currency time series (each point has currency breakdown)',
3310
+ type: 'array',
3311
+ items: {
3312
+ $ref: '#/components/schemas/MultiCurrencyPointDto'
3313
+ }
3314
+ },
3315
+ warnings: {
3316
+ description: 'Exchange rate warnings',
3317
+ type: 'array',
3318
+ items: {
3319
+ $ref: '#/components/schemas/ExchangeRateWarningDto'
3320
+ }
3230
3321
  }
3231
- }
3322
+ },
3323
+ required: ['series', 'summary', 'period', 'granularity', 'currency']
3232
3324
  } as const;
3233
3325
 
3234
- export const $CreateRecurringRuleDto = {
3326
+ export const $CashFlowPointDto = {
3235
3327
  type: 'object',
3236
3328
  properties: {
3237
- name: {
3329
+ month: {
3238
3330
  type: 'string',
3239
- description: 'Rule name (unique per user)',
3240
- maxLength: 100
3331
+ description: 'Month key (YYYY-MM)',
3332
+ example: '2024-03'
3241
3333
  },
3242
- icon: {
3334
+ income: {
3243
3335
  type: 'string',
3244
- description: 'Icon emoji',
3245
- maxLength: 10
3336
+ description: 'Income in base currency (absolute, converted)',
3337
+ example: '10000.00'
3246
3338
  },
3247
- frequency: {
3339
+ expense: {
3248
3340
  type: 'string',
3249
- description: 'Recurring frequency',
3250
- enum: [
3251
- 'WEEKLY',
3252
- 'BIWEEKLY',
3253
- 'MONTHLY',
3254
- 'BIMONTHLY',
3255
- 'QUARTERLY',
3256
- 'YEARLY',
3257
- 'CUSTOM'
3258
- ]
3259
- },
3260
- expectedAmount: {
3261
- type: 'number',
3262
- description: 'Expected amount (positive number)',
3263
- minimum: 0
3341
+ description: 'Expense in base currency (absolute, converted)',
3342
+ example: '5000.00'
3264
3343
  },
3265
- expectedDay: {
3266
- type: 'number',
3267
- description: 'Expected day of month (1-31)',
3268
- minimum: 1,
3269
- maximum: 31
3344
+ netSavings: {
3345
+ type: 'string',
3346
+ description: 'netSavings = income − expense (savings positive)',
3347
+ example: '5000.00'
3348
+ }
3349
+ },
3350
+ required: ['month', 'income', 'expense', 'netSavings']
3351
+ } as const;
3352
+
3353
+ export const $CashFlowTrendSummaryDto = {
3354
+ type: 'object',
3355
+ properties: {
3356
+ totalIncome: {
3357
+ type: 'string',
3358
+ description: 'Total income across the period',
3359
+ example: '60000.00'
3270
3360
  },
3271
- customIntervalDays: {
3272
- type: 'number',
3273
- description: 'Custom interval in days (required for CUSTOM frequency)',
3274
- minimum: 1
3361
+ totalExpense: {
3362
+ type: 'string',
3363
+ description: 'Total expense across the period',
3364
+ example: '30000.00'
3275
3365
  },
3276
- currency: {
3366
+ totalNetSavings: {
3277
3367
  type: 'string',
3278
- description: 'Currency code',
3279
- default: 'CNY',
3280
- maxLength: 10
3368
+ description: 'income − expense across the period',
3369
+ example: '30000.00'
3281
3370
  },
3282
- matchPayeePattern: {
3371
+ averageMonthlyNetSavings: {
3283
3372
  type: 'string',
3284
- description: 'Payee matching pattern (supports wildcards)',
3285
- maxLength: 200
3373
+ description:
3374
+ 'totalNetSavings divided by the window length (N months, incl. zero-filled)',
3375
+ example: '5000.00'
3376
+ }
3377
+ },
3378
+ required: [
3379
+ 'totalIncome',
3380
+ 'totalExpense',
3381
+ 'totalNetSavings',
3382
+ 'averageMonthlyNetSavings'
3383
+ ]
3384
+ } as const;
3385
+
3386
+ export const $CashFlowTrendsResponseDto = {
3387
+ type: 'object',
3388
+ properties: {
3389
+ series: {
3390
+ description:
3391
+ 'Monthly cash-flow series (fixed N-month window, zero-filled)',
3392
+ type: 'array',
3393
+ items: {
3394
+ $ref: '#/components/schemas/CashFlowPointDto'
3395
+ }
3286
3396
  },
3287
- matchAmountTolerance: {
3288
- type: 'number',
3289
- description: 'Amount tolerance percentage (0-1)',
3290
- default: 0.075,
3291
- minimum: 0,
3292
- maximum: 1
3397
+ summary: {
3398
+ description: 'Period totals',
3399
+ allOf: [
3400
+ {
3401
+ $ref: '#/components/schemas/CashFlowTrendSummaryDto'
3402
+ }
3403
+ ]
3293
3404
  },
3294
- defaultExpenseAccount: {
3405
+ period: {
3295
3406
  type: 'string',
3296
- description: 'Default expense account for auto-create',
3297
- maxLength: 200
3407
+ description: 'Period requested',
3408
+ example: '6m'
3298
3409
  },
3299
- defaultPaymentAccount: {
3410
+ granularity: {
3300
3411
  type: 'string',
3301
- description: 'Default payment account for auto-create',
3302
- maxLength: 200
3412
+ description: 'Data granularity (v1 returns month buckets)',
3413
+ example: 'month'
3303
3414
  },
3304
- defaultPayee: {
3415
+ currency: {
3305
3416
  type: 'string',
3306
- description: 'Default payee for auto-create',
3307
- maxLength: 200
3417
+ description: 'Base currency for converted values',
3418
+ example: 'CNY'
3308
3419
  },
3309
- autoCreate: {
3310
- type: 'boolean',
3311
- description: 'Auto-create transaction when expected date arrives',
3312
- default: false
3420
+ warnings: {
3421
+ description: 'Exchange rate warnings (e.g. missing rate for a currency)',
3422
+ type: 'array',
3423
+ items: {
3424
+ $ref: '#/components/schemas/ExchangeRateWarningDto'
3425
+ }
3426
+ }
3427
+ },
3428
+ required: ['series', 'summary', 'period', 'granularity', 'currency']
3429
+ } as const;
3430
+
3431
+ export const $GenerateSnapshotBody = {
3432
+ type: 'object',
3433
+ properties: {}
3434
+ } as const;
3435
+
3436
+ export const $GenerateSnapshotResponse = {
3437
+ type: 'object',
3438
+ properties: {}
3439
+ } as const;
3440
+
3441
+ export const $BackfillSnapshotsBody = {
3442
+ type: 'object',
3443
+ properties: {}
3444
+ } as const;
3445
+
3446
+ export const $BackfillSnapshotsResponse = {
3447
+ type: 'object',
3448
+ properties: {}
3449
+ } as const;
3450
+
3451
+ export const $CreateBeanPriceDto = {
3452
+ type: 'object',
3453
+ properties: {
3454
+ currency: {
3455
+ type: 'string',
3456
+ description: 'Currency being priced (e.g., USD, AAPL, BTC)',
3457
+ example: 'USD'
3313
3458
  },
3314
- startDate: {
3459
+ quoteCurrency: {
3315
3460
  type: 'string',
3316
- description: 'Rule start date (ISO format)'
3461
+ description: 'Quote currency (pricing currency, e.g., CNY, EUR)',
3462
+ example: 'CNY'
3317
3463
  },
3318
- endDate: {
3464
+ amount: {
3465
+ type: 'number',
3466
+ description:
3467
+ 'Price amount (MUST be >= 0 per Beancount spec, supports up to 15 decimal places). Zero allowed for conversion entries, negative strictly prohibited.',
3468
+ example: 175.5,
3469
+ minimum: 0
3470
+ },
3471
+ date: {
3319
3472
  type: 'string',
3320
- description: 'Rule end date (ISO format)'
3473
+ description: 'Price date (ISO 8601 format)',
3474
+ example: '2024-11-05'
3475
+ },
3476
+ metadata: {
3477
+ type: 'object',
3478
+ description:
3479
+ 'Metadata (validated by Zod schema, max field lengths enforced)',
3480
+ example: {
3481
+ source: 'MANUAL',
3482
+ note: 'Bank valuation report',
3483
+ confidence: 0.95
3484
+ }
3321
3485
  }
3322
3486
  },
3323
- required: [
3324
- 'name',
3325
- 'frequency',
3326
- 'expectedAmount',
3327
- 'currency',
3328
- 'matchAmountTolerance',
3329
- 'autoCreate'
3330
- ]
3487
+ required: ['currency', 'quoteCurrency', 'amount', 'date']
3331
3488
  } as const;
3332
3489
 
3333
- export const $RecurringRuleResponseDto = {
3490
+ export const $PriceResponseDto = {
3334
3491
  type: 'object',
3335
3492
  properties: {
3336
3493
  id: {
3337
3494
  type: 'string',
3338
- description: 'Rule ID'
3495
+ description: 'Unique identifier',
3496
+ example: 'uuid-123-456'
3339
3497
  },
3340
3498
  userId: {
3341
3499
  type: 'string',
3342
- description: 'User ID'
3500
+ description: 'User ID (owner of the price)',
3501
+ example: 'user-123'
3343
3502
  },
3344
- name: {
3503
+ currency: {
3345
3504
  type: 'string',
3346
- description: 'Rule name'
3347
- },
3348
- icon: {
3349
- type: 'object',
3350
- description: 'Icon emoji'
3505
+ description: 'Currency being priced (e.g., USD, AAPL, BTC)',
3506
+ example: 'BTC'
3351
3507
  },
3352
- frequency: {
3508
+ quoteCurrency: {
3353
3509
  type: 'string',
3354
- description: 'Recurring frequency'
3510
+ description: 'Quote currency (pricing currency, e.g., USD, CNY)',
3511
+ example: 'USD'
3355
3512
  },
3356
- expectedAmount: {
3357
- type: 'number',
3358
- description: 'Expected amount'
3359
- },
3360
- expectedDay: {
3361
- type: 'object',
3362
- description: 'Expected day of month'
3363
- },
3364
- customIntervalDays: {
3365
- type: 'object',
3366
- description: 'Custom interval in days'
3367
- },
3368
- currency: {
3369
- type: 'string',
3370
- description: 'Currency code'
3371
- },
3372
- matchPayeePattern: {
3373
- type: 'object',
3374
- description: 'Payee matching pattern'
3375
- },
3376
- matchAmountTolerance: {
3513
+ amount: {
3377
3514
  type: 'number',
3378
- description: 'Amount tolerance percentage'
3379
- },
3380
- defaultExpenseAccount: {
3381
- type: 'object',
3382
- description: 'Default expense account'
3383
- },
3384
- defaultPaymentAccount: {
3385
- type: 'object',
3386
- description: 'Default payment account'
3387
- },
3388
- defaultPayee: {
3389
- type: 'object',
3390
- description: 'Default payee'
3391
- },
3392
- isActive: {
3393
- type: 'boolean',
3394
- description: 'Whether rule is active'
3515
+ description:
3516
+ 'Price amount (corresponds to Beancount Amount.number). Supports up to 15 decimal places.',
3517
+ example: 50000
3395
3518
  },
3396
- startDate: {
3519
+ date: {
3397
3520
  type: 'string',
3398
- description: 'Rule start date (YYYY-MM-DD)'
3399
- },
3400
- endDate: {
3401
- type: 'object',
3402
- description: 'Rule end date (YYYY-MM-DD)'
3403
- },
3404
- autoCreate: {
3405
- type: 'boolean',
3406
- description: 'Auto-create transaction on expected date'
3521
+ description:
3522
+ 'Price date (ISO 8601 format). Represents the date this price was valid.',
3523
+ example: '2024-01-01',
3524
+ format: 'date'
3407
3525
  },
3408
- lastOccurrence: {
3526
+ meta: {
3409
3527
  type: 'object',
3410
- description: 'Last matched occurrence date (YYYY-MM-DD)'
3411
- },
3412
- totalCount: {
3413
- type: 'number',
3414
- description: 'Total matched transactions count'
3528
+ description:
3529
+ 'Metadata (corresponds to Beancount meta field). Contains source, confidence, note, etc.',
3530
+ example: {
3531
+ source: 'MANUAL',
3532
+ note: 'User-defined price',
3533
+ confidence: 1
3534
+ }
3415
3535
  },
3416
3536
  createdAt: {
3417
3537
  format: 'date-time',
3418
3538
  type: 'string',
3419
- description: 'Created at timestamp'
3539
+ description: 'Creation timestamp',
3540
+ example: '2024-11-03T10:00:00Z'
3420
3541
  },
3421
3542
  updatedAt: {
3422
3543
  format: 'date-time',
3423
3544
  type: 'string',
3424
- description: 'Updated at timestamp'
3545
+ description: 'Last update timestamp',
3546
+ example: '2024-11-03T10:00:00Z'
3425
3547
  }
3426
3548
  },
3427
3549
  required: [
3428
3550
  'id',
3429
3551
  'userId',
3430
- 'name',
3431
- 'frequency',
3432
- 'expectedAmount',
3433
3552
  'currency',
3434
- 'matchAmountTolerance',
3435
- 'isActive',
3436
- 'startDate',
3437
- 'autoCreate',
3438
- 'totalCount',
3553
+ 'quoteCurrency',
3554
+ 'amount',
3555
+ 'date',
3556
+ 'meta',
3439
3557
  'createdAt',
3440
3558
  'updatedAt'
3441
3559
  ]
3442
3560
  } as const;
3443
3561
 
3444
- export const $CreateRuleFromTransactionDto = {
3562
+ export const $PriceListResponseDto = {
3445
3563
  type: 'object',
3446
3564
  properties: {
3447
- frequency: {
3565
+ items: {
3566
+ description: 'List of prices',
3567
+ type: 'array',
3568
+ items: {
3569
+ $ref: '#/components/schemas/PriceResponseDto'
3570
+ }
3571
+ },
3572
+ total: {
3573
+ type: 'number',
3574
+ description: 'Total number of prices',
3575
+ example: 42
3576
+ }
3577
+ },
3578
+ required: ['items', 'total']
3579
+ } as const;
3580
+
3581
+ export const $UpdateBeanPriceDto = {
3582
+ type: 'object',
3583
+ properties: {
3584
+ currency: {
3448
3585
  type: 'string',
3449
- description: 'Recurring frequency',
3450
- enum: [
3451
- 'WEEKLY',
3452
- 'BIWEEKLY',
3453
- 'MONTHLY',
3454
- 'BIMONTHLY',
3455
- 'QUARTERLY',
3456
- 'YEARLY',
3457
- 'CUSTOM'
3458
- ],
3459
- example: 'MONTHLY'
3586
+ description: 'Currency being priced'
3460
3587
  },
3461
- name: {
3588
+ quoteCurrency: {
3462
3589
  type: 'string',
3463
- description: 'Optional name override (default: transaction payee)',
3464
- maxLength: 100
3590
+ description: 'Quote currency (pricing currency)'
3465
3591
  },
3466
- icon: {
3592
+ amount: {
3593
+ type: 'number',
3594
+ description: 'Price amount (MUST be >= 0 per Beancount spec)',
3595
+ minimum: 0
3596
+ },
3597
+ date: {
3467
3598
  type: 'string',
3468
- description: 'Optional icon emoji',
3469
- maxLength: 10
3599
+ description: 'Price date (ISO 8601 format)'
3600
+ },
3601
+ metadata: {
3602
+ type: 'object',
3603
+ description: 'Metadata'
3604
+ }
3605
+ }
3606
+ } as const;
3607
+
3608
+ export const $DeleteOwnUserDto = {
3609
+ type: 'object',
3610
+ properties: {
3611
+ accessToken: {
3612
+ type: 'string',
3613
+ description: 'Access token for user verification',
3614
+ example: 'abc123xyz'
3470
3615
  }
3471
3616
  },
3472
- required: ['frequency']
3617
+ required: ['accessToken']
3473
3618
  } as const;
3474
3619
 
3475
- export const $RecurringRuleWithStatsResponseDto = {
3620
+ export const $UserSettingsResponseDto = {
3476
3621
  type: 'object',
3477
3622
  properties: {
3478
- id: {
3623
+ baseCurrency: {
3479
3624
  type: 'string',
3480
- description: 'Rule ID'
3481
- },
3482
- userId: {
3625
+ description:
3626
+ '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).',
3627
+ example: 'USD',
3628
+ nullable: true
3629
+ }
3630
+ },
3631
+ required: ['baseCurrency']
3632
+ } as const;
3633
+
3634
+ export const $UserResponseDto = {
3635
+ type: 'object',
3636
+ properties: {
3637
+ id: {
3483
3638
  type: 'string',
3484
3639
  description: 'User ID'
3485
3640
  },
3486
- name: {
3641
+ role: {
3487
3642
  type: 'string',
3488
- description: 'Rule name'
3643
+ description: 'Assigned user role'
3489
3644
  },
3490
- icon: {
3491
- type: 'object',
3492
- description: 'Icon emoji'
3645
+ permissions: {
3646
+ description: 'Permission strings',
3647
+ type: 'array',
3648
+ items: {
3649
+ type: 'string'
3650
+ }
3493
3651
  },
3494
- frequency: {
3652
+ settings: {
3653
+ description: 'User settings',
3654
+ allOf: [
3655
+ {
3656
+ $ref: '#/components/schemas/UserSettingsResponseDto'
3657
+ }
3658
+ ]
3659
+ }
3660
+ },
3661
+ required: ['id', 'role', 'permissions', 'settings']
3662
+ } as const;
3663
+
3664
+ export const $SignupDto = {
3665
+ type: 'object',
3666
+ properties: {
3667
+ turnstileToken: {
3495
3668
  type: 'string',
3496
- description: 'Recurring frequency'
3669
+ description:
3670
+ 'Cloudflare Turnstile verification token (optional when Turnstile disabled)',
3671
+ example: '0.abc123def456...'
3672
+ }
3673
+ }
3674
+ } as const;
3675
+
3676
+ export const $SignupResponseDto = {
3677
+ type: 'object',
3678
+ properties: {
3679
+ authToken: {
3680
+ type: 'string',
3681
+ description: 'JWT auth token',
3682
+ example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
3497
3683
  },
3498
- expectedAmount: {
3499
- type: 'number',
3500
- description: 'Expected amount'
3684
+ accessToken: {
3685
+ type: 'string',
3686
+ description: 'Auto-generated access token'
3501
3687
  },
3502
- expectedDay: {
3503
- type: 'object',
3504
- description: 'Expected day of month'
3688
+ role: {
3689
+ type: 'string',
3690
+ description: 'Assigned user role',
3691
+ enum: ['USER', 'ADMIN', 'DEMO', 'INACTIVE', 'PAID', 'OPS']
3692
+ }
3693
+ },
3694
+ required: ['authToken', 'accessToken', 'role']
3695
+ } as const;
3696
+
3697
+ export const $UpdateUserSettingDto = {
3698
+ type: 'object',
3699
+ properties: {
3700
+ secId: {
3701
+ type: 'number',
3702
+ description: 'Security ID'
3505
3703
  },
3506
- customIntervalDays: {
3507
- type: 'object',
3508
- description: 'Custom interval in days'
3704
+ annualInterestRate: {
3705
+ type: 'number',
3706
+ description: 'Annual interest rate',
3707
+ example: 0.05
3509
3708
  },
3510
3709
  currency: {
3511
3710
  type: 'string',
3512
- description: 'Currency code'
3711
+ description: 'Currency code',
3712
+ example: 'USD'
3513
3713
  },
3514
- matchPayeePattern: {
3515
- type: 'object',
3516
- description: 'Payee matching pattern'
3517
- },
3518
- matchAmountTolerance: {
3519
- type: 'number',
3520
- description: 'Amount tolerance percentage'
3521
- },
3522
- defaultExpenseAccount: {
3523
- type: 'object',
3524
- description: 'Default expense account'
3525
- },
3526
- defaultPaymentAccount: {
3527
- type: 'object',
3528
- description: 'Default payment account'
3529
- },
3530
- defaultPayee: {
3531
- type: 'object',
3532
- description: 'Default payee'
3714
+ baseCurrency: {
3715
+ type: 'string',
3716
+ description: 'Base currency code',
3717
+ example: 'USD'
3533
3718
  },
3534
- isActive: {
3535
- type: 'boolean',
3536
- description: 'Whether rule is active'
3719
+ benchmark: {
3720
+ type: 'string',
3721
+ description: 'Benchmark symbol',
3722
+ example: 'SPY'
3537
3723
  },
3538
- startDate: {
3724
+ colorScheme: {
3539
3725
  type: 'string',
3540
- description: 'Rule start date (YYYY-MM-DD)'
3726
+ description: 'Color scheme',
3727
+ enum: ['DARK', 'LIGHT']
3541
3728
  },
3542
- endDate: {
3543
- type: 'object',
3544
- description: 'Rule end date (YYYY-MM-DD)'
3729
+ dateRange: {
3730
+ type: 'string',
3731
+ description: 'Date range filter',
3732
+ example: '1y'
3545
3733
  },
3546
- autoCreate: {
3547
- type: 'boolean',
3548
- description: 'Auto-create transaction on expected date'
3734
+ emergencyFund: {
3735
+ type: 'number',
3736
+ description: 'Emergency fund amount',
3737
+ example: 10000
3549
3738
  },
3550
- lastOccurrence: {
3551
- type: 'object',
3552
- description: 'Last matched occurrence date (YYYY-MM-DD)'
3739
+ 'filters.accounts': {
3740
+ description: 'Account filter IDs',
3741
+ type: 'array',
3742
+ items: {
3743
+ type: 'string'
3744
+ }
3553
3745
  },
3554
- totalCount: {
3555
- type: 'number',
3556
- description: 'Total matched transactions count'
3746
+ 'filters.assetClasses': {
3747
+ description: 'Asset class filters',
3748
+ type: 'array',
3749
+ items: {
3750
+ type: 'string'
3751
+ }
3557
3752
  },
3558
- createdAt: {
3559
- format: 'date-time',
3753
+ 'filters.dataSource': {
3560
3754
  type: 'string',
3561
- description: 'Created at timestamp'
3755
+ description: 'Data source filter'
3562
3756
  },
3563
- updatedAt: {
3564
- format: 'date-time',
3757
+ 'filters.symbol': {
3565
3758
  type: 'string',
3566
- description: 'Updated at timestamp'
3759
+ description: 'Symbol filter'
3567
3760
  },
3568
- pendingCount: {
3569
- type: 'number',
3570
- description: 'Number of pending expected transactions'
3761
+ 'filters.tags': {
3762
+ description: 'Tag filters',
3763
+ type: 'array',
3764
+ items: {
3765
+ type: 'string'
3766
+ }
3571
3767
  },
3572
- overdueCount: {
3573
- type: 'number',
3574
- description: 'Number of overdue expected transactions'
3768
+ isExperimentalFeatures: {
3769
+ type: 'boolean',
3770
+ description: 'Enable experimental features'
3575
3771
  },
3576
- nextExpectedDate: {
3577
- type: 'object',
3578
- description: 'Next expected date (YYYY-MM-DD)'
3772
+ isRestrictedView: {
3773
+ type: 'boolean',
3774
+ description: 'Enable restricted view mode'
3579
3775
  },
3580
- totalAmount: {
3581
- type: 'number',
3582
- description: 'Total amount of all matched transactions'
3776
+ language: {
3777
+ type: 'string',
3778
+ description: 'Language code',
3779
+ example: 'en'
3583
3780
  },
3584
- averageAmount: {
3585
- type: 'number',
3586
- description: 'Average amount per transaction'
3781
+ locale: {
3782
+ type: 'string',
3783
+ description: 'Locale code',
3784
+ example: 'en-US'
3587
3785
  },
3588
- transactionCount: {
3786
+ projectedTotalAmount: {
3589
3787
  type: 'number',
3590
- description: 'Number of matched transactions'
3591
- },
3592
- firstDate: {
3593
- type: 'object',
3594
- description: 'First matched transaction date (YYYY-MM-DD)'
3788
+ description: 'Projected total amount',
3789
+ example: 1000000
3595
3790
  },
3596
- lastDate: {
3597
- type: 'object',
3598
- description: 'Last matched transaction date (YYYY-MM-DD)'
3791
+ retirementDate: {
3792
+ type: 'string',
3793
+ description: 'Retirement date in ISO 8601 format',
3794
+ example: '2050-01-01'
3599
3795
  },
3600
- variance: {
3796
+ savingsRate: {
3601
3797
  type: 'number',
3602
- description: 'Amount variance (standard deviation squared)'
3798
+ description: 'Savings rate percentage',
3799
+ example: 0.2
3603
3800
  },
3604
- upcomingCount: {
3605
- type: 'number',
3606
- description: 'Number of upcoming expected transactions'
3801
+ viewMode: {
3802
+ type: 'string',
3803
+ description: 'View mode',
3804
+ enum: ['DEFAULT', 'ZEN']
3805
+ }
3806
+ }
3807
+ } as const;
3808
+
3809
+ export const $UpdatePropertyDto = {
3810
+ type: 'object',
3811
+ properties: {
3812
+ value: {
3813
+ type: 'string',
3814
+ description: 'Property value'
3607
3815
  }
3608
3816
  },
3609
- required: [
3610
- 'id',
3611
- 'userId',
3612
- 'name',
3613
- 'frequency',
3614
- 'expectedAmount',
3615
- 'currency',
3616
- 'matchAmountTolerance',
3617
- 'isActive',
3618
- 'startDate',
3619
- 'autoCreate',
3620
- 'totalCount',
3621
- 'createdAt',
3622
- 'updatedAt',
3623
- 'pendingCount',
3624
- 'overdueCount',
3625
- 'totalAmount',
3626
- 'averageAmount',
3627
- 'transactionCount',
3628
- 'variance',
3629
- 'upcomingCount'
3630
- ]
3817
+ required: ['value']
3631
3818
  } as const;
3632
3819
 
3633
- export const $UpdateRecurringRuleDto = {
3820
+ export const $CreateRecurringRuleDto = {
3634
3821
  type: 'object',
3635
3822
  properties: {
3636
3823
  name: {
3637
3824
  type: 'string',
3638
- description: 'Rule name',
3825
+ description: 'Rule name (unique per user)',
3639
3826
  maxLength: 100
3640
3827
  },
3641
3828
  icon: {
@@ -3658,7 +3845,7 @@ export const $UpdateRecurringRuleDto = {
3658
3845
  },
3659
3846
  expectedAmount: {
3660
3847
  type: 'number',
3661
- description: 'Expected amount',
3848
+ description: 'Expected amount (positive number)',
3662
3849
  minimum: 0
3663
3850
  },
3664
3851
  expectedDay: {
@@ -3669,7 +3856,7 @@ export const $UpdateRecurringRuleDto = {
3669
3856
  },
3670
3857
  customIntervalDays: {
3671
3858
  type: 'number',
3672
- description: 'Custom interval in days',
3859
+ description: 'Custom interval in days (required for CUSTOM frequency)',
3673
3860
  minimum: 1
3674
3861
  },
3675
3862
  currency: {
@@ -3679,118 +3866,136 @@ export const $UpdateRecurringRuleDto = {
3679
3866
  },
3680
3867
  matchPayeePattern: {
3681
3868
  type: 'string',
3682
- description: 'Payee matching pattern',
3869
+ description: 'Payee matching pattern (supports wildcards)',
3683
3870
  maxLength: 200
3684
3871
  },
3685
3872
  matchAmountTolerance: {
3686
3873
  type: 'number',
3687
3874
  description: 'Amount tolerance percentage (0-1)',
3875
+ default: 0.075,
3688
3876
  minimum: 0,
3689
3877
  maximum: 1
3690
3878
  },
3691
3879
  defaultExpenseAccount: {
3692
3880
  type: 'string',
3693
- description: 'Default expense account',
3881
+ description: 'Default expense account for auto-create',
3694
3882
  maxLength: 200
3695
3883
  },
3696
3884
  defaultPaymentAccount: {
3697
3885
  type: 'string',
3698
- description: 'Default payment account',
3886
+ description: 'Default payment account for auto-create',
3699
3887
  maxLength: 200
3700
3888
  },
3701
3889
  defaultPayee: {
3702
3890
  type: 'string',
3703
- description: 'Default payee',
3891
+ description: 'Default payee for auto-create',
3704
3892
  maxLength: 200
3705
3893
  },
3706
3894
  autoCreate: {
3707
3895
  type: 'boolean',
3708
- description: 'Auto-create transaction'
3896
+ description: 'Auto-create transaction when expected date arrives',
3897
+ default: false
3709
3898
  },
3710
- isActive: {
3711
- type: 'boolean',
3712
- description: 'Rule active status'
3899
+ startDate: {
3900
+ type: 'string',
3901
+ description: 'Rule start date (ISO format)'
3713
3902
  },
3714
3903
  endDate: {
3715
3904
  type: 'string',
3716
3905
  description: 'Rule end date (ISO format)'
3717
3906
  }
3718
- }
3719
- } as const;
3720
-
3721
- export const $ExpectedTransactionRuleDto = {
3722
- type: 'object',
3723
- properties: {
3724
- name: {
3725
- type: 'string',
3726
- description: 'Rule name'
3727
- },
3728
- icon: {
3729
- type: 'object',
3730
- description: 'Rule icon'
3731
- },
3732
- frequency: {
3733
- type: 'string',
3734
- description: 'Rule frequency'
3735
- },
3736
- currency: {
3737
- type: 'string',
3738
- description: 'Currency code'
3739
- }
3740
3907
  },
3741
- required: ['name', 'frequency', 'currency']
3908
+ required: [
3909
+ 'name',
3910
+ 'frequency',
3911
+ 'expectedAmount',
3912
+ 'matchAmountTolerance',
3913
+ 'autoCreate'
3914
+ ]
3742
3915
  } as const;
3743
3916
 
3744
- export const $ExpectedTransactionResponseDto = {
3917
+ export const $RecurringRuleResponseDto = {
3745
3918
  type: 'object',
3746
3919
  properties: {
3747
3920
  id: {
3748
3921
  type: 'string',
3749
- description: 'Expected transaction ID'
3922
+ description: 'Rule ID'
3750
3923
  },
3751
3924
  userId: {
3752
3925
  type: 'string',
3753
3926
  description: 'User ID'
3754
3927
  },
3755
- ruleId: {
3928
+ name: {
3756
3929
  type: 'string',
3757
- description: 'Associated rule ID'
3930
+ description: 'Rule name'
3758
3931
  },
3759
- expectedDate: {
3932
+ icon: {
3760
3933
  type: 'string',
3761
- description: 'Expected date (YYYY-MM-DD)'
3934
+ description: 'Icon emoji'
3935
+ },
3936
+ frequency: {
3937
+ type: 'string',
3938
+ description: 'Recurring frequency'
3762
3939
  },
3763
3940
  expectedAmount: {
3764
3941
  type: 'number',
3765
3942
  description: 'Expected amount'
3766
3943
  },
3767
- status: {
3768
- type: 'string',
3769
- description: 'Status (PENDING, COMPLETED, SKIPPED)'
3770
- },
3771
- matchedTransactionId: {
3772
- type: 'object',
3773
- description: 'Matched transaction ID'
3944
+ expectedDay: {
3945
+ type: 'number',
3946
+ description: 'Expected day of month'
3774
3947
  },
3775
- matchedAt: {
3776
- type: 'object',
3777
- description: 'Match timestamp (ISO 8601)'
3948
+ customIntervalDays: {
3949
+ type: 'number',
3950
+ description: 'Custom interval in days'
3778
3951
  },
3779
- matchConfidence: {
3780
- type: 'object',
3781
- description: 'Match confidence score (0-1)'
3952
+ currency: {
3953
+ type: 'string',
3954
+ description: 'Currency code'
3782
3955
  },
3783
- isOverdue: {
3956
+ matchPayeePattern: {
3957
+ type: 'string',
3958
+ description: 'Payee matching pattern'
3959
+ },
3960
+ matchAmountTolerance: {
3961
+ type: 'number',
3962
+ description: 'Amount tolerance percentage'
3963
+ },
3964
+ defaultExpenseAccount: {
3965
+ type: 'string',
3966
+ description: 'Default expense account'
3967
+ },
3968
+ defaultPaymentAccount: {
3969
+ type: 'string',
3970
+ description: 'Default payment account'
3971
+ },
3972
+ defaultPayee: {
3973
+ type: 'string',
3974
+ description: 'Default payee'
3975
+ },
3976
+ isActive: {
3784
3977
  type: 'boolean',
3785
- description: 'Whether this expected transaction is overdue'
3978
+ description: 'Whether rule is active'
3786
3979
  },
3787
- rule: {
3788
- description: 'Rule information',
3789
- allOf: [
3790
- {
3791
- $ref: '#/components/schemas/ExpectedTransactionRuleDto'
3792
- }
3793
- ]
3980
+ startDate: {
3981
+ type: 'string',
3982
+ description: 'Rule start date (YYYY-MM-DD)'
3983
+ },
3984
+ endDate: {
3985
+ type: 'string',
3986
+ description: 'Rule end date (YYYY-MM-DD)'
3987
+ },
3988
+ autoCreate: {
3989
+ type: 'boolean',
3990
+ description: 'Auto-create transaction on expected date'
3991
+ },
3992
+ lastOccurrence: {
3993
+ type: 'string',
3994
+ description: 'Last matched occurrence date (YYYY-MM-DD)'
3995
+ },
3996
+ totalCount: {
3997
+ type: 'number',
3998
+ description: 'Total matched transactions count'
3794
3999
  },
3795
4000
  createdAt: {
3796
4001
  format: 'date-time',
@@ -3806,691 +4011,581 @@ export const $ExpectedTransactionResponseDto = {
3806
4011
  required: [
3807
4012
  'id',
3808
4013
  'userId',
3809
- 'ruleId',
3810
- 'expectedDate',
4014
+ 'name',
4015
+ 'frequency',
3811
4016
  'expectedAmount',
3812
- 'status',
3813
- 'isOverdue',
3814
- 'rule',
4017
+ 'currency',
4018
+ 'matchAmountTolerance',
4019
+ 'isActive',
4020
+ 'startDate',
4021
+ 'autoCreate',
4022
+ 'totalCount',
3815
4023
  'createdAt',
3816
4024
  'updatedAt'
3817
4025
  ]
3818
4026
  } as const;
3819
4027
 
3820
- export const $ExpectedTransactionListResponseDto = {
4028
+ export const $CreateRuleFromTransactionDto = {
3821
4029
  type: 'object',
3822
4030
  properties: {
3823
- items: {
3824
- type: 'array',
3825
- items: {
3826
- $ref: '#/components/schemas/ExpectedTransactionResponseDto'
3827
- }
4031
+ frequency: {
4032
+ type: 'string',
4033
+ description: 'Recurring frequency',
4034
+ enum: [
4035
+ 'WEEKLY',
4036
+ 'BIWEEKLY',
4037
+ 'MONTHLY',
4038
+ 'BIMONTHLY',
4039
+ 'QUARTERLY',
4040
+ 'YEARLY',
4041
+ 'CUSTOM'
4042
+ ],
4043
+ example: 'MONTHLY'
3828
4044
  },
3829
- total: {
3830
- type: 'number',
3831
- description: 'Total count'
3832
- }
3833
- },
3834
- required: ['items', 'total']
3835
- } as const;
3836
-
3837
- export const $ConfirmMatchDto = {
3838
- type: 'object',
3839
- properties: {
3840
- transactionId: {
4045
+ name: {
3841
4046
  type: 'string',
3842
- description: 'Transaction ID to match with'
4047
+ description: 'Optional name override (default: transaction payee)',
4048
+ maxLength: 100
4049
+ },
4050
+ icon: {
4051
+ type: 'string',
4052
+ description: 'Optional icon emoji',
4053
+ maxLength: 10
3843
4054
  }
3844
4055
  },
3845
- required: ['transactionId']
4056
+ required: ['frequency']
3846
4057
  } as const;
3847
4058
 
3848
- export const $EnterNowDto = {
4059
+ export const $RecurringRuleWithStatsResponseDto = {
3849
4060
  type: 'object',
3850
4061
  properties: {
3851
- expenseAccount: {
4062
+ id: {
3852
4063
  type: 'string',
3853
- description:
3854
- 'Override expense account (uses rule default if not provided)',
3855
- maxLength: 200
4064
+ description: 'Rule ID'
3856
4065
  },
3857
- paymentAccount: {
4066
+ userId: {
3858
4067
  type: 'string',
3859
- description:
3860
- 'Override payment account (uses rule default if not provided)',
3861
- maxLength: 200
4068
+ description: 'User ID'
3862
4069
  },
3863
- amount: {
3864
- type: 'number',
3865
- description: 'Override amount (uses expected amount if not provided)',
3866
- minimum: 0
4070
+ name: {
4071
+ type: 'string',
4072
+ description: 'Rule name'
3867
4073
  },
3868
- payee: {
4074
+ icon: {
3869
4075
  type: 'string',
3870
- description: 'Override payee (uses rule default if not provided)',
3871
- maxLength: 200
4076
+ description: 'Icon emoji'
3872
4077
  },
3873
- narration: {
4078
+ frequency: {
3874
4079
  type: 'string',
3875
- description: 'Optional narration',
3876
- maxLength: 500
3877
- }
3878
- }
3879
- } as const;
3880
-
3881
- export const $ForecastItemDto = {
3882
- type: 'object',
3883
- properties: {
3884
- rule: {
4080
+ description: 'Recurring frequency'
4081
+ },
4082
+ expectedAmount: {
4083
+ type: 'number',
4084
+ description: 'Expected amount'
4085
+ },
4086
+ expectedDay: {
4087
+ type: 'number',
4088
+ description: 'Expected day of month'
4089
+ },
4090
+ customIntervalDays: {
4091
+ type: 'number',
4092
+ description: 'Custom interval in days'
4093
+ },
4094
+ currency: {
3885
4095
  type: 'string',
3886
- description: 'Rule name',
3887
- example: 'Rent'
4096
+ description: 'Currency code'
3888
4097
  },
3889
- ruleId: {
4098
+ matchPayeePattern: {
3890
4099
  type: 'string',
3891
- description: 'Rule ID',
3892
- example: 'clx123...'
4100
+ description: 'Payee matching pattern'
3893
4101
  },
3894
- amount: {
4102
+ matchAmountTolerance: {
3895
4103
  type: 'number',
3896
- description: 'Expected amount',
3897
- example: 3000
4104
+ description: 'Amount tolerance percentage'
3898
4105
  },
3899
- date: {
4106
+ defaultExpenseAccount: {
3900
4107
  type: 'string',
3901
- description: 'Expected date (YYYY-MM-DD)',
3902
- example: '2024-04-01'
4108
+ description: 'Default expense account'
3903
4109
  },
3904
- icon: {
4110
+ defaultPaymentAccount: {
3905
4111
  type: 'string',
3906
- description: 'Rule icon emoji',
3907
- example: '🏠',
3908
- nullable: true
4112
+ description: 'Default payment account'
3909
4113
  },
3910
- currency: {
4114
+ defaultPayee: {
3911
4115
  type: 'string',
3912
- description: 'Currency code',
3913
- example: 'CNY'
3914
- }
3915
- },
3916
- required: ['rule', 'ruleId', 'amount', 'date', 'icon', 'currency']
3917
- } as const;
3918
-
3919
- export const $MonthlyForecastDto = {
3920
- type: 'object',
3921
- properties: {
3922
- month: {
4116
+ description: 'Default payee'
4117
+ },
4118
+ isActive: {
4119
+ type: 'boolean',
4120
+ description: 'Whether rule is active'
4121
+ },
4122
+ startDate: {
3923
4123
  type: 'string',
3924
- description: 'Month (YYYY-MM)',
3925
- example: '2024-04'
4124
+ description: 'Rule start date (YYYY-MM-DD)'
3926
4125
  },
3927
- expectedOutflow: {
4126
+ endDate: {
4127
+ type: 'string',
4128
+ description: 'Rule end date (YYYY-MM-DD)'
4129
+ },
4130
+ autoCreate: {
4131
+ type: 'boolean',
4132
+ description: 'Auto-create transaction on expected date'
4133
+ },
4134
+ lastOccurrence: {
4135
+ type: 'string',
4136
+ description: 'Last matched occurrence date (YYYY-MM-DD)'
4137
+ },
4138
+ totalCount: {
3928
4139
  type: 'number',
3929
- description: 'Total expected outflow for the month',
3930
- example: 8500
4140
+ description: 'Total matched transactions count'
3931
4141
  },
3932
- itemCount: {
4142
+ createdAt: {
4143
+ format: 'date-time',
4144
+ type: 'string',
4145
+ description: 'Created at timestamp'
4146
+ },
4147
+ updatedAt: {
4148
+ format: 'date-time',
4149
+ type: 'string',
4150
+ description: 'Updated at timestamp'
4151
+ },
4152
+ pendingCount: {
3933
4153
  type: 'number',
3934
- description: 'Number of expected transactions',
3935
- example: 3
4154
+ description: 'Number of pending expected transactions'
3936
4155
  },
3937
- byCurrency: {
3938
- type: 'object',
3939
- description: 'Breakdown by currency',
3940
- example: {
3941
- CNY: 8500,
3942
- USD: 100
3943
- }
4156
+ overdueCount: {
4157
+ type: 'number',
4158
+ description: 'Number of overdue expected transactions'
3944
4159
  },
3945
- items: {
3946
- description: 'Individual forecast items',
3947
- type: 'array',
3948
- items: {
3949
- $ref: '#/components/schemas/ForecastItemDto'
3950
- }
3951
- }
3952
- },
3953
- required: ['month', 'expectedOutflow', 'itemCount', 'byCurrency', 'items']
3954
- } as const;
3955
-
3956
- export const $ForecastResponseDto = {
3957
- type: 'object',
3958
- properties: {
3959
- forecast: {
3960
- description: 'Monthly forecast data',
3961
- type: 'array',
3962
- items: {
3963
- $ref: '#/components/schemas/MonthlyForecastDto'
3964
- }
4160
+ nextExpectedDate: {
4161
+ type: 'string',
4162
+ description: 'Next expected date (YYYY-MM-DD)'
3965
4163
  },
3966
- totalOutflow: {
4164
+ totalAmount: {
3967
4165
  type: 'number',
3968
- description: 'Total expected outflow across all months',
3969
- example: 25500
3970
- },
3971
- totalByCurrency: {
3972
- type: 'object',
3973
- description: 'Total by currency across all months',
3974
- example: {
3975
- CNY: 25500,
3976
- USD: 300
3977
- }
4166
+ description: 'Total amount of all matched transactions'
3978
4167
  },
3979
- rulesCount: {
4168
+ averageAmount: {
3980
4169
  type: 'number',
3981
- description: 'Number of active recurring rules included',
3982
- example: 5
3983
- },
3984
- periodStart: {
3985
- type: 'string',
3986
- description: 'Forecast period start date',
3987
- example: '2024-04-01'
3988
- },
3989
- periodEnd: {
3990
- type: 'string',
3991
- description: 'Forecast period end date',
3992
- example: '2024-06-30'
3993
- }
3994
- },
3995
- required: [
3996
- 'forecast',
3997
- 'totalOutflow',
3998
- 'totalByCurrency',
3999
- 'rulesCount',
4000
- 'periodStart',
4001
- 'periodEnd'
4002
- ]
4003
- } as const;
4004
-
4005
- export const $CurrencyBalanceDto = {
4006
- type: 'object',
4007
- properties: {
4008
- currency: {
4009
- type: 'string',
4010
- description: 'ISO 4217 currency code',
4011
- example: 'CNY'
4170
+ description: 'Average amount per transaction'
4012
4171
  },
4013
- balance: {
4014
- type: 'string',
4015
- description: 'Balance amount',
4016
- example: '500000.00'
4017
- }
4018
- },
4019
- required: ['currency', 'balance']
4020
- } as const;
4021
-
4022
- export const $TimeSeriesPointDto = {
4023
- type: 'object',
4024
- properties: {
4025
- date: {
4026
- type: 'string',
4027
- description: 'Date in YYYY-MM-DD format',
4028
- example: '2024-06-15'
4172
+ transactionCount: {
4173
+ type: 'number',
4174
+ description: 'Number of matched transactions'
4029
4175
  },
4030
- value: {
4176
+ firstDate: {
4031
4177
  type: 'string',
4032
- description: 'Value at this date (in base currency)',
4033
- example: '500000.00'
4034
- },
4035
- change: {
4036
- type: 'object',
4037
- description: 'Change from previous point',
4038
- example: '5000.00'
4178
+ description: 'First matched transaction date (YYYY-MM-DD)'
4039
4179
  },
4040
- assets: {
4180
+ lastDate: {
4041
4181
  type: 'string',
4042
- description: 'Total assets at this date (in base currency)',
4043
- example: '494338.00'
4182
+ description: 'Last matched transaction date (YYYY-MM-DD)'
4044
4183
  },
4045
- liabilities: {
4046
- type: 'string',
4047
- description: 'Total liabilities at this date (in base currency)',
4048
- example: '310098.00'
4184
+ variance: {
4185
+ type: 'number',
4186
+ description: 'Amount variance (standard deviation squared)'
4049
4187
  },
4050
- byCurrency: {
4051
- description: 'Multi-currency breakdown for this point',
4052
- type: 'array',
4053
- items: {
4054
- $ref: '#/components/schemas/CurrencyBalanceDto'
4055
- }
4188
+ upcomingCount: {
4189
+ type: 'number',
4190
+ description: 'Number of upcoming expected transactions'
4056
4191
  }
4057
4192
  },
4058
- required: ['date', 'value']
4193
+ required: [
4194
+ 'id',
4195
+ 'userId',
4196
+ 'name',
4197
+ 'frequency',
4198
+ 'expectedAmount',
4199
+ 'currency',
4200
+ 'matchAmountTolerance',
4201
+ 'isActive',
4202
+ 'startDate',
4203
+ 'autoCreate',
4204
+ 'totalCount',
4205
+ 'createdAt',
4206
+ 'updatedAt',
4207
+ 'pendingCount',
4208
+ 'overdueCount',
4209
+ 'totalAmount',
4210
+ 'averageAmount',
4211
+ 'transactionCount',
4212
+ 'variance',
4213
+ 'upcomingCount'
4214
+ ]
4059
4215
  } as const;
4060
4216
 
4061
- export const $TrendSummaryDto = {
4217
+ export const $UpdateRecurringRuleDto = {
4062
4218
  type: 'object',
4063
4219
  properties: {
4064
- startValue: {
4065
- type: 'string',
4066
- description: 'Value at start of period',
4067
- example: '450000.00'
4068
- },
4069
- endValue: {
4220
+ name: {
4070
4221
  type: 'string',
4071
- description: 'Value at end of period',
4072
- example: '500000.00'
4222
+ description: 'Rule name (unique per user)',
4223
+ maxLength: 100
4073
4224
  },
4074
- totalChange: {
4225
+ icon: {
4075
4226
  type: 'string',
4076
- description: 'Total change over period',
4077
- example: '50000.00'
4227
+ description: 'Icon emoji',
4228
+ maxLength: 10
4078
4229
  },
4079
- totalChangePercentage: {
4080
- type: 'string',
4081
- description: 'Total change percentage',
4082
- example: '+11.11%'
4083
- }
4084
- },
4085
- required: ['startValue', 'endValue', 'totalChange', 'totalChangePercentage']
4086
- } as const;
4087
-
4088
- export const $MultiCurrencyPointDto = {
4089
- type: 'object',
4090
- properties: {
4091
- date: {
4230
+ frequency: {
4092
4231
  type: 'string',
4093
- description: 'Date in YYYY-MM-DD format',
4094
- example: '2024-06-15'
4095
- },
4096
- byCurrency: {
4097
- description: 'Balances by currency',
4098
- type: 'array',
4099
- items: {
4100
- $ref: '#/components/schemas/CurrencyBalanceDto'
4101
- }
4102
- }
4103
- },
4104
- required: ['date', 'byCurrency']
4105
- } as const;
4106
-
4107
- export const $PortfolioTrendsResponseDto = {
4108
- type: 'object',
4109
- properties: {
4110
- series: {
4111
- description: 'Time series data points',
4112
- type: 'array',
4113
- items: {
4114
- $ref: '#/components/schemas/TimeSeriesPointDto'
4115
- }
4116
- },
4117
- summary: {
4118
- description: 'Period summary',
4119
- allOf: [
4120
- {
4121
- $ref: '#/components/schemas/TrendSummaryDto'
4122
- }
4232
+ description: 'Recurring frequency',
4233
+ enum: [
4234
+ 'WEEKLY',
4235
+ 'BIWEEKLY',
4236
+ 'MONTHLY',
4237
+ 'BIMONTHLY',
4238
+ 'QUARTERLY',
4239
+ 'YEARLY',
4240
+ 'CUSTOM'
4123
4241
  ]
4124
4242
  },
4125
- period: {
4126
- type: 'string',
4127
- description: 'Period requested',
4128
- example: '6m'
4243
+ expectedAmount: {
4244
+ type: 'number',
4245
+ description: 'Expected amount (positive number)',
4246
+ minimum: 0
4129
4247
  },
4130
- granularity: {
4131
- type: 'string',
4132
- description: 'Data granularity',
4133
- example: 'month'
4248
+ expectedDay: {
4249
+ type: 'number',
4250
+ description: 'Expected day of month (1-31)',
4251
+ minimum: 1,
4252
+ maximum: 31
4134
4253
  },
4135
4254
  currency: {
4136
4255
  type: 'string',
4137
- description: 'Base currency for converted values',
4138
- example: 'CNY'
4139
- },
4140
- byCurrency: {
4141
- description:
4142
- 'Multi-currency time series (each point has currency breakdown)',
4143
- type: 'array',
4144
- items: {
4145
- $ref: '#/components/schemas/MultiCurrencyPointDto'
4146
- }
4147
- },
4148
- warnings: {
4149
- description: 'Exchange rate warnings',
4150
- type: 'array',
4151
- items: {
4152
- $ref: '#/components/schemas/ExchangeRateWarningDto'
4153
- }
4154
- }
4155
- },
4156
- required: ['series', 'summary', 'period', 'granularity', 'currency']
4157
- } as const;
4158
-
4159
- export const $CashFlowPointDto = {
4160
- type: 'object',
4161
- properties: {
4162
- month: {
4163
- type: 'string',
4164
- description: 'Month key (YYYY-MM)',
4165
- example: '2024-03'
4166
- },
4167
- income: {
4168
- type: 'string',
4169
- description: 'Income in base currency (absolute, converted)',
4170
- example: '10000.00'
4256
+ description: 'Currency code',
4257
+ maxLength: 10
4171
4258
  },
4172
- expense: {
4259
+ matchPayeePattern: {
4173
4260
  type: 'string',
4174
- description: 'Expense in base currency (absolute, converted)',
4175
- example: '5000.00'
4261
+ description: 'Payee matching pattern (supports wildcards)',
4262
+ maxLength: 200
4176
4263
  },
4177
- netSavings: {
4178
- type: 'string',
4179
- description: 'netSavings = income − expense (savings positive)',
4180
- example: '5000.00'
4181
- }
4182
- },
4183
- required: ['month', 'income', 'expense', 'netSavings']
4184
- } as const;
4185
-
4186
- export const $CashFlowTrendSummaryDto = {
4187
- type: 'object',
4188
- properties: {
4189
- totalIncome: {
4190
- type: 'string',
4191
- description: 'Total income across the period',
4192
- example: '60000.00'
4264
+ matchAmountTolerance: {
4265
+ type: 'number',
4266
+ description: 'Amount tolerance percentage (0-1)',
4267
+ default: 0.075,
4268
+ minimum: 0,
4269
+ maximum: 1
4193
4270
  },
4194
- totalExpense: {
4271
+ defaultExpenseAccount: {
4195
4272
  type: 'string',
4196
- description: 'Total expense across the period',
4197
- example: '30000.00'
4273
+ description: 'Default expense account for auto-create',
4274
+ maxLength: 200
4198
4275
  },
4199
- totalNetSavings: {
4276
+ defaultPaymentAccount: {
4200
4277
  type: 'string',
4201
- description: 'income − expense across the period',
4202
- example: '30000.00'
4278
+ description: 'Default payment account for auto-create',
4279
+ maxLength: 200
4203
4280
  },
4204
- averageMonthlyNetSavings: {
4281
+ defaultPayee: {
4205
4282
  type: 'string',
4206
- description:
4207
- 'totalNetSavings divided by the window length (N months, incl. zero-filled)',
4208
- example: '5000.00'
4209
- }
4210
- },
4211
- required: [
4212
- 'totalIncome',
4213
- 'totalExpense',
4214
- 'totalNetSavings',
4215
- 'averageMonthlyNetSavings'
4216
- ]
4217
- } as const;
4218
-
4219
- export const $CashFlowTrendsResponseDto = {
4220
- type: 'object',
4221
- properties: {
4222
- series: {
4223
- description:
4224
- 'Monthly cash-flow series (fixed N-month window, zero-filled)',
4225
- type: 'array',
4226
- items: {
4227
- $ref: '#/components/schemas/CashFlowPointDto'
4228
- }
4229
- },
4230
- summary: {
4231
- description: 'Period totals',
4232
- allOf: [
4233
- {
4234
- $ref: '#/components/schemas/CashFlowTrendSummaryDto'
4235
- }
4236
- ]
4283
+ description: 'Default payee for auto-create',
4284
+ maxLength: 200
4237
4285
  },
4238
- period: {
4239
- type: 'string',
4240
- description: 'Period requested',
4241
- example: '6m'
4286
+ autoCreate: {
4287
+ type: 'boolean',
4288
+ description: 'Auto-create transaction when expected date arrives',
4289
+ default: false
4242
4290
  },
4243
- granularity: {
4291
+ endDate: {
4244
4292
  type: 'string',
4245
- description: 'Data granularity (v1 returns month buckets)',
4246
- example: 'month'
4293
+ description: 'Rule end date (ISO format)'
4247
4294
  },
4248
- currency: {
4249
- type: 'string',
4250
- description: 'Base currency for converted values',
4251
- example: 'CNY'
4295
+ customIntervalDays: {
4296
+ type: 'number',
4297
+ description: 'Custom interval in days',
4298
+ minimum: 1
4252
4299
  },
4253
- warnings: {
4254
- description: 'Exchange rate warnings (e.g. missing rate for a currency)',
4255
- type: 'array',
4256
- items: {
4257
- $ref: '#/components/schemas/ExchangeRateWarningDto'
4258
- }
4259
- }
4260
- },
4261
- required: ['series', 'summary', 'period', 'granularity', 'currency']
4262
- } as const;
4263
-
4264
- export const $GenerateSnapshotBody = {
4265
- type: 'object',
4266
- properties: {}
4267
- } as const;
4268
-
4269
- export const $GenerateSnapshotResponse = {
4270
- type: 'object',
4271
- properties: {}
4272
- } as const;
4273
-
4274
- export const $BackfillSnapshotsBody = {
4275
- type: 'object',
4276
- properties: {}
4277
- } as const;
4278
-
4279
- export const $BackfillSnapshotsResponse = {
4280
- type: 'object',
4281
- properties: {}
4282
- } as const;
4283
-
4284
- export const $DeleteOwnUserDto = {
4285
- type: 'object',
4286
- properties: {
4287
- accessToken: {
4288
- type: 'string',
4289
- description: 'Access token for user verification',
4290
- example: 'abc123xyz'
4300
+ isActive: {
4301
+ type: 'boolean',
4302
+ description: 'Rule active status'
4291
4303
  }
4292
- },
4293
- required: ['accessToken']
4304
+ }
4294
4305
  } as const;
4295
4306
 
4296
- export const $UserSettingsResponseDto = {
4307
+ export const $ExpectedTransactionRuleDto = {
4297
4308
  type: 'object',
4298
4309
  properties: {
4299
- baseCurrency: {
4310
+ name: {
4300
4311
  type: 'string',
4301
- description:
4302
- 'Base currency (ISO 4217) for net-worth/report aggregation. Independent of region (ADR-0006).',
4303
- example: 'USD',
4304
- nullable: true
4312
+ description: 'Rule name'
4313
+ },
4314
+ icon: {
4315
+ type: 'string',
4316
+ description: 'Rule icon'
4317
+ },
4318
+ frequency: {
4319
+ type: 'string',
4320
+ description: 'Rule frequency'
4321
+ },
4322
+ currency: {
4323
+ type: 'string',
4324
+ description: 'Currency code'
4305
4325
  }
4306
4326
  },
4307
- required: ['baseCurrency']
4327
+ required: ['name', 'frequency', 'currency']
4308
4328
  } as const;
4309
4329
 
4310
- export const $UserResponseDto = {
4330
+ export const $ExpectedTransactionResponseDto = {
4311
4331
  type: 'object',
4312
4332
  properties: {
4313
4333
  id: {
4334
+ type: 'string',
4335
+ description: 'Expected transaction ID'
4336
+ },
4337
+ userId: {
4314
4338
  type: 'string',
4315
4339
  description: 'User ID'
4316
4340
  },
4317
- role: {
4341
+ ruleId: {
4318
4342
  type: 'string',
4319
- description: 'Assigned user role'
4343
+ description: 'Associated rule ID'
4320
4344
  },
4321
- permissions: {
4322
- description: 'Permission strings',
4323
- type: 'array',
4324
- items: {
4325
- type: 'string'
4326
- }
4345
+ expectedDate: {
4346
+ type: 'string',
4347
+ description: 'Expected date (YYYY-MM-DD)'
4327
4348
  },
4328
- settings: {
4329
- description: 'User settings',
4349
+ expectedAmount: {
4350
+ type: 'number',
4351
+ description: 'Expected amount'
4352
+ },
4353
+ status: {
4354
+ type: 'string',
4355
+ description: 'Status (PENDING, COMPLETED, SKIPPED)'
4356
+ },
4357
+ matchedTransactionId: {
4358
+ type: 'string',
4359
+ description: 'Matched transaction ID'
4360
+ },
4361
+ matchedAt: {
4362
+ type: 'string',
4363
+ description: 'Match timestamp (ISO 8601)'
4364
+ },
4365
+ matchConfidence: {
4366
+ type: 'number',
4367
+ description: 'Match confidence score (0-1)'
4368
+ },
4369
+ isOverdue: {
4370
+ type: 'boolean',
4371
+ description: 'Whether this expected transaction is overdue'
4372
+ },
4373
+ rule: {
4374
+ description: 'Rule information',
4330
4375
  allOf: [
4331
4376
  {
4332
- $ref: '#/components/schemas/UserSettingsResponseDto'
4377
+ $ref: '#/components/schemas/ExpectedTransactionRuleDto'
4333
4378
  }
4334
4379
  ]
4380
+ },
4381
+ createdAt: {
4382
+ format: 'date-time',
4383
+ type: 'string',
4384
+ description: 'Created at timestamp'
4385
+ },
4386
+ updatedAt: {
4387
+ format: 'date-time',
4388
+ type: 'string',
4389
+ description: 'Updated at timestamp'
4335
4390
  }
4336
4391
  },
4337
- required: ['id', 'role', 'permissions', 'settings']
4392
+ required: [
4393
+ 'id',
4394
+ 'userId',
4395
+ 'ruleId',
4396
+ 'expectedDate',
4397
+ 'expectedAmount',
4398
+ 'status',
4399
+ 'isOverdue',
4400
+ 'rule',
4401
+ 'createdAt',
4402
+ 'updatedAt'
4403
+ ]
4338
4404
  } as const;
4339
4405
 
4340
- export const $SignupDto = {
4406
+ export const $ExpectedTransactionListResponseDto = {
4341
4407
  type: 'object',
4342
4408
  properties: {
4343
- turnstileToken: {
4409
+ items: {
4410
+ type: 'array',
4411
+ items: {
4412
+ $ref: '#/components/schemas/ExpectedTransactionResponseDto'
4413
+ }
4414
+ },
4415
+ total: {
4416
+ type: 'number',
4417
+ description: 'Total count'
4418
+ }
4419
+ },
4420
+ required: ['items', 'total']
4421
+ } as const;
4422
+
4423
+ export const $ConfirmMatchDto = {
4424
+ type: 'object',
4425
+ properties: {
4426
+ transactionId: {
4344
4427
  type: 'string',
4345
- description:
4346
- 'Cloudflare Turnstile verification token (optional when Turnstile disabled)',
4347
- example: '0.abc123def456...'
4428
+ description: 'Transaction ID to match with'
4348
4429
  }
4349
- }
4430
+ },
4431
+ required: ['transactionId']
4350
4432
  } as const;
4351
4433
 
4352
- export const $SignupResponseDto = {
4434
+ export const $EnterNowDto = {
4353
4435
  type: 'object',
4354
4436
  properties: {
4355
- authToken: {
4437
+ expenseAccount: {
4356
4438
  type: 'string',
4357
- description: 'JWT auth token',
4358
- example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
4439
+ description:
4440
+ 'Override expense account (uses rule default if not provided)',
4441
+ maxLength: 200
4359
4442
  },
4360
- accessToken: {
4443
+ paymentAccount: {
4361
4444
  type: 'string',
4362
- description: 'Auto-generated access token'
4445
+ description:
4446
+ 'Override payment account (uses rule default if not provided)',
4447
+ maxLength: 200
4363
4448
  },
4364
- role: {
4449
+ amount: {
4450
+ type: 'number',
4451
+ description: 'Override amount (uses expected amount if not provided)',
4452
+ minimum: 0
4453
+ },
4454
+ payee: {
4365
4455
  type: 'string',
4366
- description: 'Assigned user role',
4367
- enum: ['USER', 'ADMIN', 'DEMO', 'INACTIVE', 'PAID', 'OPS']
4456
+ description: 'Override payee (uses rule default if not provided)',
4457
+ maxLength: 200
4458
+ },
4459
+ narration: {
4460
+ type: 'string',
4461
+ description: 'Optional narration',
4462
+ maxLength: 500
4368
4463
  }
4369
- },
4370
- required: ['authToken', 'accessToken', 'role']
4464
+ }
4371
4465
  } as const;
4372
4466
 
4373
- export const $UpdateUserSettingDto = {
4467
+ export const $ForecastItemDto = {
4374
4468
  type: 'object',
4375
4469
  properties: {
4376
- secId: {
4377
- type: 'number',
4378
- description: 'Security ID'
4470
+ rule: {
4471
+ type: 'string',
4472
+ description: 'Rule name',
4473
+ example: 'Rent'
4379
4474
  },
4380
- annualInterestRate: {
4475
+ ruleId: {
4476
+ type: 'string',
4477
+ description: 'Rule ID',
4478
+ example: 'clx123...'
4479
+ },
4480
+ amount: {
4381
4481
  type: 'number',
4382
- description: 'Annual interest rate',
4383
- example: 0.05
4482
+ description: 'Expected amount',
4483
+ example: 3000
4384
4484
  },
4385
- currency: {
4485
+ date: {
4386
4486
  type: 'string',
4387
- description: 'Currency code',
4388
- example: 'USD'
4487
+ description: 'Expected date (YYYY-MM-DD)',
4488
+ example: '2024-04-01'
4389
4489
  },
4390
- baseCurrency: {
4490
+ icon: {
4391
4491
  type: 'string',
4392
- description: 'Base currency code',
4393
- example: 'USD'
4492
+ description: 'Rule icon emoji',
4493
+ example: '🏠',
4494
+ nullable: true
4394
4495
  },
4395
- benchmark: {
4496
+ currency: {
4396
4497
  type: 'string',
4397
- description: 'Benchmark symbol',
4398
- example: 'SPY'
4399
- },
4400
- colorScheme: {
4498
+ description: 'Currency code',
4499
+ example: 'CNY'
4500
+ }
4501
+ },
4502
+ required: ['rule', 'ruleId', 'amount', 'date', 'icon', 'currency']
4503
+ } as const;
4504
+
4505
+ export const $MonthlyForecastDto = {
4506
+ type: 'object',
4507
+ properties: {
4508
+ month: {
4401
4509
  type: 'string',
4402
- description: 'Color scheme',
4403
- enum: ['DARK', 'LIGHT']
4510
+ description: 'Month (YYYY-MM)',
4511
+ example: '2024-04'
4404
4512
  },
4405
- dateRange: {
4406
- type: 'string',
4407
- description: 'Date range filter',
4408
- example: '1y'
4513
+ expectedOutflow: {
4514
+ type: 'number',
4515
+ description: 'Total expected outflow for the month',
4516
+ example: 8500
4409
4517
  },
4410
- emergencyFund: {
4518
+ itemCount: {
4411
4519
  type: 'number',
4412
- description: 'Emergency fund amount',
4413
- example: 10000
4520
+ description: 'Number of expected transactions',
4521
+ example: 3
4414
4522
  },
4415
- 'filters.accounts': {
4416
- description: 'Account filter IDs',
4417
- type: 'array',
4418
- items: {
4419
- type: 'string'
4523
+ byCurrency: {
4524
+ type: 'object',
4525
+ description: 'Breakdown by currency',
4526
+ example: {
4527
+ CNY: 8500,
4528
+ USD: 100
4420
4529
  }
4421
4530
  },
4422
- 'filters.assetClasses': {
4423
- description: 'Asset class filters',
4531
+ items: {
4532
+ description: 'Individual forecast items',
4424
4533
  type: 'array',
4425
4534
  items: {
4426
- type: 'string'
4427
- }
4428
- },
4429
- 'filters.dataSource': {
4430
- type: 'string',
4431
- description: 'Data source filter'
4432
- },
4433
- 'filters.symbol': {
4434
- type: 'string',
4435
- description: 'Symbol filter'
4436
- },
4437
- 'filters.tags': {
4438
- description: 'Tag filters',
4535
+ $ref: '#/components/schemas/ForecastItemDto'
4536
+ }
4537
+ }
4538
+ },
4539
+ required: ['month', 'expectedOutflow', 'itemCount', 'byCurrency', 'items']
4540
+ } as const;
4541
+
4542
+ export const $ForecastResponseDto = {
4543
+ type: 'object',
4544
+ properties: {
4545
+ forecast: {
4546
+ description: 'Monthly forecast data',
4439
4547
  type: 'array',
4440
4548
  items: {
4441
- type: 'string'
4549
+ $ref: '#/components/schemas/MonthlyForecastDto'
4442
4550
  }
4443
4551
  },
4444
- isExperimentalFeatures: {
4445
- type: 'boolean',
4446
- description: 'Enable experimental features'
4447
- },
4448
- isRestrictedView: {
4449
- type: 'boolean',
4450
- description: 'Enable restricted view mode'
4451
- },
4452
- language: {
4453
- type: 'string',
4454
- description: 'Language code',
4455
- example: 'en'
4456
- },
4457
- locale: {
4458
- type: 'string',
4459
- description: 'Locale code',
4460
- example: 'en-US'
4461
- },
4462
- projectedTotalAmount: {
4552
+ totalOutflow: {
4463
4553
  type: 'number',
4464
- description: 'Projected total amount',
4465
- example: 1000000
4554
+ description: 'Total expected outflow across all months',
4555
+ example: 25500
4466
4556
  },
4467
- retirementDate: {
4468
- type: 'string',
4469
- description: 'Retirement date in ISO 8601 format',
4470
- example: '2050-01-01'
4557
+ totalByCurrency: {
4558
+ type: 'object',
4559
+ description: 'Total by currency across all months',
4560
+ example: {
4561
+ CNY: 25500,
4562
+ USD: 300
4563
+ }
4471
4564
  },
4472
- savingsRate: {
4565
+ rulesCount: {
4473
4566
  type: 'number',
4474
- description: 'Savings rate percentage',
4475
- example: 0.2
4567
+ description: 'Number of active recurring rules included',
4568
+ example: 5
4476
4569
  },
4477
- viewMode: {
4570
+ periodStart: {
4478
4571
  type: 'string',
4479
- description: 'View mode',
4480
- enum: ['DEFAULT', 'ZEN']
4481
- }
4482
- }
4483
- } as const;
4484
-
4485
- export const $UpdatePropertyDto = {
4486
- type: 'object',
4487
- properties: {
4488
- value: {
4572
+ description: 'Forecast period start date',
4573
+ example: '2024-04-01'
4574
+ },
4575
+ periodEnd: {
4489
4576
  type: 'string',
4490
- description: 'Property value'
4577
+ description: 'Forecast period end date',
4578
+ example: '2024-06-30'
4491
4579
  }
4492
4580
  },
4493
- required: ['value']
4581
+ required: [
4582
+ 'forecast',
4583
+ 'totalOutflow',
4584
+ 'totalByCurrency',
4585
+ 'rulesCount',
4586
+ 'periodStart',
4587
+ 'periodEnd'
4588
+ ]
4494
4589
  } as const;
4495
4590
 
4496
4591
  export const $CreateTransactionRuleDto = {
@@ -5052,7 +5147,8 @@ export const $UpdateTransactionRuleDto = {
5052
5147
  },
5053
5148
  matchLogic: {
5054
5149
  type: 'string',
5055
- enum: ['OR', 'AND']
5150
+ enum: ['OR', 'AND'],
5151
+ default: 'OR'
5056
5152
  },
5057
5153
  amountMin: {
5058
5154
  type: 'number',
@@ -5066,13 +5162,10 @@ export const $UpdateTransactionRuleDto = {
5066
5162
  },
5067
5163
  priority: {
5068
5164
  type: 'number',
5165
+ default: 50,
5069
5166
  minimum: 0,
5070
5167
  maximum: 1000
5071
5168
  },
5072
- enabled: {
5073
- type: 'boolean',
5074
- description: 'Enable or disable the rule'
5075
- },
5076
5169
  additionalTags: {
5077
5170
  items: {
5078
5171
  type: 'array'
@@ -5082,6 +5175,10 @@ export const $UpdateTransactionRuleDto = {
5082
5175
  },
5083
5176
  additionalMetadata: {
5084
5177
  type: 'object'
5178
+ },
5179
+ enabled: {
5180
+ type: 'boolean',
5181
+ description: 'Enable or disable the rule'
5085
5182
  }
5086
5183
  }
5087
5184
  } as const;
@@ -5175,9 +5272,23 @@ export const $CategoryCatalogEntryDto = {
5175
5272
  items: {
5176
5273
  type: 'string'
5177
5274
  }
5275
+ },
5276
+ categoryAccounts: {
5277
+ description:
5278
+ "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.",
5279
+ example: [
5280
+ 'Expenses:Utilities:Electricity',
5281
+ 'Expenses:Utilities:Gas',
5282
+ 'Expenses:Utilities:Internet',
5283
+ 'Expenses:Utilities:Water'
5284
+ ],
5285
+ type: 'array',
5286
+ items: {
5287
+ type: 'string'
5288
+ }
5178
5289
  }
5179
5290
  },
5180
- required: ['slug', 'scenario', 'icon', 'regions']
5291
+ required: ['slug', 'scenario', 'icon', 'regions', 'categoryAccounts']
5181
5292
  } as const;
5182
5293
 
5183
5294
  export const $CategoryCatalogListResponseDto = {
@@ -5368,6 +5479,14 @@ export const $OnboardingAccountDto = {
5368
5479
  description:
5369
5480
  'Platform ID to bind the account to (references Platform.id); omit for unbound',
5370
5481
  example: 'c98e5d4a-2f71-4a5a-bb3c-92c9f231d5e2'
5482
+ },
5483
+ displayName: {
5484
+ type: 'string',
5485
+ description:
5486
+ 'User-set display name override (omit/null = keep the derived name)',
5487
+ nullable: true,
5488
+ maxLength: 50,
5489
+ example: 'Salary card'
5371
5490
  }
5372
5491
  },
5373
5492
  required: ['path', 'currency']
@@ -6288,8 +6407,9 @@ export const $ClientParsedDataDto = {
6288
6407
  },
6289
6408
  category: {
6290
6409
  type: 'string',
6291
- description: 'Category slug',
6292
- example: 'food_restaurant'
6410
+ description:
6411
+ '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.',
6412
+ example: 'food'
6293
6413
  },
6294
6414
  incomeType: {
6295
6415
  type: 'string',
@@ -6389,6 +6509,25 @@ export const $ProcessNlpDto = {
6389
6509
  description:
6390
6510
  '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.',
6391
6511
  example: 'Expenses:Food:Coffee'
6512
+ },
6513
+ viewpointAccount: {
6514
+ type: 'string',
6515
+ description:
6516
+ '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.',
6517
+ example: 'Assets:CN:Bank:ICBC'
6518
+ },
6519
+ viewpointCategory: {
6520
+ type: 'string',
6521
+ description:
6522
+ "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.",
6523
+ example: 'Food'
6524
+ },
6525
+ viewpointFlow: {
6526
+ type: 'string',
6527
+ description:
6528
+ "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.",
6529
+ enum: ['income', 'expense'],
6530
+ example: 'expense'
6392
6531
  }
6393
6532
  }
6394
6533
  } as const;
@@ -6456,7 +6595,9 @@ export const $NlpParsedDataDto = {
6456
6595
  },
6457
6596
  category: {
6458
6597
  type: 'string',
6459
- description: 'Category'
6598
+ description:
6599
+ '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.',
6600
+ example: 'food'
6460
6601
  },
6461
6602
  incomeType: {
6462
6603
  type: 'string',
@@ -7367,6 +7508,79 @@ export const $PlatformMatchResponseDto = {
7367
7508
  required: ['platforms', 'matchType', 'total', 'hasMore']
7368
7509
  } as const;
7369
7510
 
7511
+ export const $PlatformStandardsPlatformDto = {
7512
+ type: 'object',
7513
+ properties: {
7514
+ id: {
7515
+ type: 'string',
7516
+ description: 'Global platform ID'
7517
+ },
7518
+ name: {
7519
+ type: 'string',
7520
+ description: 'Platform name (e.g., "ICBC")'
7521
+ },
7522
+ canonical: {
7523
+ type: 'string',
7524
+ description: 'Canonical identifier in ACCOUNT_RE format (e.g., "icbc")'
7525
+ },
7526
+ suggestedSegment: {
7527
+ type: 'string',
7528
+ description:
7529
+ 'Suggested path segment — canonical PascalCased per hyphen-part, hyphens preserved (e.g. "Apple-Pay")'
7530
+ },
7531
+ type: {
7532
+ type: 'string',
7533
+ description: 'Platform type',
7534
+ enum: [
7535
+ 'BANK',
7536
+ 'BROKERAGE',
7537
+ 'CRYPTO_EXCHANGE',
7538
+ 'PAYMENT',
7539
+ 'INVESTMENT',
7540
+ 'INSURANCE',
7541
+ 'OTHER'
7542
+ ]
7543
+ },
7544
+ category: {
7545
+ type: 'string',
7546
+ description:
7547
+ 'Region-aware category (institution vocab, e.g. DigitalWallet/Bank) resolved against the final region. null = no region-aware suggestion; fall back to type.',
7548
+ nullable: true,
7549
+ example: 'Bank'
7550
+ }
7551
+ },
7552
+ required: ['id', 'name', 'canonical', 'suggestedSegment', 'type', 'category']
7553
+ } as const;
7554
+
7555
+ export const $PlatformStandardsResponseDto = {
7556
+ type: 'object',
7557
+ properties: {
7558
+ platform: {
7559
+ description: 'The selected platform (institution lock source)',
7560
+ allOf: [
7561
+ {
7562
+ $ref: '#/components/schemas/PlatformStandardsPlatformDto'
7563
+ }
7564
+ ]
7565
+ },
7566
+ region: {
7567
+ type: 'string',
7568
+ description:
7569
+ "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.",
7570
+ example: 'CN'
7571
+ },
7572
+ templates: {
7573
+ description:
7574
+ 'Candidate account-standard templates of the resolved region (groupable by productCategory client-side)',
7575
+ type: 'array',
7576
+ items: {
7577
+ $ref: '#/components/schemas/AccountStandardResponseDto'
7578
+ }
7579
+ }
7580
+ },
7581
+ required: ['platform', 'region', 'templates']
7582
+ } as const;
7583
+
7370
7584
  export const $CreatePlatformDto = {
7371
7585
  type: 'object',
7372
7586
  properties: {
@@ -7468,7 +7682,8 @@ export const $UpdatePlatformDto = {
7468
7682
  },
7469
7683
  isActive: {
7470
7684
  type: 'boolean',
7471
- description: 'Whether the platform is active'
7685
+ description: 'Whether the platform is active',
7686
+ default: true
7472
7687
  }
7473
7688
  }
7474
7689
  } as const;
@@ -7631,7 +7846,8 @@ export const $AccountItemDto = {
7631
7846
  },
7632
7847
  displayName: {
7633
7848
  type: 'string',
7634
- description: 'Display name (last part of account path)',
7849
+ description:
7850
+ '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)',
7635
7851
  example: 'Savings'
7636
7852
  },
7637
7853
  balance: {
@@ -7667,7 +7883,8 @@ export const $PlatformGroupDto = {
7667
7883
  example: 'CMB Bank'
7668
7884
  },
7669
7885
  accounts: {
7670
- description: 'Accounts within this platform',
7886
+ description:
7887
+ 'Accounts within this platform (Assets and Liabilities rows, #696)',
7671
7888
  type: 'array',
7672
7889
  items: {
7673
7890
  $ref: '#/components/schemas/AccountItemDto'
@@ -7675,7 +7892,8 @@ export const $PlatformGroupDto = {
7675
7892
  },
7676
7893
  totalBalance: {
7677
7894
  type: 'string',
7678
- description: 'FX-converted total balance in base currency',
7895
+ description:
7896
+ 'FX-converted total balance in base currency (nets Assets + Liabilities rows; can be negative)',
7679
7897
  example: '100000.00'
7680
7898
  },
7681
7899
  balanceByCurrency: {
@@ -7694,7 +7912,7 @@ export const $PlatformGroupDto = {
7694
7912
  sharePct: {
7695
7913
  type: 'number',
7696
7914
  description:
7697
- 'Share of the grand converted total (0-100); 0 when grand total is 0',
7915
+ 'Share of the converted asset-side grand total (0-100); liability balances are excluded from the basis; 0 when grand total is 0 (#696)',
7698
7916
  example: 42.5
7699
7917
  }
7700
7918
  },
@@ -7742,7 +7960,8 @@ export const $AccountsSummaryDto = {
7742
7960
  properties: {
7743
7961
  totalAccounts: {
7744
7962
  type: 'number',
7745
- description: 'Total number of accounts'
7963
+ description:
7964
+ 'Total number of accounts (balance sheet: Assets + Liabilities, #696)'
7746
7965
  },
7747
7966
  totalPlatforms: {
7748
7967
  type: 'number',
@@ -7800,7 +8019,8 @@ export const $AccountItemWithAssetClassDto = {
7800
8019
  },
7801
8020
  displayName: {
7802
8021
  type: 'string',
7803
- description: 'Display name (last part of account path)',
8022
+ description:
8023
+ '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)',
7804
8024
  example: 'Savings'
7805
8025
  },
7806
8026
  balance: {
@@ -8286,7 +8506,7 @@ export const $MonetaryDto = {
8286
8506
  example: 'USD'
8287
8507
  },
8288
8508
  baseCcyEquivalent: {
8289
- type: 'object',
8509
+ type: 'string',
8290
8510
  description: 'Converted to user base currency (Decimal string)',
8291
8511
  example: '21600',
8292
8512
  nullable: true
@@ -8362,13 +8582,13 @@ export const $HoldingPnlRowDto = {
8362
8582
  example: 'Assets:US:Broker:AAPL'
8363
8583
  },
8364
8584
  accountCcy: {
8365
- type: 'object',
8585
+ type: 'string',
8366
8586
  description: 'Account settlement currency (ISO 4217), from cost currency',
8367
8587
  nullable: true,
8368
8588
  example: 'USD'
8369
8589
  },
8370
8590
  brokerType: {
8371
- type: 'object',
8591
+ type: 'string',
8372
8592
  description: 'Broker type derived from Platform.type',
8373
8593
  nullable: true,
8374
8594
  example: 'broker'
@@ -8389,7 +8609,7 @@ export const $HoldingPnlRowDto = {
8389
8609
  example: 'EQUITY'
8390
8610
  },
8391
8611
  assetSubClass: {
8392
- type: 'object',
8612
+ type: 'string',
8393
8613
  nullable: true,
8394
8614
  example: 'STOCK'
8395
8615
  },
@@ -8436,14 +8656,14 @@ export const $HoldingPnlRowDto = {
8436
8656
  ]
8437
8657
  },
8438
8658
  unrealizedPnlBase: {
8439
- type: 'object',
8659
+ type: 'string',
8440
8660
  description:
8441
8661
  'Unrealized P&L in base currency (Decimal string); null when any FX/price missing',
8442
8662
  nullable: true,
8443
8663
  example: '6000'
8444
8664
  },
8445
8665
  unrealizedPnlPct: {
8446
- type: 'object',
8666
+ type: 'string',
8447
8667
  description: 'Unrealized P&L % (Decimal string)',
8448
8668
  nullable: true,
8449
8669
  example: '25'
@@ -8467,7 +8687,7 @@ export const $HoldingPnlRowDto = {
8467
8687
  ]
8468
8688
  },
8469
8689
  pctOfInvestedAssets: {
8470
- type: 'object',
8690
+ type: 'string',
8471
8691
  description:
8472
8692
  'Share of invested assets % (Decimal string); only for invested chartTokens',
8473
8693
  nullable: true,
@@ -8512,15 +8732,15 @@ export const $HoldingPnlWarningDto = {
8512
8732
  ]
8513
8733
  },
8514
8734
  symbol: {
8515
- type: 'object',
8735
+ type: 'string',
8516
8736
  nullable: true
8517
8737
  },
8518
8738
  accountId: {
8519
- type: 'object',
8739
+ type: 'string',
8520
8740
  nullable: true
8521
8741
  },
8522
8742
  currency: {
8523
- type: 'object',
8743
+ type: 'string',
8524
8744
  nullable: true
8525
8745
  }
8526
8746
  },
@@ -8802,35 +9022,35 @@ export const $SymbolSearchResultDto = {
8802
9022
  example: 'AAPL'
8803
9023
  },
8804
9024
  name: {
8805
- type: 'object',
9025
+ type: 'string',
8806
9026
  example: 'Apple Inc.',
8807
9027
  nullable: true
8808
9028
  },
8809
9029
  exchange: {
8810
- type: 'object',
9030
+ type: 'string',
8811
9031
  example: 'US',
8812
9032
  nullable: true
8813
9033
  },
8814
9034
  assetType: {
8815
- type: 'object',
9035
+ type: 'string',
8816
9036
  description: 'OpenBB asset_type (e.g. stock, etf)',
8817
9037
  example: 'stock',
8818
9038
  nullable: true
8819
9039
  },
8820
9040
  assetClass: {
8821
- type: 'object',
9041
+ type: 'string',
8822
9042
  description: 'IGN asset class (region.types.ts ASSET_CLASSES)',
8823
9043
  example: 'EQUITY',
8824
9044
  nullable: true
8825
9045
  },
8826
9046
  assetSubClass: {
8827
- type: 'object',
9047
+ type: 'string',
8828
9048
  description: 'IGN asset sub-class (region.types.ts ASSET_SUB_CLASSES)',
8829
9049
  example: 'STOCK',
8830
9050
  nullable: true
8831
9051
  },
8832
9052
  currency: {
8833
- type: 'object',
9053
+ type: 'string',
8834
9054
  description: 'Trading currency (extra_data or inferred from exchange)',
8835
9055
  example: 'USD',
8836
9056
  nullable: true
@@ -8847,90 +9067,90 @@ export const $SymbolQuoteDto = {
8847
9067
  example: 'AAPL'
8848
9068
  },
8849
9069
  name: {
8850
- type: 'object',
9070
+ type: 'string',
8851
9071
  example: 'Apple Inc.',
8852
9072
  nullable: true
8853
9073
  },
8854
9074
  exchange: {
8855
- type: 'object',
9075
+ type: 'string',
8856
9076
  example: 'US',
8857
9077
  nullable: true
8858
9078
  },
8859
9079
  assetType: {
8860
- type: 'object',
9080
+ type: 'string',
8861
9081
  description: 'OpenBB asset_type',
8862
9082
  example: 'stock',
8863
9083
  nullable: true
8864
9084
  },
8865
9085
  assetClass: {
8866
- type: 'object',
9086
+ type: 'string',
8867
9087
  description: 'IGN asset class',
8868
9088
  example: 'EQUITY',
8869
9089
  nullable: true
8870
9090
  },
8871
9091
  assetSubClass: {
8872
- type: 'object',
9092
+ type: 'string',
8873
9093
  description: 'IGN asset sub-class',
8874
9094
  example: 'STOCK',
8875
9095
  nullable: true
8876
9096
  },
8877
9097
  currency: {
8878
- type: 'object',
9098
+ type: 'string',
8879
9099
  description: 'Trading currency (extra_data or inferred from exchange)',
8880
9100
  example: 'USD',
8881
9101
  nullable: true
8882
9102
  },
8883
9103
  price: {
8884
- type: 'object',
9104
+ type: 'string',
8885
9105
  description: 'Latest price (Decimal string)',
8886
9106
  example: '189.84',
8887
9107
  nullable: true
8888
9108
  },
8889
9109
  priceDate: {
8890
- type: 'object',
9110
+ type: 'string',
8891
9111
  description: 'Date the price was observed (ISO yyyy-MM-dd)',
8892
9112
  example: '2026-08-05',
8893
9113
  nullable: true
8894
9114
  },
8895
9115
  changePercent: {
8896
- type: 'object',
9116
+ type: 'number',
8897
9117
  description:
8898
9118
  '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.',
8899
9119
  example: 1.7,
8900
9120
  nullable: true
8901
9121
  },
8902
9122
  prevClose: {
8903
- type: 'object',
9123
+ type: 'string',
8904
9124
  description: 'Previous close (Decimal string)',
8905
9125
  nullable: true
8906
9126
  },
8907
9127
  open: {
8908
- type: 'object',
9128
+ type: 'string',
8909
9129
  description: 'Day open (Decimal string)',
8910
9130
  nullable: true
8911
9131
  },
8912
9132
  high: {
8913
- type: 'object',
9133
+ type: 'string',
8914
9134
  description: 'Day high (Decimal string)',
8915
9135
  nullable: true
8916
9136
  },
8917
9137
  low: {
8918
- type: 'object',
9138
+ type: 'string',
8919
9139
  description: 'Day low (Decimal string)',
8920
9140
  nullable: true
8921
9141
  },
8922
9142
  volume: {
8923
- type: 'object',
9143
+ type: 'string',
8924
9144
  description: 'Day volume (Decimal string)',
8925
9145
  nullable: true
8926
9146
  },
8927
9147
  yearHigh: {
8928
- type: 'object',
9148
+ type: 'string',
8929
9149
  description: '52-week high (Decimal string)',
8930
9150
  nullable: true
8931
9151
  },
8932
9152
  yearLow: {
8933
- type: 'object',
9153
+ type: 'string',
8934
9154
  description: '52-week low (Decimal string)',
8935
9155
  nullable: true
8936
9156
  }