@ingenx-io/valets-schema-mcp-server 0.2.2 → 0.2.4

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 (72) hide show
  1. package/README.md +26 -0
  2. package/data/docs/collections/firestore-paths.md +15 -0
  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/customer-payment-status.md +1 -1
  6. package/data/docs/enums/customer-payment-target-type.md +1 -1
  7. package/data/docs/enums/delivery-type.md +1 -1
  8. package/data/docs/enums/deployment-link-type.md +1 -1
  9. package/data/docs/enums/event-status.md +1 -1
  10. package/data/docs/enums/fulfillment-status.md +1 -1
  11. package/data/docs/enums/loyalty-transaction-type.md +1 -1
  12. package/data/docs/enums/notification-channel.md +24 -0
  13. package/data/docs/enums/notification-entity-type.md +26 -0
  14. package/data/docs/enums/notification-status.md +23 -0
  15. package/data/docs/enums/order-status.md +2 -2
  16. package/data/docs/enums/outbound-message-format.md +2 -2
  17. package/data/docs/enums/outbound-message-purpose.md +2 -2
  18. package/data/docs/enums/outbound-message-status.md +2 -2
  19. package/data/docs/enums/payment-method.md +2 -2
  20. package/data/docs/enums/payment-proof-status.md +2 -2
  21. package/data/docs/enums/payment-status.md +2 -2
  22. package/data/docs/enums/pending-issue.md +2 -2
  23. package/data/docs/enums/return-status.md +2 -2
  24. package/data/docs/enums/session-status.md +2 -2
  25. package/data/docs/enums/site-status.md +2 -2
  26. package/data/docs/enums/stocktake-frequency.md +2 -2
  27. package/data/docs/enums/stocktake-item-status.md +2 -2
  28. package/data/docs/enums/stocktake-status.md +2 -2
  29. package/data/docs/enums/ticket-status.md +2 -2
  30. package/data/docs/enums/waba-label.md +2 -2
  31. package/data/docs/enums/whatsapp-button-sub-type.md +2 -2
  32. package/data/docs/enums/whatsapp-template-component.md +2 -2
  33. package/data/docs/enums/whatsapp-template-status.md +2 -2
  34. package/data/docs/index.md +6 -2
  35. package/data/docs/models/allowed-user.md +1 -1
  36. package/data/docs/models/analytics-backfill.md +1 -1
  37. package/data/docs/models/analytics-daily.md +1 -1
  38. package/data/docs/models/analytics-event.md +1 -1
  39. package/data/docs/models/analytics-hourly.md +1 -1
  40. package/data/docs/models/booking-version.md +1 -1
  41. package/data/docs/models/booking.md +1 -1
  42. package/data/docs/models/customer-payment-allocation.md +1 -1
  43. package/data/docs/models/customer-payment.md +1 -1
  44. package/data/docs/models/customer.md +1 -1
  45. package/data/docs/models/event.md +1 -1
  46. package/data/docs/models/loyalty-config.md +1 -1
  47. package/data/docs/models/loyalty-reward.md +1 -1
  48. package/data/docs/models/loyalty-status.md +1 -1
  49. package/data/docs/models/loyalty-transaction.md +1 -1
  50. package/data/docs/models/magic-link-request.md +1 -1
  51. package/data/docs/models/metrics-current.md +1 -1
  52. package/data/docs/models/metrics-daily.md +1 -1
  53. package/data/docs/models/metrics-monthly.md +1 -1
  54. package/data/docs/models/notification-record.md +619 -0
  55. package/data/docs/models/order-item.md +2 -2
  56. package/data/docs/models/order.md +2 -2
  57. package/data/docs/models/sale.md +2 -2
  58. package/data/docs/models/site-payment.md +2 -2
  59. package/data/docs/models/site.md +2 -2
  60. package/data/docs/models/stocktake-item.md +2 -2
  61. package/data/docs/models/stocktake.md +2 -2
  62. package/data/docs/models/ticket.md +2 -2
  63. package/data/docs/models/whatsapp-inbound-message.md +2 -2
  64. package/data/docs/models/whatsapp-outbound-lifecycle-event.md +2 -2
  65. package/data/docs/models/whatsapp-outbound-message.md +2 -2
  66. package/data/docs/models/whatsapp-template.md +2 -2
  67. package/data/static/cookbook.json +150 -0
  68. package/data/static/llms.txt +72 -0
  69. package/data/static/openapi.yaml +192 -0
  70. package/data/static/schemas.json +258 -1
  71. package/index.js +32 -0
  72. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "SitePayment"
3
3
  sidebar_label: "SitePayment"
4
- sidebar_position: 24
4
+ sidebar_position: 25
5
5
  ---
6
6
 
7
7
  # SitePayment
@@ -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-27 at 14:03:20 +0000
200
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 15:51:05 +0000
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "Site"
3
3
  sidebar_label: "Site"
4
- sidebar_position: 23
4
+ sidebar_position: 24
5
5
  ---
6
6
 
7
7
  # Site
@@ -546,7 +546,7 @@ Do not include in write requests. This field is set exclusively by the server (F
546
546
  **Description:** Timestamp of the most recent analytics event seen for this site.
547
547
 
548
548
  ----------------------------------------------------------------------------------------------------------------------------
549
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 14:03:20 +0000
549
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 15:51:05 +0000
550
550
 
551
551
  :::warning Server-set
552
552
  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.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "StocktakeItem"
3
3
  sidebar_label: "StocktakeItem"
4
- sidebar_position: 26
4
+ sidebar_position: 27
5
5
  ---
6
6
 
7
7
  # StocktakeItem
@@ -497,4 +497,4 @@ Read-time hint snapshot of the verifier's display name (GH#29 §3 / Q10).
497
497
  | **Required** | No |
498
498
 
499
499
  ----------------------------------------------------------------------------------------------------------------------------
500
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 14:03:20 +0000
500
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 15:51:05 +0000
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "Stocktake"
3
3
  sidebar_label: "Stocktake"
4
- sidebar_position: 25
4
+ sidebar_position: 26
5
5
  ---
6
6
 
7
7
  # Stocktake
@@ -642,7 +642,7 @@ Read-time hint snapshot of the completer's display name (GH#29 §3 / Q10).
642
642
  | **Required** | No |
643
643
 
644
644
  ----------------------------------------------------------------------------------------------------------------------------
645
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 14:03:20 +0000
645
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 15:51:05 +0000
646
646
 
647
647
  :::warning Server-set
648
648
  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.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "Ticket"
3
3
  sidebar_label: "Ticket"
4
- sidebar_position: 27
4
+ sidebar_position: 28
5
5
  ---
6
6
 
7
7
  # Ticket
@@ -388,7 +388,7 @@ Do not include in write requests. This field is set exclusively by the server (F
388
388
  **Description:** (Immutable) FK → User/staff UID who created this ticket.
389
389
 
390
390
  ----------------------------------------------------------------------------------------------------------------------------
391
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 14:03:20 +0000
391
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 15:51:05 +0000
392
392
 
393
393
  :::info Immutable
394
394
  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.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "WhatsappInboundMessage"
3
3
  sidebar_label: "WhatsappInboundMessage"
4
- sidebar_position: 28
4
+ sidebar_position: 29
5
5
  ---
6
6
 
7
7
  # WhatsappInboundMessage
@@ -366,4 +366,4 @@ Do not include in write requests. This field is set exclusively by the server (F
366
366
  Specific value: `true`
367
367
 
368
368
  ----------------------------------------------------------------------------------------------------------------------------
369
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 14:03:20 +0000
369
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 15:51:05 +0000
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "WhatsappOutboundLifecycleEvent"
3
3
  sidebar_label: "WhatsappOutboundLifecycleEvent"
4
- sidebar_position: 29
4
+ sidebar_position: 30
5
5
  ---
6
6
 
7
7
  # WhatsappOutboundLifecycleEvent
@@ -303,7 +303,7 @@ Do not include in write requests. This field is set exclusively by the server (F
303
303
  **Description:** (Read-only) Raw Meta error object(s).
304
304
 
305
305
  ----------------------------------------------------------------------------------------------------------------------------
306
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 14:03:20 +0000
306
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 15:51:06 +0000
307
307
 
308
308
  :::warning Server-set
309
309
  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.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "WhatsappOutboundMessage"
3
3
  sidebar_label: "WhatsappOutboundMessage"
4
- sidebar_position: 30
4
+ sidebar_position: 31
5
5
  ---
6
6
 
7
7
  # WhatsappOutboundMessage
@@ -582,7 +582,7 @@ Do not include in write requests. This field is set exclusively by the server (F
582
582
  | **Required** | No |
583
583
 
584
584
  ----------------------------------------------------------------------------------------------------------------------------
585
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 14:03:20 +0000
585
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 15:51:06 +0000
586
586
 
587
587
  :::warning Server-set
588
588
  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.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "WhatsappTemplate"
3
3
  sidebar_label: "WhatsappTemplate"
4
- sidebar_position: 31
4
+ sidebar_position: 32
5
5
  ---
6
6
 
7
7
  # WhatsappTemplate
@@ -287,7 +287,7 @@ Do not include in write requests. This field is set exclusively by the server (F
287
287
  **Description:** (Read-only) Rendered preview text for display in the dashboard picker.
288
288
 
289
289
  ----------------------------------------------------------------------------------------------------------------------------
290
- Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 14:03:20 +0000
290
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 15:51:06 +0000
291
291
 
292
292
  :::warning Server-set
293
293
  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.
@@ -0,0 +1,150 @@
1
+ {
2
+ "version": "1",
3
+ "recipes": [
4
+ {
5
+ "slug": "write-model-code",
6
+ "title": "Writing code that touches a model",
7
+ "summary": "How to look up a model's schema, identify field constraints, and avoid writing to server-set or immutable fields.",
8
+ "steps": [
9
+ {
10
+ "step": 1,
11
+ "tool": "schema_overview",
12
+ "args": {},
13
+ "note": "Start here to see all available models and enums. Identify the model(s) your code will read or write."
14
+ },
15
+ {
16
+ "step": 2,
17
+ "tool": "get_schema",
18
+ "args": { "name": "<model-name>" },
19
+ "note": "Fetch the full JSON Schema for the model. Inspect each field for constraint extensions: readOnly, x-immutable, deprecated, x-note, x-when."
20
+ },
21
+ {
22
+ "step": 3,
23
+ "tool": "get_openapi",
24
+ "args": { "component": "<ModelCreate>" },
25
+ "note": "Use the Create variant (PascalCase + 'Create', e.g. 'OrderCreate') to determine the correct write shape. readOnly and deprecated fields are excluded from required[] here."
26
+ },
27
+ {
28
+ "step": 4,
29
+ "tool": "get_openapi",
30
+ "args": { "component": "<ModelUpdate>" },
31
+ "note": "For PATCH operations use the Update variant. All fields become optional and readOnly / x-immutable fields are excluded entirely."
32
+ },
33
+ {
34
+ "step": 5,
35
+ "tool": "get_doc",
36
+ "args": { "slug": "models/<model-name>" },
37
+ "note": "Read the human-readable doc page for callout blocks: server-set warnings, immutable notices, deprecation alerts, and implementation tips."
38
+ }
39
+ ],
40
+ "field_constraint_cheatsheet": {
41
+ "readOnly: true": "Set by Firestore trigger or Admin SDK only — never write from client or backend application code.",
42
+ "x-immutable: true": "Set exactly once at document creation. Any subsequent write to this field is a bug.",
43
+ "deprecated: true": "Do not write in new code. Check x-replaced-by for the replacement field.",
44
+ "x-internal: true": "Backend-only collection — consumers must not depend on this model's shape."
45
+ },
46
+ "tips": [
47
+ "Field descriptions often contain '(GH#N)' or '(D-id)' references — use get_decision to trace rationale.",
48
+ "If a field is absent from ModelCreate, it is either readOnly (server-sets it) or deprecated.",
49
+ "Run get_schema on related enums (e.g. 'payment-status') to understand the allowed values for enum fields."
50
+ ]
51
+ },
52
+ {
53
+ "slug": "field-history",
54
+ "title": "Understanding a field's history or rationale",
55
+ "summary": "How to trace why a field exists, what decision or issue drove it, and whether it has been migrated or superseded.",
56
+ "steps": [
57
+ {
58
+ "step": 1,
59
+ "tool": "search_docs",
60
+ "args": { "query": "<fieldName>" },
61
+ "note": "Find every doc page that mentions the field. This surfaces the model page, any decision pages, and migration docs."
62
+ },
63
+ {
64
+ "step": 2,
65
+ "tool": "get_schema",
66
+ "args": { "name": "<model-name>" },
67
+ "note": "Read the field's 'description' value directly. It typically includes a GH# issue reference or a D-id decision reference."
68
+ },
69
+ {
70
+ "step": 3,
71
+ "tool": "list_decisions",
72
+ "args": {},
73
+ "note": "Scan all decisions for ones related to the model or field. Look at 'status': accepted decisions are live; superseded ones have been replaced."
74
+ },
75
+ {
76
+ "step": 4,
77
+ "tool": "get_decision",
78
+ "args": { "id": "<D-id>" },
79
+ "note": "Get full context: rationale, migration path, affected models, and implementation status."
80
+ },
81
+ {
82
+ "step": 5,
83
+ "tool": "get_doc",
84
+ "args": { "slug": "decisions/migrations" },
85
+ "note": "Check the migrations page for a changelog of field-level changes and the order in which they must be applied."
86
+ }
87
+ ],
88
+ "tips": [
89
+ "If a field has 'x-replaced-by', check that replacement field's schema and the decision that drove the change.",
90
+ "A decision with status 'pending' means the change is not yet live — do not depend on the new shape yet.",
91
+ "search_docs with the GH# (e.g. 'GH#48') will surface all docs that reference that issue."
92
+ ]
93
+ },
94
+ {
95
+ "slug": "whatsapp-conversation-display",
96
+ "title": "Displaying WhatsApp conversation history for an order",
97
+ "summary": "Current workaround for rendering a per-order WhatsApp thread using NotificationRecord documents. There is no dedicated WhatsApp conversation model yet; outbound messages are reconstructed from the notification audit log.",
98
+ "workaround_notice": "This is a temporary workaround (GH#48). NotificationRecord captures outbound messages only. Inbound customer replies are not stored in Firestore. A proper WhatsApp conversation model is a future concern.",
99
+ "steps": [
100
+ {
101
+ "step": 1,
102
+ "tool": "get_schema",
103
+ "args": { "name": "notification-record" },
104
+ "note": "Understand the full NotificationRecord shape. Note: every field is readOnly — this is a backend-written audit log, consumers read only."
105
+ },
106
+ {
107
+ "step": 2,
108
+ "tool": "get_doc",
109
+ "args": { "slug": "collections/firestore-paths" },
110
+ "note": "Review the two notification collection paths: company-wide (always written) and order-scoped (dual-write when relatedEntity.type === 'order')."
111
+ },
112
+ {
113
+ "step": 3,
114
+ "action": "query",
115
+ "collection": "companies/{companyId}/orders/{orderId}/notifications",
116
+ "filter": "type == 'whatsapp'",
117
+ "sort": "sentAt ASC",
118
+ "note": "Use the order-scoped subcollection for O(1) per-order lookup. Filter to type='whatsapp' to exclude email/sms/push records."
119
+ },
120
+ {
121
+ "step": 4,
122
+ "action": "render",
123
+ "fields": {
124
+ "message_content": "templateParams — filled-in template variable values at send time; reconstruct the message text without calling the Meta API.",
125
+ "delivery_status": "status — 'sent' | 'failed' | 'pending'",
126
+ "failure_reason": "error — present only when status === 'failed'",
127
+ "timestamp": "sentAt — Firestore Timestamp; convert to local time for display",
128
+ "meta_message_id": "wamid — WhatsApp message ID from Meta; use for deduplication if querying both collection paths"
129
+ },
130
+ "note": "All display fields are reconstructable from the NotificationRecord alone — no Meta API call needed."
131
+ },
132
+ {
133
+ "step": 5,
134
+ "action": "deduplicate",
135
+ "note": "If you query both companies/{cid}/notifications (filtered by relatedEntity.id === orderId) AND the order-scoped subcollection, deduplicate by 'id' — both paths write the same document ID."
136
+ }
137
+ ],
138
+ "related_models": {
139
+ "notification-record": "GH#48 — the model used in this workaround",
140
+ "whatsapp-outbound-message": "GH#43 — dashboard-initiated WhatsApp sends. Separate from backend-automated NotificationRecords but both appear in the conversation thread. Query this collection too for a complete view."
141
+ },
142
+ "tips": [
143
+ "notification-record covers ALL channels (email, whatsapp, sms, push). Always filter by type='whatsapp'.",
144
+ "metadata field may contain 'templateName', 'senderPhoneId', 'orderNumber' — useful for display headers.",
145
+ "The order-scoped subcollection only exists if at least one notification with relatedEntity.type='order' was sent. Check for its absence gracefully.",
146
+ "For a company-wide WhatsApp audit (not order-scoped), query companies/{cid}/notifications filtered by type='whatsapp'."
147
+ ]
148
+ }
149
+ ]
150
+ }
@@ -46,6 +46,18 @@ Values: PREPARING, PARTIALLY_SHIPPED, SHIPPED, IN_TRANSIT, DELIVERED, PICKED_UP
46
46
  Loyalty point transaction type (D07). SCREAMING_SNAKE past tense.
47
47
  Values: EARNED, REDEEMED, ADJUSTED, EXPIRED, BONUS, REFUND
48
48
 
49
+ ### NotificationChannel
50
+ Delivery channel of a NotificationRecord (GH#48).
51
+ Values: email, whatsapp, sms, push
52
+
53
+ ### NotificationEntityType
54
+ Type of entity a NotificationRecord relates to. When `order`, the record is dual-written to the order-scoped subcollection (GH#48).
55
+ Values: order, booking, customer, digest, magic_link, other
56
+
57
+ ### NotificationStatus
58
+ Delivery status of a NotificationRecord, set by the Cloud Function after a send attempt (GH#48).
59
+ Values: sent, failed, pending
60
+
49
61
  ### OrderStatus
50
62
  Core order lifecycle status (D03, D34). Universal across all business types. Replaces the Dashboard's legacy 20-value flat enum (MIG-11).
51
63
  Values: PENDING, CONFIRMED, PROCESSING, READY, COMPLETED, CANCELLED, EXPIRED
@@ -1092,6 +1104,66 @@ Example:
1092
1104
  }
1093
1105
  ```
1094
1106
 
1107
+ ### NotificationRecord
1108
+ Fields: 12 (6 required)
1109
+
1110
+ | Field | Type | Required | Description |
1111
+ |-------|------|----------|-------------|
1112
+ | id | ['string', 'null'] | no | (Read-only) Firestore document ID, auto-generated. Same ID is used in both the company-wide and order-scoped copies. |
1113
+ | type | NotificationChannel | yes | (Read-only) Delivery channel. |
1114
+ | status | NotificationStatus | yes | (Read-only) Delivery status after the send attempt. |
1115
+ | subject | ['string', 'null'] | no | (Read-only) Subject line. Present for email notifications only. |
1116
+ | recipients | object | yes | (Read-only) Recipients of the notification. |
1117
+ | recipients.to | array<object> | yes | Primary recipients. |
1118
+ | recipients.to[].email | string | no | Recipient email address. Present for email notifications. |
1119
+ | recipients.to[].phone | string | no | Recipient phone number (E.164). Present for whatsapp/sms notifications. |
1120
+ | recipients.to[].name | string | no | Recipient display name. |
1121
+ | recipients.to[].role | string | no | Recipient role (e.g. organizer, customer). |
1122
+ | recipients.cc | array<object> | no | CC recipients (email). |
1123
+ | recipients.cc[].email | string | no | Recipient email address. Present for email notifications. |
1124
+ | recipients.cc[].phone | string | no | Recipient phone number (E.164). Present for whatsapp/sms notifications. |
1125
+ | recipients.cc[].name | string | no | Recipient display name. |
1126
+ | recipients.cc[].role | string | no | Recipient role (e.g. organizer, customer). |
1127
+ | recipients.bcc | array<object> | no | BCC recipients (email). |
1128
+ | recipients.bcc[].email | string | no | Recipient email address. Present for email notifications. |
1129
+ | recipients.bcc[].phone | string | no | Recipient phone number (E.164). Present for whatsapp/sms notifications. |
1130
+ | recipients.bcc[].name | string | no | Recipient display name. |
1131
+ | recipients.bcc[].role | string | no | Recipient role (e.g. organizer, customer). |
1132
+ | relatedEntity | object | yes | (Read-only) Entity that triggered the notification. type=order triggers the dual-write to the order subcollection. |
1133
+ | relatedEntity.type | NotificationEntityType | yes | Entity type this notification relates to. |
1134
+ | relatedEntity.id | string | yes | Entity document ID (e.g. orderId when type=order). |
1135
+ | wamid | ['string', 'null'] | no | (Read-only) WhatsApp message ID from the Meta API response. Present on successful whatsapp sends only. |
1136
+ | templateParams | ['object', 'null'] | no | (Read-only) Filled-in template variable values at send time. Allows reconstructing the sent message without fetching from Meta. |
1137
+ | metadata | ['object', 'null'] | no | (Read-only) Channel-specific extras (e.g. senderPhoneId, templateName, orderNumber). |
1138
+ | error | ['string', 'null'] | no | (Read-only) Failure reason. Present on status=failed. |
1139
+ | sentAt | FirestoreTimestamp | yes | (Read-only) When the send was attempted. |
1140
+ | createdAt | FirestoreTimestamp | yes | (Read-only) When the record was created. |
1141
+
1142
+ Example:
1143
+ ```json
1144
+ {
1145
+ "id": null,
1146
+ "type": "phone",
1147
+ "status": "status",
1148
+ "subject": null,
1149
+ "recipients": {
1150
+ "to": [
1151
+ {}
1152
+ ]
1153
+ },
1154
+ "relatedEntity": {
1155
+ "type": "phone",
1156
+ "id": "bk_abc123def456"
1157
+ },
1158
+ "wamid": null,
1159
+ "templateParams": null,
1160
+ "metadata": null,
1161
+ "error": null,
1162
+ "sentAt": "sentAt",
1163
+ "createdAt": "createdAt"
1164
+ }
1165
+ ```
1166
+
1095
1167
  ### Order
1096
1168
  Fields: 48 (8 required)
1097
1169
 
@@ -110,6 +110,33 @@ components:
110
110
  - BONUS
111
111
  - REFUND
112
112
  description: Loyalty point transaction type (D07). SCREAMING_SNAKE past tense.
113
+ NotificationChannel:
114
+ type: string
115
+ enum:
116
+ - email
117
+ - whatsapp
118
+ - sms
119
+ - push
120
+ description: Delivery channel of a NotificationRecord (GH#48).
121
+ NotificationEntityType:
122
+ type: string
123
+ enum:
124
+ - order
125
+ - booking
126
+ - customer
127
+ - digest
128
+ - magic_link
129
+ - other
130
+ description: Type of entity a NotificationRecord relates to. When `order`, the
131
+ record is dual-written to the order-scoped subcollection (GH#48).
132
+ NotificationStatus:
133
+ type: string
134
+ enum:
135
+ - sent
136
+ - failed
137
+ - pending
138
+ description: Delivery status of a NotificationRecord, set by the Cloud Function
139
+ after a send attempt (GH#48).
113
140
  OrderStatus:
114
141
  type: string
115
142
  enum:
@@ -3074,6 +3101,171 @@ components:
3074
3101
  description: Write payload for partial update (PATCH) of a MetricsMonthly document.
3075
3102
  All fields optional. Fields marked `readOnly` or `x-immutable` must not be
3076
3103
  sent.
3104
+ NotificationRecord:
3105
+ type: object
3106
+ properties:
3107
+ id:
3108
+ readOnly: true
3109
+ description: (Read-only) Firestore document ID, auto-generated. Same ID
3110
+ is used in both the company-wide and order-scoped copies.
3111
+ type:
3112
+ - string
3113
+ - 'null'
3114
+ type:
3115
+ $ref: '#/components/schemas/NotificationChannel'
3116
+ description: (Read-only) Delivery channel.
3117
+ readOnly: true
3118
+ status:
3119
+ $ref: '#/components/schemas/NotificationStatus'
3120
+ description: (Read-only) Delivery status after the send attempt.
3121
+ readOnly: true
3122
+ subject:
3123
+ readOnly: true
3124
+ description: (Read-only) Subject line. Present for email notifications only.
3125
+ type:
3126
+ - string
3127
+ - 'null'
3128
+ recipients:
3129
+ type: object
3130
+ properties:
3131
+ to:
3132
+ type: array
3133
+ items:
3134
+ type: object
3135
+ properties:
3136
+ email:
3137
+ description: Recipient email address. Present for email notifications.
3138
+ type: string
3139
+ phone:
3140
+ description: Recipient phone number (E.164). Present for whatsapp/sms
3141
+ notifications.
3142
+ type: string
3143
+ name:
3144
+ description: Recipient display name.
3145
+ type: string
3146
+ role:
3147
+ description: Recipient role (e.g. organizer, customer).
3148
+ type: string
3149
+ additionalProperties: false
3150
+ description: A notification recipient (GH#48).
3151
+ description: Primary recipients.
3152
+ cc:
3153
+ description: CC recipients (email).
3154
+ type: array
3155
+ items:
3156
+ type: object
3157
+ properties:
3158
+ email:
3159
+ description: Recipient email address. Present for email notifications.
3160
+ type: string
3161
+ phone:
3162
+ description: Recipient phone number (E.164). Present for whatsapp/sms
3163
+ notifications.
3164
+ type: string
3165
+ name:
3166
+ description: Recipient display name.
3167
+ type: string
3168
+ role:
3169
+ description: Recipient role (e.g. organizer, customer).
3170
+ type: string
3171
+ additionalProperties: false
3172
+ description: A notification recipient (GH#48).
3173
+ bcc:
3174
+ description: BCC recipients (email).
3175
+ type: array
3176
+ items:
3177
+ type: object
3178
+ properties:
3179
+ email:
3180
+ description: Recipient email address. Present for email notifications.
3181
+ type: string
3182
+ phone:
3183
+ description: Recipient phone number (E.164). Present for whatsapp/sms
3184
+ notifications.
3185
+ type: string
3186
+ name:
3187
+ description: Recipient display name.
3188
+ type: string
3189
+ role:
3190
+ description: Recipient role (e.g. organizer, customer).
3191
+ type: string
3192
+ additionalProperties: false
3193
+ description: A notification recipient (GH#48).
3194
+ required:
3195
+ - to
3196
+ additionalProperties: false
3197
+ readOnly: true
3198
+ description: (Read-only) Recipients of the notification.
3199
+ relatedEntity:
3200
+ type: object
3201
+ properties:
3202
+ type:
3203
+ $ref: '#/components/schemas/NotificationEntityType'
3204
+ description: Entity type this notification relates to.
3205
+ id:
3206
+ type: string
3207
+ description: Entity document ID (e.g. orderId when type=order).
3208
+ required:
3209
+ - type
3210
+ - id
3211
+ additionalProperties: false
3212
+ readOnly: true
3213
+ description: (Read-only) Entity that triggered the notification. type=order
3214
+ triggers the dual-write to the order subcollection.
3215
+ wamid:
3216
+ readOnly: true
3217
+ description: (Read-only) WhatsApp message ID from the Meta API response.
3218
+ Present on successful whatsapp sends only.
3219
+ type:
3220
+ - string
3221
+ - 'null'
3222
+ templateParams:
3223
+ readOnly: true
3224
+ description: (Read-only) Filled-in template variable values at send time.
3225
+ Allows reconstructing the sent message without fetching from Meta.
3226
+ type:
3227
+ - object
3228
+ - 'null'
3229
+ propertyNames:
3230
+ type: string
3231
+ additionalProperties:
3232
+ type: string
3233
+ metadata:
3234
+ readOnly: true
3235
+ description: (Read-only) Channel-specific extras (e.g. senderPhoneId, templateName,
3236
+ orderNumber).
3237
+ type:
3238
+ - object
3239
+ - 'null'
3240
+ propertyNames:
3241
+ type: string
3242
+ additionalProperties: {}
3243
+ error:
3244
+ readOnly: true
3245
+ description: (Read-only) Failure reason. Present on status=failed.
3246
+ type:
3247
+ - string
3248
+ - 'null'
3249
+ sentAt:
3250
+ $ref: '#/components/schemas/FirestoreTimestamp'
3251
+ description: (Read-only) When the send was attempted.
3252
+ readOnly: true
3253
+ createdAt:
3254
+ $ref: '#/components/schemas/FirestoreTimestamp'
3255
+ description: (Read-only) When the record was created.
3256
+ readOnly: true
3257
+ required:
3258
+ - type
3259
+ - status
3260
+ - recipients
3261
+ - relatedEntity
3262
+ - sentAt
3263
+ - createdAt
3264
+ additionalProperties: false
3265
+ description: 'NotificationRecord — backend-written, multi-channel notification
3266
+ audit log (GH#48). Paths: companies/{cid}/notifications/{id} (always) and
3267
+ companies/{cid}/orders/{oid}/notifications/{id} (dual-write when relatedEntity.type=order).
3268
+ Consumers read only. Distinct from WhatsappOutboundMessage (GH#43).'
3077
3269
  Order:
3078
3270
  type: object
3079
3271
  properties: