@ingenx-io/valets-schema-mcp-server 0.1.5 → 0.1.6

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 (53) hide show
  1. package/data/docs/enums/attention-status.md +1 -1
  2. package/data/docs/enums/booking-status.md +1 -1
  3. package/data/docs/enums/customer-payment-status.md +1 -1
  4. package/data/docs/enums/customer-payment-target-type.md +1 -1
  5. package/data/docs/enums/delivery-type.md +1 -1
  6. package/data/docs/enums/deployment-link-type.md +1 -1
  7. package/data/docs/enums/event-status.md +1 -1
  8. package/data/docs/enums/fulfillment-status.md +1 -1
  9. package/data/docs/enums/loyalty-transaction-type.md +1 -1
  10. package/data/docs/enums/order-status.md +1 -1
  11. package/data/docs/enums/payment-method.md +1 -1
  12. package/data/docs/enums/payment-proof-status.md +1 -1
  13. package/data/docs/enums/payment-status.md +1 -1
  14. package/data/docs/enums/pending-issue.md +1 -1
  15. package/data/docs/enums/return-status.md +1 -1
  16. package/data/docs/enums/session-status.md +1 -1
  17. package/data/docs/enums/site-status.md +1 -1
  18. package/data/docs/enums/stocktake-frequency.md +24 -0
  19. package/data/docs/enums/stocktake-item-status.md +24 -0
  20. package/data/docs/enums/stocktake-status.md +24 -0
  21. package/data/docs/enums/ticket-status.md +2 -2
  22. package/data/docs/index.md +7 -2
  23. package/data/docs/models/allowed-user.md +1 -1
  24. package/data/docs/models/analytics-backfill.md +1 -1
  25. package/data/docs/models/analytics-daily.md +1 -1
  26. package/data/docs/models/analytics-event.md +1 -1
  27. package/data/docs/models/analytics-hourly.md +1 -1
  28. package/data/docs/models/booking-version.md +1 -1
  29. package/data/docs/models/booking.md +1 -1
  30. package/data/docs/models/customer-payment-allocation.md +1 -1
  31. package/data/docs/models/customer-payment.md +1 -1
  32. package/data/docs/models/customer.md +1 -1
  33. package/data/docs/models/event.md +1 -1
  34. package/data/docs/models/loyalty-config.md +1 -1
  35. package/data/docs/models/loyalty-reward.md +1 -1
  36. package/data/docs/models/loyalty-status.md +1 -1
  37. package/data/docs/models/loyalty-transaction.md +1 -1
  38. package/data/docs/models/magic-link-request.md +1 -1
  39. package/data/docs/models/metrics-current.md +1 -1
  40. package/data/docs/models/metrics-daily.md +1 -1
  41. package/data/docs/models/metrics-monthly.md +1 -1
  42. package/data/docs/models/order-item.md +1 -1
  43. package/data/docs/models/order.md +1 -1
  44. package/data/docs/models/sale.md +1 -1
  45. package/data/docs/models/site-payment.md +1 -1
  46. package/data/docs/models/site.md +1 -1
  47. package/data/docs/models/stocktake-item.md +500 -0
  48. package/data/docs/models/stocktake.md +649 -0
  49. package/data/docs/models/ticket.md +2 -2
  50. package/data/static/llms.txt +111 -1
  51. package/data/static/openapi.yaml +355 -0
  52. package/data/static/schemas.json +455 -1
  53. package/package.json +1 -1
@@ -4,7 +4,7 @@
4
4
  > Source of truth: Zod schemas in packages/schema/src/
5
5
  > All Firestore documents are scoped under companies/{companyId}/
6
6
 
7
- > Generated: 2026-04-18
7
+ > Generated: 2026-05-05
8
8
 
9
9
  ---
10
10
 
@@ -78,6 +78,18 @@ Values: PENDING, CONFIRMED, CANCELLATION_REQUESTED, COMPLETED, NO_SHOW, CANCELLE
78
78
  Lifecycle status for a Site (D41). Drives whether the site is reachable and whether analytics/payments flow.
79
79
  Values: ACTIVE, INACTIVE, EXPIRED, ARCHIVED
80
80
 
81
+ ### StocktakeFrequency
82
+ Recurrence cadence of a Stocktake session (GH#29 §4).
83
+ Values: DAILY, WEEKLY, MONTHLY, AD_HOC
84
+
85
+ ### StocktakeItemStatus
86
+ Per-line workflow status inside a Stocktake (GH#29 §4, audit Q21).
87
+ Values: PENDING, COUNTED, VERIFIED, ADJUSTED
88
+
89
+ ### StocktakeStatus
90
+ Lifecycle status of a Stocktake session (GH#29 §3, §4).
91
+ Values: PENDING, IN_PROGRESS, COMPLETED, CANCELLED
92
+
81
93
  ### TicketStatus
82
94
  Event ticket status (D32). VALID = active and unused.
83
95
  Values: VALID, USED, CANCELLED
@@ -1314,6 +1326,104 @@ Example:
1314
1326
  }
1315
1327
  ```
1316
1328
 
1329
+ ### Stocktake
1330
+ Fields: 21 (11 required)
1331
+
1332
+ | Field | Type | Required | Description |
1333
+ |-------|------|----------|-------------|
1334
+ | id | ['string', 'null'] | no | (Read-only) Firestore document ID, auto-generated. |
1335
+ | companyId | string | yes | (Immutable) FK → Company document ID. Tenant scope. |
1336
+ | stocktakeNumber | string | yes | Human-readable session number, e.g. "STK-2026-001". Embedded as `referenceNumber` on the StockMovement rows the session emits, so the ledger remains traceable to the originating stocktake. |
1337
+ | stocktakeDate | FirestoreTimestamp | yes | Effective date of the count. Distinct from createdAt; can be backdated. |
1338
+ | warehouseId | any | no | FK → Warehouse document ID. Null = whole-company stocktake (no warehouse partition). |
1339
+ | frequency | any | no | Recurrence cadence. Optional — leave unset for ad-hoc sessions, or set to indicate this stocktake is part of a recurring schedule. |
1340
+ | scheduledStocktakeId | any | no | FK to a recurring stocktake schedule, if this session was emitted from one. Null for ad-hoc sessions. |
1341
+ | status | StocktakeStatus | yes | Lifecycle status. Transitions PENDING → IN_PROGRESS → COMPLETED are server-owned (GH#29 §3 / Q25). |
1342
+ | adjustmentsApplied | boolean | yes | True if completing the session actually emitted StockMovement adjustments. False for record-only counts. |
1343
+ | notes | any | no | Free-text session-level notes. |
1344
+ | totalItemsCount | integer | yes | (Read-only) Total number of StocktakeItem rows under this session. |
1345
+ | totalDiscrepancies | integer | yes | (Read-only) Sum of absolute deltas across counted items. |
1346
+ | totalDeltaValue | number | yes | (Read-only) Net valuation impact of the count, in XOF integer minor units. |
1347
+ | startedAt | FirestoreTimestamp | yes | When the counting session physically opened. Typically equal to createdAt for ad-hoc sessions. |
1348
+ | completedAt | any | no | (Read-only) When the session transitioned to COMPLETED. |
1349
+ | createdAt | any | no | (Read-only) Server-generated creation timestamp. |
1350
+ | createdBy | string | yes | (Immutable) FK → User UID who created the session. |
1351
+ | createdByName | string | yes | (Denormalized) Snapshot of the creator's display name at session creation. |
1352
+ | completedBy | any | no | (Read-only) FK → User UID who completed the session, set by server on COMPLETED. |
1353
+ | completedByName | any | no | (Denormalized) Snapshot of the completer's display name. |
1354
+ | updatedAt | any | no | (Read-only) Server-generated update timestamp. |
1355
+
1356
+ Example:
1357
+ ```json
1358
+ {
1359
+ "id": null,
1360
+ "companyId": "comp_xyz789",
1361
+ "stocktakeNumber": "stocktakeNumber",
1362
+ "stocktakeDate": "stocktakeDate",
1363
+ "warehouseId": "war_ref123",
1364
+ "frequency": "frequency",
1365
+ "scheduledStocktakeId": "sch_ref123",
1366
+ "status": "status",
1367
+ "adjustmentsApplied": true,
1368
+ "notes": "VIP customer, handle with care",
1369
+ "totalItemsCount": 2,
1370
+ "totalDiscrepancies": 0,
1371
+ "totalDeltaValue": 0,
1372
+ "startedAt": "startedAt",
1373
+ "completedAt": "completedAt",
1374
+ "createdAt": "createdAt",
1375
+ "createdBy": "staff_k0f1",
1376
+ "createdByName": "Kofi Mensah",
1377
+ "completedBy": "completedBy",
1378
+ "completedByName": "completedByName",
1379
+ "updatedAt": "updatedAt"
1380
+ }
1381
+ ```
1382
+
1383
+ ### StocktakeItem
1384
+ Fields: 16 (8 required)
1385
+
1386
+ | Field | Type | Required | Description |
1387
+ |-------|------|----------|-------------|
1388
+ | stockItemId | string | yes | FK → StockItem document ID. Doubles as the item document ID. |
1389
+ | stockItemName | string | yes | (Denormalized) Snapshot of StockItem.name at session time. |
1390
+ | theoreticalQuantity | number | yes | (Immutable) System belief at session start, snapshotted when this item row was created. |
1391
+ | actualQuantity | any | no | Physical count entered by the counter. Null until counted; set when the line moves to status COUNTED. |
1392
+ | delta | number | yes | (Read-only) Signed difference between actual and theoretical. Drives the StockMovement(type=INVENTORY) emitted on session COMPLETED. |
1393
+ | unit | string | yes | (Immutable) Snapshot of StockItem.unit at session start. Locks the unit against later catalog changes. |
1394
+ | costPerUnit | number | yes | (Immutable) Snapshot of StockItem.costPerUnit at session start, in XOF integer minor units. |
1395
+ | totalValue | number | yes | (Read-only) Per-line valuation in XOF integer minor units. |
1396
+ | status | StocktakeItemStatus | yes | Per-line workflow status. Server transitions ADJUSTED on parent COMPLETED. |
1397
+ | notes | any | no | Optional per-line note from the counter (e.g. "damaged carton, 3 unsellable"). |
1398
+ | countedBy | any | no | UID of the staff member who entered actualQuantity. |
1399
+ | countedByName | any | no | (Denormalized) Snapshot of the counter's display name at count time. |
1400
+ | countedAt | any | no | When the line was counted. |
1401
+ | verifiedBy | any | no | UID of a second staff member who verified the count. Nullable per GH#29 Q21. |
1402
+ | verifiedByName | any | no | (Denormalized) Snapshot of the verifier's display name. |
1403
+ | verifiedAt | any | no | When the line was verified, if a second-eye flow was used. |
1404
+
1405
+ Example:
1406
+ ```json
1407
+ {
1408
+ "stockItemId": "sto_ref123",
1409
+ "stockItemName": "stockItemName",
1410
+ "theoreticalQuantity": 2,
1411
+ "actualQuantity": "actualQuantity",
1412
+ "delta": 0,
1413
+ "unit": "unit",
1414
+ "costPerUnit": 15000,
1415
+ "totalValue": 0,
1416
+ "status": "status",
1417
+ "notes": "VIP customer, handle with care",
1418
+ "countedBy": "countedBy",
1419
+ "countedByName": "countedByName",
1420
+ "countedAt": "countedAt",
1421
+ "verifiedBy": "verifiedBy",
1422
+ "verifiedByName": "verifiedByName",
1423
+ "verifiedAt": "verifiedAt"
1424
+ }
1425
+ ```
1426
+
1317
1427
  ### Ticket
1318
1428
  Fields: 16 (6 required)
1319
1429
 
@@ -204,6 +204,30 @@ components:
204
204
  - ARCHIVED
205
205
  description: Lifecycle status for a Site (D41). Drives whether the site is reachable
206
206
  and whether analytics/payments flow.
207
+ StocktakeFrequency:
208
+ type: string
209
+ enum:
210
+ - DAILY
211
+ - WEEKLY
212
+ - MONTHLY
213
+ - AD_HOC
214
+ description: Recurrence cadence of a Stocktake session (GH#29 §4).
215
+ StocktakeItemStatus:
216
+ type: string
217
+ enum:
218
+ - PENDING
219
+ - COUNTED
220
+ - VERIFIED
221
+ - ADJUSTED
222
+ description: Per-line workflow status inside a Stocktake (GH#29 §4, audit Q21).
223
+ StocktakeStatus:
224
+ type: string
225
+ enum:
226
+ - PENDING
227
+ - IN_PROGRESS
228
+ - COMPLETED
229
+ - CANCELLED
230
+ description: Lifecycle status of a Stocktake session (GH#29 §3, §4).
207
231
  TicketStatus:
208
232
  type: string
209
233
  enum:
@@ -3895,6 +3919,337 @@ components:
3895
3919
  description: Write payload for partial update (PATCH) of a SitePayment document.
3896
3920
  All fields optional. Fields marked `readOnly` or `x-immutable` must not be
3897
3921
  sent.
3922
+ Stocktake:
3923
+ type: object
3924
+ properties:
3925
+ id:
3926
+ readOnly: true
3927
+ description: (Read-only) Firestore document ID, auto-generated.
3928
+ type:
3929
+ - string
3930
+ - 'null'
3931
+ companyId:
3932
+ type: string
3933
+ x-immutable: true
3934
+ description: (Immutable) FK → Company document ID. Tenant scope.
3935
+ stocktakeNumber:
3936
+ type: string
3937
+ description: Human-readable session number, e.g. "STK-2026-001". Embedded
3938
+ as `referenceNumber` on the StockMovement rows the session emits, so the
3939
+ ledger remains traceable to the originating stocktake.
3940
+ stocktakeDate:
3941
+ $ref: '#/components/schemas/FirestoreTimestamp'
3942
+ description: Effective date of the count. Distinct from createdAt; can be
3943
+ backdated.
3944
+ x-note: The date the count is FOR. Can be backdated (stocktakeDate < createdAt)
3945
+ — analytics buckets by stocktakeDate for "what period was counted" and
3946
+ by completedAt for "when adjustments hit the ledger" (GH#29 Q24).
3947
+ warehouseId:
3948
+ description: FK → Warehouse document ID. Null = whole-company stocktake
3949
+ (no warehouse partition).
3950
+ anyOf:
3951
+ - type: string
3952
+ - type: 'null'
3953
+ frequency:
3954
+ anyOf:
3955
+ - $ref: '#/components/schemas/StocktakeFrequency'
3956
+ - type: 'null'
3957
+ description: Recurrence cadence. Optional — leave unset for ad-hoc sessions,
3958
+ or set to indicate this stocktake is part of a recurring schedule.
3959
+ x-note: Optional today (dashboard does not currently track recurrence).
3960
+ Frequency is a property of the record, not a separate type — a daily stocktake
3961
+ is a Stocktake with frequency=DAILY, not a distinct DailyStocktake model.
3962
+ If the session was emitted from a recurring schedule, set Stocktake.scheduledStocktakeId;
3963
+ ad-hoc sessions leave it null.
3964
+ x-see:
3965
+ issues:
3966
+ - gh#29
3967
+ scheduledStocktakeId:
3968
+ description: FK to a recurring stocktake schedule, if this session was emitted
3969
+ from one. Null for ad-hoc sessions.
3970
+ anyOf:
3971
+ - type: string
3972
+ - type: 'null'
3973
+ status:
3974
+ $ref: '#/components/schemas/StocktakeStatus'
3975
+ description: Lifecycle status. Transitions PENDING → IN_PROGRESS → COMPLETED
3976
+ are server-owned (GH#29 §3 / Q25).
3977
+ x-note: PENDING = session created, no items counted yet. IN_PROGRESS = at
3978
+ least one item has been counted. COMPLETED = all items counted and the
3979
+ session was closed; on this transition the server emits one StockMovement(type=INVENTORY)
3980
+ per non-zero delta. CANCELLED = session abandoned without applying adjustments.
3981
+ Status transitions PENDING → IN_PROGRESS → COMPLETED are server-owned
3982
+ (Q25) — clients PATCH item status; the server transitions session status
3983
+ to avoid the concurrent-edit race documented in stockService.ts:1671.
3984
+ x-see:
3985
+ issues:
3986
+ - gh#29
3987
+ x-when: Server-managed. Clients write item updates; the trigger transitions
3988
+ session status.
3989
+ adjustmentsApplied:
3990
+ type: boolean
3991
+ x-note: Records whether the COMPLETED transition actually mutated stock
3992
+ or was record-only. The dashboard's completeInventory(applyAdjustments)
3993
+ flag was not persisted; this field closes that gap (GH#29 audit Q22).
3994
+ description: True if completing the session actually emitted StockMovement
3995
+ adjustments. False for record-only counts.
3996
+ notes:
3997
+ description: Free-text session-level notes.
3998
+ anyOf:
3999
+ - type: string
4000
+ - type: 'null'
4001
+ totalItemsCount:
4002
+ type: integer
4003
+ minimum: -9007199254740991
4004
+ maximum: 9007199254740991
4005
+ readOnly: true
4006
+ x-note: Server-derived. Recomputed by trigger on each StocktakeItem write;
4007
+ not safe to write client-side under concurrent edits (GH#29 audit Q23).
4008
+ description: (Read-only) Total number of StocktakeItem rows under this session.
4009
+ totalDiscrepancies:
4010
+ type: integer
4011
+ minimum: -9007199254740991
4012
+ maximum: 9007199254740991
4013
+ readOnly: true
4014
+ x-note: Server-derived = sum of |item.delta| across COUNTED items. Updated
4015
+ by trigger.
4016
+ description: (Read-only) Sum of absolute deltas across counted items.
4017
+ totalDeltaValue:
4018
+ type: number
4019
+ readOnly: true
4020
+ x-note: Server-derived = sum of (item.delta × item.costPerUnit) across COUNTED
4021
+ items, in XOF integer minor units (D18). Updated by trigger.
4022
+ description: (Read-only) Net valuation impact of the count, in XOF integer
4023
+ minor units.
4024
+ startedAt:
4025
+ $ref: '#/components/schemas/FirestoreTimestamp'
4026
+ description: When the counting session physically opened. Typically equal
4027
+ to createdAt for ad-hoc sessions.
4028
+ completedAt:
4029
+ anyOf:
4030
+ - $ref: '#/components/schemas/FirestoreTimestamp'
4031
+ - type: 'null'
4032
+ readOnly: true
4033
+ x-note: Server-set on transition to COMPLETED. Distinct from stocktakeDate
4034
+ (the period counted) — analytics buckets by completedAt to answer "when
4035
+ did the ledger hit?".
4036
+ description: (Read-only) When the session transitioned to COMPLETED.
4037
+ createdAt:
4038
+ anyOf:
4039
+ - $ref: '#/components/schemas/FirestoreTimestamp'
4040
+ - type: 'null'
4041
+ readOnly: true
4042
+ description: (Read-only) Server-generated creation timestamp.
4043
+ createdBy:
4044
+ type: string
4045
+ x-immutable: true
4046
+ description: (Immutable) FK → User UID who created the session.
4047
+ createdByName:
4048
+ type: string
4049
+ denormalized: true
4050
+ x-note: Read-time hint snapshot of the creator's display name (GH#29 §3
4051
+ / Q10).
4052
+ description: (Denormalized) Snapshot of the creator's display name at session
4053
+ creation.
4054
+ completedBy:
4055
+ readOnly: true
4056
+ description: (Read-only) FK → User UID who completed the session, set by
4057
+ server on COMPLETED.
4058
+ anyOf:
4059
+ - type: string
4060
+ - type: 'null'
4061
+ completedByName:
4062
+ denormalized: true
4063
+ x-note: Read-time hint snapshot of the completer's display name (GH#29 §3
4064
+ / Q10).
4065
+ description: (Denormalized) Snapshot of the completer's display name.
4066
+ anyOf:
4067
+ - type: string
4068
+ - type: 'null'
4069
+ updatedAt:
4070
+ anyOf:
4071
+ - $ref: '#/components/schemas/FirestoreTimestamp'
4072
+ - type: 'null'
4073
+ readOnly: true
4074
+ description: (Read-only) Server-generated update timestamp.
4075
+ required:
4076
+ - companyId
4077
+ - stocktakeNumber
4078
+ - stocktakeDate
4079
+ - status
4080
+ - adjustmentsApplied
4081
+ - totalItemsCount
4082
+ - totalDiscrepancies
4083
+ - totalDeltaValue
4084
+ - startedAt
4085
+ - createdBy
4086
+ - createdByName
4087
+ additionalProperties: false
4088
+ description: 'Stocktake (GH#29 §4). Collection: companies/{companyId}/stocktakes/{stocktakeId}.
4089
+ A recorded session of physically counting all SKUs at a point in time. Replaces
4090
+ the dashboard''s Inventory model; items live in a sub-collection (replaces
4091
+ InventoryItem[] embedded array); InventoryEvolution is dropped — derivable
4092
+ from the sub-collection. Status transitions and aggregate fields (totalItemsCount/Discrepancies/totalDeltaValue)
4093
+ are server-owned per GH#29 §3.'
4094
+ StocktakeCreate:
4095
+ allOf:
4096
+ - $ref: '#/components/schemas/Stocktake'
4097
+ description: Write payload for creating a new Stocktake document. Fields marked
4098
+ `readOnly` are server-set and must not be included. Fields marked `x-immutable`
4099
+ may be set once at creation.
4100
+ required:
4101
+ - companyId
4102
+ - stocktakeNumber
4103
+ - stocktakeDate
4104
+ - status
4105
+ - adjustmentsApplied
4106
+ - startedAt
4107
+ - createdBy
4108
+ - createdByName
4109
+ StocktakeUpdate:
4110
+ allOf:
4111
+ - $ref: '#/components/schemas/Stocktake'
4112
+ description: Write payload for partial update (PATCH) of a Stocktake document.
4113
+ All fields optional. Fields marked `readOnly` or `x-immutable` must not be
4114
+ sent.
4115
+ StocktakeItem:
4116
+ type: object
4117
+ properties:
4118
+ stockItemId:
4119
+ type: string
4120
+ description: FK → StockItem document ID. Doubles as the item document ID.
4121
+ stockItemName:
4122
+ type: string
4123
+ denormalized: true
4124
+ x-note: Read-time hint snapshot of StockItem.name. Authoritative value lives
4125
+ at the StockItem record; do not refresh on rename — the historical name
4126
+ at session time is what the auditor wrote (GH#29 §3 / Q10).
4127
+ description: (Denormalized) Snapshot of StockItem.name at session time.
4128
+ theoreticalQuantity:
4129
+ type: number
4130
+ x-immutable: true
4131
+ description: (Immutable) System belief at session start, snapshotted when
4132
+ this item row was created.
4133
+ actualQuantity:
4134
+ description: Physical count entered by the counter. Null until counted;
4135
+ set when the line moves to status COUNTED.
4136
+ anyOf:
4137
+ - type: number
4138
+ - type: 'null'
4139
+ delta:
4140
+ type: number
4141
+ readOnly: true
4142
+ x-note: Server-derived = actualQuantity − theoreticalQuantity. Recomputed
4143
+ on every actualQuantity write; null/zero before counting.
4144
+ description: (Read-only) Signed difference between actual and theoretical.
4145
+ Drives the StockMovement(type=INVENTORY) emitted on session COMPLETED.
4146
+ unit:
4147
+ type: string
4148
+ x-immutable: true
4149
+ description: (Immutable) Snapshot of StockItem.unit at session start. Locks
4150
+ the unit against later catalog changes.
4151
+ costPerUnit:
4152
+ type: number
4153
+ x-immutable: true
4154
+ x-note: Snapshot at session time — locks valuation against future cost changes.
4155
+ Lock to XOF integer minor units per D18 (GH#29 Q16).
4156
+ description: (Immutable) Snapshot of StockItem.costPerUnit at session start,
4157
+ in XOF integer minor units.
4158
+ totalValue:
4159
+ type: number
4160
+ readOnly: true
4161
+ x-note: Server-derived = actualQuantity × costPerUnit. Recomputed when actualQuantity
4162
+ is written.
4163
+ description: (Read-only) Per-line valuation in XOF integer minor units.
4164
+ status:
4165
+ $ref: '#/components/schemas/StocktakeItemStatus'
4166
+ description: Per-line workflow status. Server transitions ADJUSTED on parent
4167
+ COMPLETED.
4168
+ x-note: PENDING = line not yet counted. COUNTED = a counter recorded actualQuantity.
4169
+ VERIFIED = a second pair of eyes signed off (verifiedBy fields populated;
4170
+ Q21 — kept nullable until tenants opt into stricter QA via policy). ADJUSTED
4171
+ = the resulting StockMovement was emitted (server-set on Stocktake.status
4172
+ → COMPLETED).
4173
+ x-see:
4174
+ issues:
4175
+ - gh#29
4176
+ notes:
4177
+ description: Optional per-line note from the counter (e.g. "damaged carton,
4178
+ 3 unsellable").
4179
+ anyOf:
4180
+ - type: string
4181
+ - type: 'null'
4182
+ countedBy:
4183
+ description: UID of the staff member who entered actualQuantity.
4184
+ anyOf:
4185
+ - type: string
4186
+ - type: 'null'
4187
+ countedByName:
4188
+ denormalized: true
4189
+ x-note: Read-time hint snapshot of the counter's display name (GH#29 §3
4190
+ / Q10).
4191
+ description: (Denormalized) Snapshot of the counter's display name at count
4192
+ time.
4193
+ anyOf:
4194
+ - type: string
4195
+ - type: 'null'
4196
+ countedAt:
4197
+ anyOf:
4198
+ - $ref: '#/components/schemas/FirestoreTimestamp'
4199
+ - type: 'null'
4200
+ description: When the line was counted.
4201
+ verifiedBy:
4202
+ description: UID of a second staff member who verified the count. Nullable
4203
+ per GH#29 Q21.
4204
+ anyOf:
4205
+ - type: string
4206
+ - type: 'null'
4207
+ verifiedByName:
4208
+ denormalized: true
4209
+ x-note: Read-time hint snapshot of the verifier's display name (GH#29 §3
4210
+ / Q10).
4211
+ description: (Denormalized) Snapshot of the verifier's display name.
4212
+ anyOf:
4213
+ - type: string
4214
+ - type: 'null'
4215
+ verifiedAt:
4216
+ anyOf:
4217
+ - $ref: '#/components/schemas/FirestoreTimestamp'
4218
+ - type: 'null'
4219
+ description: When the line was verified, if a second-eye flow was used.
4220
+ required:
4221
+ - stockItemId
4222
+ - stockItemName
4223
+ - theoreticalQuantity
4224
+ - delta
4225
+ - unit
4226
+ - costPerUnit
4227
+ - totalValue
4228
+ - status
4229
+ additionalProperties: false
4230
+ description: 'StocktakeItem (GH#29 §4). Sub-collection path: companies/{companyId}/stocktakes/{stocktakeId}/items/{stockItemId}.
4231
+ Replaces the embedded `InventoryItem[]` array on the dashboard model. Server
4232
+ emits one StockMovement(type=INVENTORY) per non-zero delta when the parent
4233
+ Stocktake transitions to COMPLETED.'
4234
+ StocktakeItemCreate:
4235
+ allOf:
4236
+ - $ref: '#/components/schemas/StocktakeItem'
4237
+ description: Write payload for creating a new StocktakeItem document. Fields
4238
+ marked `readOnly` are server-set and must not be included. Fields marked `x-immutable`
4239
+ may be set once at creation.
4240
+ required:
4241
+ - stockItemId
4242
+ - stockItemName
4243
+ - theoreticalQuantity
4244
+ - unit
4245
+ - costPerUnit
4246
+ - status
4247
+ StocktakeItemUpdate:
4248
+ allOf:
4249
+ - $ref: '#/components/schemas/StocktakeItem'
4250
+ description: Write payload for partial update (PATCH) of a StocktakeItem document.
4251
+ All fields optional. Fields marked `readOnly` or `x-immutable` must not be
4252
+ sent.
3898
4253
  Ticket:
3899
4254
  type: object
3900
4255
  properties: