@ingenx-io/valets-schema-mcp-server 0.2.6 → 0.2.8

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.
Files changed (82) hide show
  1. package/data/docs/collections/firestore-paths.md +20 -0
  2. package/data/docs/enums/app-status.md +1 -1
  3. package/data/docs/enums/attention-status.md +1 -1
  4. package/data/docs/enums/booking-status.md +1 -1
  5. package/data/docs/enums/contract-status.md +1 -1
  6. package/data/docs/enums/customer-payment-status.md +1 -1
  7. package/data/docs/enums/customer-payment-target-type.md +1 -1
  8. package/data/docs/enums/delivery-type.md +1 -1
  9. package/data/docs/enums/deployment-link-type.md +1 -1
  10. package/data/docs/enums/event-status.md +1 -1
  11. package/data/docs/enums/expense-payment-status.md +24 -0
  12. package/data/docs/enums/fulfillment-status.md +2 -2
  13. package/data/docs/enums/loyalty-transaction-type.md +2 -2
  14. package/data/docs/enums/milestone-status.md +2 -2
  15. package/data/docs/enums/notification-channel.md +2 -2
  16. package/data/docs/enums/notification-entity-type.md +2 -2
  17. package/data/docs/enums/notification-status.md +2 -2
  18. package/data/docs/enums/order-status.md +2 -2
  19. package/data/docs/enums/outbound-message-format.md +2 -2
  20. package/data/docs/enums/outbound-message-purpose.md +2 -2
  21. package/data/docs/enums/outbound-message-status.md +2 -2
  22. package/data/docs/enums/payment-method.md +4 -3
  23. package/data/docs/enums/payment-proof-status.md +2 -2
  24. package/data/docs/enums/payment-status.md +2 -2
  25. package/data/docs/enums/pending-issue.md +2 -2
  26. package/data/docs/enums/return-status.md +2 -2
  27. package/data/docs/enums/session-status.md +2 -2
  28. package/data/docs/enums/site-status.md +2 -2
  29. package/data/docs/enums/stocktake-frequency.md +2 -2
  30. package/data/docs/enums/stocktake-item-status.md +2 -2
  31. package/data/docs/enums/stocktake-status.md +2 -2
  32. package/data/docs/enums/ticket-status.md +2 -2
  33. package/data/docs/enums/waba-label.md +2 -2
  34. package/data/docs/enums/whatsapp-button-sub-type.md +2 -2
  35. package/data/docs/enums/whatsapp-template-component.md +2 -2
  36. package/data/docs/enums/whatsapp-template-status.md +2 -2
  37. package/data/docs/index.md +8 -5
  38. package/data/docs/models/allowed-user.md +1 -1
  39. package/data/docs/models/analytics-backfill.md +1 -1
  40. package/data/docs/models/analytics-daily.md +1 -1
  41. package/data/docs/models/analytics-event.md +1 -1
  42. package/data/docs/models/analytics-hourly.md +1 -1
  43. package/data/docs/models/app-payment.md +1 -1
  44. package/data/docs/models/app.md +1 -1
  45. package/data/docs/models/booking-version.md +1 -1
  46. package/data/docs/models/booking.md +1 -1
  47. package/data/docs/models/contract.md +1 -1
  48. package/data/docs/models/customer-payment-allocation.md +1 -1
  49. package/data/docs/models/customer-payment.md +22 -21
  50. package/data/docs/models/customer.md +1 -1
  51. package/data/docs/models/event.md +1 -1
  52. package/data/docs/models/expense.md +434 -0
  53. package/data/docs/models/loyalty-config.md +2 -2
  54. package/data/docs/models/loyalty-reward.md +2 -2
  55. package/data/docs/models/loyalty-status.md +2 -2
  56. package/data/docs/models/loyalty-transaction.md +2 -2
  57. package/data/docs/models/magic-link-request.md +2 -2
  58. package/data/docs/models/metrics-current.md +22 -2
  59. package/data/docs/models/metrics-daily.md +92 -41
  60. package/data/docs/models/metrics-monthly.md +22 -2
  61. package/data/docs/models/notification-record.md +68 -35
  62. package/data/docs/models/order-item.md +2 -2
  63. package/data/docs/models/order.md +56 -55
  64. package/data/docs/models/outbound-payment-allocation.md +2 -2
  65. package/data/docs/models/outbound-payment.md +3 -2
  66. package/data/docs/models/payment-webhook-delivery.md +321 -0
  67. package/data/docs/models/payment-webhook-endpoint.md +2 -2
  68. package/data/docs/models/sale.md +2 -2
  69. package/data/docs/models/site-payment.md +2 -2
  70. package/data/docs/models/site.md +2 -2
  71. package/data/docs/models/stocktake-item.md +2 -2
  72. package/data/docs/models/stocktake.md +2 -2
  73. package/data/docs/models/ticket.md +2 -2
  74. package/data/docs/models/user.md +2 -2
  75. package/data/docs/models/whatsapp-inbound-message.md +42 -18
  76. package/data/docs/models/whatsapp-outbound-lifecycle-event.md +2 -2
  77. package/data/docs/models/whatsapp-outbound-message.md +56 -32
  78. package/data/docs/models/whatsapp-template.md +2 -2
  79. package/data/static/llms.txt +110 -11
  80. package/data/static/openapi.yaml +444 -15
  81. package/data/static/schemas.json +394 -13
  82. package/package.json +1 -1
@@ -344,7 +344,7 @@ Do not include in write requests. This field is set exclusively by the server (F
344
344
  | **Maximum** | ≤ 9007199254740991 |
345
345
 
346
346
  ----------------------------------------------------------------------------------------------------------------------------
347
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 13:38:44 +0000
347
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 14:38:10 +0000
348
348
 
349
349
  :::warning Server-set
350
350
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
@@ -530,4 +530,4 @@ Must be one of:
530
530
  | **Additional properties** | Any type allowed |
531
531
 
532
532
  ----------------------------------------------------------------------------------------------------------------------------
533
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 13:38:44 +0000
533
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 14:38:10 +0000
@@ -365,7 +365,7 @@ Do not include in write requests. This field is set exclusively by the server (F
365
365
  | **Maximum** | ≤ 9007199254740991 |
366
366
 
367
367
  ----------------------------------------------------------------------------------------------------------------------------
368
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 13:38:44 +0000
368
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 14:38:10 +0000
369
369
 
370
370
  :::warning Server-set
371
371
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
@@ -197,4 +197,4 @@ Set at creation only. This field cannot be modified after the document is create
197
197
  | **Maximum** | ≤ 9007199254740991 |
198
198
 
199
199
  ----------------------------------------------------------------------------------------------------------------------------
200
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 13:38:44 +0000
200
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 14:38:10 +0000
@@ -570,7 +570,7 @@ Do not include in write requests. This field is set exclusively by the server (F
570
570
  **Description:** Timestamp of the most recent analytics event seen for this app.
571
571
 
572
572
  ----------------------------------------------------------------------------------------------------------------------------
573
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 13:38:44 +0000
573
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 14:38:10 +0000
574
574
 
575
575
  :::warning Server-set
576
576
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
@@ -270,7 +270,7 @@ Dot-notation paths for nested fields (e.g. "bookingDates.0.status"). Populated b
270
270
  | **Additional properties** | Any type allowed |
271
271
 
272
272
  ----------------------------------------------------------------------------------------------------------------------------
273
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 13:38:45 +0000
273
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 14:38:10 +0000
274
274
 
275
275
  :::warning Server-set
276
276
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
@@ -1739,7 +1739,7 @@ Set at creation only. This field cannot be modified after the document is create
1739
1739
  **Description:** When true, suppresses Firebase notification triggers (D20/IG-8).
1740
1740
 
1741
1741
  ----------------------------------------------------------------------------------------------------------------------------
1742
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 13:38:45 +0000
1742
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 14:38:10 +0000
1743
1743
 
1744
1744
  ## Related Decisions
1745
1745
 
@@ -447,7 +447,7 @@ Do not include in write requests. This field is set exclusively by the server (F
447
447
  | **Required** | No |
448
448
 
449
449
  ----------------------------------------------------------------------------------------------------------------------------
450
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 13:38:45 +0000
450
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 14:38:10 +0000
451
451
 
452
452
  :::warning Server-set
453
453
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
@@ -329,7 +329,7 @@ Set at creation only. This field cannot be modified after the document is create
329
329
  | **Maximum** | ≤ 9007199254740991 |
330
330
 
331
331
  ----------------------------------------------------------------------------------------------------------------------------
332
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 13:38:45 +0000
332
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 14:38:10 +0000
333
333
 
334
334
  :::warning Server-set
335
335
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
@@ -67,25 +67,25 @@ sidebar_position: 12
67
67
 
68
68
  **Description:** CustomerPayment model (D22). Collection: companies/\{companyId\}/customerPayments/\{paymentId\}. Dashboard-only today; Mobile read in Wave 2, write in Wave 4 (trusted-party workflow).
69
69
 
70
- | Property | Pattern | Type | Deprecated | Definition | Title/Description |
71
- | -------------------------------------- | ------- | ---------------- | ---------- | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
72
- | - [id](#id ) | No | string or null | No | - | (Read-only) Firestore document ID. Note: optional in current schema — some legacy docs may lack this field. |
73
- | + [companyId](#companyId ) | No | string | No | - | (Immutable) FK → Company document ID. Scopes all queries. |
74
- | + [customerId](#customerId ) | No | string | No | - | (Immutable) FK → Customer.id (Firestore doc ID). Links payment to customer. Set at creation. |
75
- | - [customerName](#customerName ) | No | string or null | No | - | (Denormalized) From Customer.name at write time. |
76
- | + [amount](#amount ) | No | number | No | - | - |
77
- | + [currency](#currency ) | No | const | No | - | Currency code. Locked to XOF (West African CFA franc) for now. |
78
- | + [paymentDate](#paymentDate ) | No | object | No | In #/definitions/firestore-timestamp | Firestore Timestamp — Admin SDK form: \{ _seconds, _nanoseconds \}. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
79
- | + [paymentMethod](#paymentMethod ) | No | enum (of string) | No | In #/definitions/payment-method | Unified payment method set with African + global methods (D02). |
80
- | + [referenceNumber](#referenceNumber ) | No | string | No | - | Unique payment reference (receipt number, transaction ID, etc.). |
81
- | + [allocatedAmount](#allocatedAmount ) | No | number | No | - | (Read-only) Total amount allocated to bookings/orders/purchases via allocations. Server-calculated. |
82
- | + [unappliedAmount](#unappliedAmount ) | No | number | No | - | (Read-only) Remaining unallocated amount (amount - allocatedAmount). Server-calculated. |
83
- | + [status](#status ) | No | enum (of string) | No | In #/definitions/customer-payment-status | Customer payment lifecycle status (D22). Tracks allocation progress of received payments. |
84
- | - [notes](#notes ) | No | string or null | No | - | - |
85
- | + [recordedBy](#recordedBy ) | No | string | No | - | (Immutable) FK → User/staff UID who recorded the payment. Required audit field (D22/IG-7). |
86
- | - [recordedByName](#recordedByName ) | No | string or null | No | - | (Immutable, Denormalized) From User display name at creation time. |
87
- | + [createdAt](#createdAt ) | No | object | No | In #/definitions/firestore-timestamp | (Read-only) Server-generated creation timestamp. |
88
- | - [updatedAt](#updatedAt ) | No | Combination | No | - | (Read-only) Server-generated update timestamp. |
70
+ | Property | Pattern | Type | Deprecated | Definition | Title/Description |
71
+ | -------------------------------------- | ------- | ---------------- | ---------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
72
+ | - [id](#id ) | No | string or null | No | - | (Read-only) Firestore document ID. Note: optional in current schema — some legacy docs may lack this field. |
73
+ | + [companyId](#companyId ) | No | string | No | - | (Immutable) FK → Company document ID. Scopes all queries. |
74
+ | + [customerId](#customerId ) | No | string | No | - | (Immutable) FK → Customer.id (Firestore doc ID). Links payment to customer. Set at creation. |
75
+ | - [customerName](#customerName ) | No | string or null | No | - | (Denormalized) From Customer.name at write time. |
76
+ | + [amount](#amount ) | No | number | No | - | - |
77
+ | + [currency](#currency ) | No | const | No | - | Currency code. Locked to XOF (West African CFA franc) for now. |
78
+ | + [paymentDate](#paymentDate ) | No | object | No | In #/definitions/firestore-timestamp | Firestore Timestamp — Admin SDK form: \{ _seconds, _nanoseconds \}. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
79
+ | + [paymentMethod](#paymentMethod ) | No | enum (of string) | No | In #/definitions/payment-method | Unified payment method set with African + global methods (D02). Note: the metrics writer historically emits "OM" instead of "ORANGE_MONEY" as a paymentsByMethod map key — treat OM as deprecated; canonical value is ORANGE_MONEY (#21). |
80
+ | + [referenceNumber](#referenceNumber ) | No | string | No | - | Unique payment reference (receipt number, transaction ID, etc.). |
81
+ | + [allocatedAmount](#allocatedAmount ) | No | number | No | - | (Read-only) Total amount allocated to bookings/orders/purchases via allocations. Server-calculated. |
82
+ | + [unappliedAmount](#unappliedAmount ) | No | number | No | - | (Read-only) Remaining unallocated amount (amount - allocatedAmount). Server-calculated. |
83
+ | + [status](#status ) | No | enum (of string) | No | In #/definitions/customer-payment-status | Customer payment lifecycle status (D22). Tracks allocation progress of received payments. |
84
+ | - [notes](#notes ) | No | string or null | No | - | - |
85
+ | + [recordedBy](#recordedBy ) | No | string | No | - | (Immutable) FK → User/staff UID who recorded the payment. Required audit field (D22/IG-7). |
86
+ | - [recordedByName](#recordedByName ) | No | string or null | No | - | (Immutable, Denormalized) From User display name at creation time. |
87
+ | + [createdAt](#createdAt ) | No | object | No | In #/definitions/firestore-timestamp | (Read-only) Server-generated creation timestamp. |
88
+ | - [updatedAt](#updatedAt ) | No | Combination | No | - | (Read-only) Server-generated update timestamp. |
89
89
 
90
90
  ## <a name="id"></a>1. Property `id`
91
91
 
@@ -201,7 +201,7 @@ Specific value: `"XOF"`
201
201
  | **Required** | Yes |
202
202
  | **Defined in** | #/definitions/payment-method |
203
203
 
204
- **Description:** Unified payment method set with African + global methods (D02).
204
+ **Description:** Unified payment method set with African + global methods (D02). Note: the metrics writer historically emits "OM" instead of "ORANGE_MONEY" as a paymentsByMethod map key — treat OM as deprecated; canonical value is ORANGE_MONEY (#21).
205
205
 
206
206
  Must be one of:
207
207
  * "CASH"
@@ -214,6 +214,7 @@ Must be one of:
214
214
  * "PAYPAL"
215
215
  * "STRIPE"
216
216
  * "OTHER"
217
+ * "OM"
217
218
 
218
219
  ## <a name="referenceNumber"></a>9. Property `referenceNumber`
219
220
 
@@ -379,7 +380,7 @@ Do not include in write requests. This field is set exclusively by the server (F
379
380
  | **Required** | No |
380
381
 
381
382
  ----------------------------------------------------------------------------------------------------------------------------
382
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 13:38:45 +0000
383
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 14:38:10 +0000
383
384
 
384
385
  :::warning Server-set
385
386
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
@@ -459,7 +459,7 @@ Do not include in write requests. This field is set exclusively by the server (F
459
459
  **Description:** (Read-only, Denormalized) Derived summary from loyalty/status subcollection (D08). Source of truth is LoyaltyStatus.pointsBalance.
460
460
 
461
461
  ----------------------------------------------------------------------------------------------------------------------------
462
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 13:38:45 +0000
462
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 14:38:10 +0000
463
463
 
464
464
  :::warning Server-set
465
465
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
@@ -372,7 +372,7 @@ Do not include in write requests. This field is set exclusively by the server (F
372
372
  **Description:** (Immutable) FK → User/staff UID who created this event.
373
373
 
374
374
  ----------------------------------------------------------------------------------------------------------------------------
375
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 13:38:45 +0000
375
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 14:38:10 +0000
376
376
 
377
377
  :::info Immutable
378
378
  Set at creation only. This field cannot be modified after the document is created. Include it in CREATE payloads; omit it (or leave unchanged) in UPDATE payloads.
@@ -0,0 +1,434 @@
1
+ ---
2
+ title: "Expense"
3
+ sidebar_label: "Expense"
4
+ sidebar_position: 15
5
+ ---
6
+
7
+ # Expense
8
+
9
+ <details>
10
+ <summary>Example JSON</summary>
11
+
12
+ ```json
13
+ {
14
+ "id": null,
15
+ "companyId": "comp_xyz789",
16
+ "title": "title",
17
+ "description": null,
18
+ "amount": 45000,
19
+ "currency": "XOF",
20
+ "dueDate": "dueDate",
21
+ "paymentStatus": "paymentStatus",
22
+ "amountDue": null,
23
+ "amountPaid": null,
24
+ "allocatedAmount": null,
25
+ "balance": null,
26
+ "paidDate": "pai_ref123",
27
+ "paymentReference": null,
28
+ "createdBy": "staff_k0f1",
29
+ "createdAt": "createdAt",
30
+ "updatedAt": "updatedAt"
31
+ }
32
+ ```
33
+
34
+ </details>
35
+
36
+
37
+ - [1. Property `id`](#id)
38
+ - [2. Property `companyId`](#companyId)
39
+ - [3. Property `title`](#title)
40
+ - [4. Property `description`](#description)
41
+ - [5. Property `amount`](#amount)
42
+ - [6. Property `currency`](#currency)
43
+ - [7. Property `dueDate`](#dueDate)
44
+ - [7.1. Property `firestore-timestamp`](#dueDate_anyOf_i0)
45
+ - [7.1.1. Property `_seconds`](#dueDate_anyOf_i0__seconds)
46
+ - [7.1.2. Property `_nanoseconds`](#dueDate_anyOf_i0__nanoseconds)
47
+ - [7.2. Property `item 1`](#dueDate_anyOf_i1)
48
+ - [8. Property `paymentStatus`](#paymentStatus)
49
+ - [9. Property `amountDue`](#amountDue)
50
+ - [10. Property `amountPaid`](#amountPaid)
51
+ - [11. Property `allocatedAmount`](#allocatedAmount)
52
+ - [12. Property `balance`](#balance)
53
+ - [13. Property `paidDate`](#paidDate)
54
+ - [13.1. Property `firestore-timestamp`](#paidDate_anyOf_i0)
55
+ - [13.2. Property `item 1`](#paidDate_anyOf_i1)
56
+ - [14. Property `paymentReference`](#paymentReference)
57
+ - [15. Property `createdBy`](#createdBy)
58
+ - [16. Property `createdAt`](#createdAt)
59
+ - [16.1. Property `firestore-timestamp`](#createdAt_anyOf_i0)
60
+ - [16.2. Property `item 1`](#createdAt_anyOf_i1)
61
+ - [17. Property `updatedAt`](#updatedAt)
62
+ - [17.1. Property `firestore-timestamp`](#updatedAt_anyOf_i0)
63
+ - [17.2. Property `item 1`](#updatedAt_anyOf_i1)
64
+
65
+ | | |
66
+ | ------------------------- | --------------------- |
67
+ | **Type** | `object` |
68
+ | **Required** | No |
69
+ | **Additional properties** | Not allowed |
70
+ | **Defined in** | #/definitions/expense |
71
+
72
+ **Description:** Expense (GH#12/#13/#19 partial). Collection: companies/\{companyId\}/expenses/\{expenseId\}. Dual balance tracking: amountPaid/amountDue for simple expenses; allocatedAmount/balance (server-set) for allocation-settled expenses. OVERDUE excluded from stored enum — derive at read time. Full domain (Payee FK, Contract FK) in #20.
73
+
74
+ | Property | Pattern | Type | Deprecated | Definition | Title/Description |
75
+ | ---------------------------------------- | ------- | ---------------- | ---------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
76
+ | - [id](#id ) | No | string or null | No | - | (Read-only) Firestore document ID, auto-generated. |
77
+ | + [companyId](#companyId ) | No | string | No | - | (Immutable) FK → Company document ID. |
78
+ | + [title](#title ) | No | string | No | - | Human-readable expense title (e.g. "Loyer mars 2026", "Facture EAU"). |
79
+ | - [description](#description ) | No | string or null | No | - | Optional longer description or notes. |
80
+ | + [amount](#amount ) | No | number | No | - | Total expense amount (XOF). |
81
+ | + [currency](#currency ) | No | const | No | - | Currency code. Locked to XOF. |
82
+ | - [dueDate](#dueDate ) | No | Combination | No | - | When the expense is due. Used to compute OVERDUE state at read time (not stored in paymentStatus). |
83
+ | + [paymentStatus](#paymentStatus ) | No | enum (of string) | No | In #/definitions/expense-payment-status | Current payment status. OVERDUE is never stored — derive from dueDate at read time (#13). |
84
+ | - [amountDue](#amountDue ) | No | number or null | No | - | Amount still owed. Authoritative when no OutboundPaymentAllocation records exist for this expense. |
85
+ | - [amountPaid](#amountPaid ) | No | number or null | No | - | Amount paid to date (simple tracking, no allocations). |
86
+ | - [allocatedAmount](#allocatedAmount ) | No | number or null | No | - | (Read-only) Total amount allocated via OutboundPaymentAllocation records. Authoritative when allocations exist. |
87
+ | - [balance](#balance ) | No | number or null | No | - | (Read-only) Remaining balance: amount minus allocatedAmount. Authoritative when OutboundPaymentAllocation records exist. |
88
+ | - [paidDate](#paidDate ) | No | Combination | No | - | When the expense was fully settled (paymentStatus = PAID). Null otherwise. |
89
+ | - [paymentReference](#paymentReference ) | No | string or null | No | - | Most recent payment transaction reference. Overwritten on each payment; not a full history. |
90
+ | + [createdBy](#createdBy ) | No | string | No | - | (Immutable) FK → User/staff UID who created this expense record. |
91
+ | - [createdAt](#createdAt ) | No | Combination | No | - | (Read-only) Server-generated creation timestamp. |
92
+ | - [updatedAt](#updatedAt ) | No | Combination | No | - | (Read-only) Server-generated last-update timestamp. |
93
+
94
+ ## <a name="id"></a>1. Property `id`
95
+
96
+ | | |
97
+ | ------------ | ---------------- |
98
+ | **Type** | `string or null` |
99
+ | **Required** | No |
100
+
101
+ **Description:** (Read-only) Firestore document ID, auto-generated.
102
+
103
+ :::warning Server-set
104
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
105
+ :::
106
+
107
+ ## <a name="companyId"></a>2. Property `companyId`
108
+
109
+ | | |
110
+ | ------------ | -------- |
111
+ | **Type** | `string` |
112
+ | **Required** | Yes |
113
+
114
+ **Description:** (Immutable) FK → Company document ID.
115
+
116
+ :::info Immutable
117
+ Set at creation only. This field cannot be modified after the document is created. Include it in CREATE payloads; omit it (or leave unchanged) in UPDATE payloads.
118
+ :::
119
+
120
+ ## <a name="title"></a>3. Property `title`
121
+
122
+ | | |
123
+ | ------------ | -------- |
124
+ | **Type** | `string` |
125
+ | **Required** | Yes |
126
+
127
+ **Description:** Human-readable expense title (e.g. "Loyer mars 2026", "Facture EAU").
128
+
129
+ ## <a name="description"></a>4. Property `description`
130
+
131
+ | | |
132
+ | ------------ | ---------------- |
133
+ | **Type** | `string or null` |
134
+ | **Required** | No |
135
+
136
+ **Description:** Optional longer description or notes.
137
+
138
+ ## <a name="amount"></a>5. Property `amount`
139
+
140
+ | | |
141
+ | ------------ | -------- |
142
+ | **Type** | `number` |
143
+ | **Required** | Yes |
144
+
145
+ **Description:** Total expense amount (XOF).
146
+
147
+ ## <a name="currency"></a>6. Property `currency`
148
+
149
+ | | |
150
+ | ------------ | ------- |
151
+ | **Type** | `const` |
152
+ | **Required** | Yes |
153
+
154
+ **Description:** Currency code. Locked to XOF.
155
+
156
+ Specific value: `"XOF"`
157
+
158
+ ## <a name="dueDate"></a>7. Property `dueDate`
159
+
160
+ | | |
161
+ | ------------------------- | ---------------- |
162
+ | **Type** | `combining` |
163
+ | **Required** | No |
164
+ | **Additional properties** | Any type allowed |
165
+
166
+ **Description:** When the expense is due. Used to compute OVERDUE state at read time (not stored in paymentStatus).
167
+
168
+ | Any of(Option) |
169
+ | ---------------------------------------- |
170
+ | [firestore-timestamp](#dueDate_anyOf_i0) |
171
+ | [item 1](#dueDate_anyOf_i1) |
172
+
173
+ ### <a name="dueDate_anyOf_i0"></a>7.1. Property `firestore-timestamp`
174
+
175
+ | | |
176
+ | ------------------------- | --------------------------------- |
177
+ | **Type** | `object` |
178
+ | **Required** | No |
179
+ | **Additional properties** | Not allowed |
180
+ | **Defined in** | #/definitions/firestore-timestamp |
181
+
182
+ **Description:** Firestore Timestamp — Admin SDK form: \{ _seconds, _nanoseconds \}. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10).
183
+
184
+ | Property | Pattern | Type | Deprecated | Definition | Title/Description |
185
+ | ------------------------------------------------- | ------- | ------- | ---------- | ---------- | ----------------- |
186
+ | + [_seconds](#dueDate_anyOf_i0__seconds ) | No | integer | No | - | - |
187
+ | + [_nanoseconds](#dueDate_anyOf_i0__nanoseconds ) | No | integer | No | - | - |
188
+
189
+ #### <a name="dueDate_anyOf_i0__seconds"></a>7.1.1. Property `_seconds`
190
+
191
+ | | |
192
+ | ------------ | --------- |
193
+ | **Type** | `integer` |
194
+ | **Required** | Yes |
195
+
196
+ | Restrictions | |
197
+ | ------------ | ---------------------- |
198
+ | **Minimum** | &ge; -9007199254740991 |
199
+ | **Maximum** | &le; 9007199254740991 |
200
+
201
+ #### <a name="dueDate_anyOf_i0__nanoseconds"></a>7.1.2. Property `_nanoseconds`
202
+
203
+ | | |
204
+ | ------------ | --------- |
205
+ | **Type** | `integer` |
206
+ | **Required** | Yes |
207
+
208
+ | Restrictions | |
209
+ | ------------ | ---------------------- |
210
+ | **Minimum** | &ge; -9007199254740991 |
211
+ | **Maximum** | &le; 9007199254740991 |
212
+
213
+ ### <a name="dueDate_anyOf_i1"></a>7.2. Property `item 1`
214
+
215
+ | | |
216
+ | ------------ | ------ |
217
+ | **Type** | `null` |
218
+ | **Required** | No |
219
+
220
+ ## <a name="paymentStatus"></a>8. Property `paymentStatus`
221
+
222
+ | | |
223
+ | -------------- | ------------------------------------ |
224
+ | **Type** | `enum (of string)` |
225
+ | **Required** | Yes |
226
+ | **Defined in** | #/definitions/expense-payment-status |
227
+
228
+ **Description:** Current payment status. OVERDUE is never stored — derive from dueDate at read time (#13).
229
+
230
+ Must be one of:
231
+ * "PENDING"
232
+ * "PARTIALLY_PAID"
233
+ * "PAID"
234
+ * "FAILED"
235
+
236
+ :::note
237
+ OVERDUE is intentionally excluded — it is never stored in Firestore. Compute it at read time: expense.paymentStatus !== PAID && expense.dueDate < now() (#13). Helper: isExpenseOverdue(expense: Expense): boolean.
238
+ :::
239
+
240
+ ## <a name="amountDue"></a>9. Property `amountDue`
241
+
242
+ | | |
243
+ | ------------ | ---------------- |
244
+ | **Type** | `number or null` |
245
+ | **Required** | No |
246
+
247
+ **Description:** Amount still owed. Authoritative when no OutboundPaymentAllocation records exist for this expense.
248
+
249
+ :::note
250
+ Authoritative for simple (non-allocation) expenses. Legacy field maintained for backward compatibility when no OutboundPaymentAllocation records exist (#12).
251
+ :::
252
+
253
+ ## <a name="amountPaid"></a>10. Property `amountPaid`
254
+
255
+ | | |
256
+ | ------------ | ---------------- |
257
+ | **Type** | `number or null` |
258
+ | **Required** | No |
259
+
260
+ **Description:** Amount paid to date (simple tracking, no allocations).
261
+
262
+ ## <a name="allocatedAmount"></a>11. Property `allocatedAmount`
263
+
264
+ | | |
265
+ | ------------ | ---------------- |
266
+ | **Type** | `number or null` |
267
+ | **Required** | No |
268
+
269
+ **Description:** (Read-only) Total amount allocated via OutboundPaymentAllocation records. Authoritative when allocations exist.
270
+
271
+ :::warning Server-set
272
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
273
+ :::
274
+
275
+ :::note
276
+ Server-set — computed from OutboundPaymentAllocation records. Clients must never write this field (#12).
277
+ :::
278
+
279
+ ## <a name="balance"></a>12. Property `balance`
280
+
281
+ | | |
282
+ | ------------ | ---------------- |
283
+ | **Type** | `number or null` |
284
+ | **Required** | No |
285
+
286
+ **Description:** (Read-only) Remaining balance: amount minus allocatedAmount. Authoritative when OutboundPaymentAllocation records exist.
287
+
288
+ :::warning Server-set
289
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
290
+ :::
291
+
292
+ :::note
293
+ Server-set — computed as amount - allocatedAmount. Authoritative remaining amount when allocations exist. Prefer this over amountDue when OutboundPaymentAllocation records are present (#12).
294
+ :::
295
+
296
+ ## <a name="paidDate"></a>13. Property `paidDate`
297
+
298
+ | | |
299
+ | ------------------------- | ---------------- |
300
+ | **Type** | `combining` |
301
+ | **Required** | No |
302
+ | **Additional properties** | Any type allowed |
303
+
304
+ **Description:** When the expense was fully settled (paymentStatus = PAID). Null otherwise.
305
+
306
+ | Any of(Option) |
307
+ | ----------------------------------------- |
308
+ | [firestore-timestamp](#paidDate_anyOf_i0) |
309
+ | [item 1](#paidDate_anyOf_i1) |
310
+
311
+ ### <a name="paidDate_anyOf_i0"></a>13.1. Property `firestore-timestamp`
312
+
313
+ | | |
314
+ | ------------------------- | ------------------------------------- |
315
+ | **Type** | `object` |
316
+ | **Required** | No |
317
+ | **Additional properties** | Not allowed |
318
+ | **Same definition as** | [dueDate_anyOf_i0](#dueDate_anyOf_i0) |
319
+
320
+ **Description:** Firestore Timestamp — Admin SDK form: \{ _seconds, _nanoseconds \}. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10).
321
+
322
+ ### <a name="paidDate_anyOf_i1"></a>13.2. Property `item 1`
323
+
324
+ | | |
325
+ | ------------ | ------ |
326
+ | **Type** | `null` |
327
+ | **Required** | No |
328
+
329
+ :::tip When to set
330
+ Set when paymentStatus transitions to PAID (fully settled). Null for partially paid or unpaid expenses. For multi-payment history, read OutboundPaymentAllocation records (#19).
331
+ :::
332
+
333
+ ## <a name="paymentReference"></a>14. Property `paymentReference`
334
+
335
+ | | |
336
+ | ------------ | ---------------- |
337
+ | **Type** | `string or null` |
338
+ | **Required** | No |
339
+
340
+ **Description:** Most recent payment transaction reference. Overwritten on each payment; not a full history.
341
+
342
+ :::note
343
+ Reference for the most recent payment transaction (check number, wire ID, Wave ref, etc.). Overwritten on each payment. For full payment history read OutboundPaymentAllocation records (#19).
344
+ :::
345
+
346
+ ## <a name="createdBy"></a>15. Property `createdBy`
347
+
348
+ | | |
349
+ | ------------ | -------- |
350
+ | **Type** | `string` |
351
+ | **Required** | Yes |
352
+
353
+ **Description:** (Immutable) FK → User/staff UID who created this expense record.
354
+
355
+ :::info Immutable
356
+ Set at creation only. This field cannot be modified after the document is created. Include it in CREATE payloads; omit it (or leave unchanged) in UPDATE payloads.
357
+ :::
358
+
359
+ ## <a name="createdAt"></a>16. Property `createdAt`
360
+
361
+ | | |
362
+ | ------------------------- | ---------------- |
363
+ | **Type** | `combining` |
364
+ | **Required** | No |
365
+ | **Additional properties** | Any type allowed |
366
+
367
+ **Description:** (Read-only) Server-generated creation timestamp.
368
+
369
+ | Any of(Option) |
370
+ | ------------------------------------------ |
371
+ | [firestore-timestamp](#createdAt_anyOf_i0) |
372
+ | [item 1](#createdAt_anyOf_i1) |
373
+
374
+ ### <a name="createdAt_anyOf_i0"></a>16.1. Property `firestore-timestamp`
375
+
376
+ | | |
377
+ | ------------------------- | ------------------------------------- |
378
+ | **Type** | `object` |
379
+ | **Required** | No |
380
+ | **Additional properties** | Not allowed |
381
+ | **Same definition as** | [dueDate_anyOf_i0](#dueDate_anyOf_i0) |
382
+
383
+ **Description:** Firestore Timestamp — Admin SDK form: \{ _seconds, _nanoseconds \}. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10).
384
+
385
+ ### <a name="createdAt_anyOf_i1"></a>16.2. Property `item 1`
386
+
387
+ | | |
388
+ | ------------ | ------ |
389
+ | **Type** | `null` |
390
+ | **Required** | No |
391
+
392
+ :::warning Server-set
393
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
394
+ :::
395
+
396
+ ## <a name="updatedAt"></a>17. Property `updatedAt`
397
+
398
+ | | |
399
+ | ------------------------- | ---------------- |
400
+ | **Type** | `combining` |
401
+ | **Required** | No |
402
+ | **Additional properties** | Any type allowed |
403
+
404
+ **Description:** (Read-only) Server-generated last-update timestamp.
405
+
406
+ | Any of(Option) |
407
+ | ------------------------------------------ |
408
+ | [firestore-timestamp](#updatedAt_anyOf_i0) |
409
+ | [item 1](#updatedAt_anyOf_i1) |
410
+
411
+ ### <a name="updatedAt_anyOf_i0"></a>17.1. Property `firestore-timestamp`
412
+
413
+ | | |
414
+ | ------------------------- | ------------------------------------- |
415
+ | **Type** | `object` |
416
+ | **Required** | No |
417
+ | **Additional properties** | Not allowed |
418
+ | **Same definition as** | [dueDate_anyOf_i0](#dueDate_anyOf_i0) |
419
+
420
+ **Description:** Firestore Timestamp — Admin SDK form: \{ _seconds, _nanoseconds \}. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10).
421
+
422
+ ### <a name="updatedAt_anyOf_i1"></a>17.2. Property `item 1`
423
+
424
+ | | |
425
+ | ------------ | ------ |
426
+ | **Type** | `null` |
427
+ | **Required** | No |
428
+
429
+ ----------------------------------------------------------------------------------------------------------------------------
430
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 14:38:10 +0000
431
+
432
+ :::warning Server-set
433
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
434
+ :::
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "LoyaltyConfig"
3
3
  sidebar_label: "LoyaltyConfig"
4
- sidebar_position: 15
4
+ sidebar_position: 16
5
5
  ---
6
6
 
7
7
  # LoyaltyConfig
@@ -304,7 +304,7 @@ Do not include in write requests. This field is set exclusively by the server (F
304
304
  | **Required** | No |
305
305
 
306
306
  ----------------------------------------------------------------------------------------------------------------------------
307
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 13:38:45 +0000
307
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-30 at 14:38:10 +0000
308
308
 
309
309
  :::warning Server-set
310
310
  Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.