cmp-aws-database 2.1.2-dev.1 → 2.1.2-dev.100

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 (98) hide show
  1. package/dist/config/table-names.d.ts +24 -0
  2. package/dist/config/table-names.js +25 -1
  3. package/dist/customer-user/accompaniments/accompaniments-model.d.ts +1 -0
  4. package/dist/customer-user/accompaniments/accompaniments-model.js +5 -1
  5. package/dist/customer-user/add-ons/add-ons-model.d.ts +3 -0
  6. package/dist/customer-user/add-ons/add-ons-model.js +13 -1
  7. package/dist/customer-user/browse-history/browse-history-dao.d.ts +122 -0
  8. package/dist/customer-user/browse-history/browse-history-dao.js +173 -0
  9. package/dist/customer-user/browse-history/browse-history-model.d.ts +31 -0
  10. package/dist/customer-user/browse-history/browse-history-model.js +118 -0
  11. package/dist/customer-user/cart/cart-categories-model.d.ts +6 -2
  12. package/dist/customer-user/cart/cart-categories-model.js +15 -3
  13. package/dist/customer-user/cart/cart-model.d.ts +53 -2
  14. package/dist/customer-user/cart/cart-model.js +135 -2
  15. package/dist/customer-user/catalogue/catalogue-items-dao.d.ts +43 -0
  16. package/dist/customer-user/catalogue/catalogue-items-dao.js +143 -0
  17. package/dist/customer-user/catalogue/catalogue-items-model.d.ts +18 -0
  18. package/dist/customer-user/catalogue/catalogue-items-model.js +72 -0
  19. package/dist/customer-user/category/category-dao.d.ts +29 -0
  20. package/dist/customer-user/category/category-dao.js +52 -1
  21. package/dist/customer-user/category/category-model.d.ts +1 -0
  22. package/dist/customer-user/category/category-model.js +5 -1
  23. package/dist/customer-user/coupons/coupon-redemptions-dao.d.ts +58 -0
  24. package/dist/customer-user/coupons/coupon-redemptions-dao.js +171 -0
  25. package/dist/customer-user/coupons/coupon-redemptions-model.d.ts +27 -0
  26. package/dist/customer-user/coupons/coupon-redemptions-model.js +76 -0
  27. package/dist/customer-user/coupons/coupon-targets-dao.d.ts +32 -0
  28. package/dist/customer-user/coupons/coupon-targets-dao.js +119 -0
  29. package/dist/customer-user/coupons/coupon-targets-keys.d.ts +32 -0
  30. package/dist/customer-user/coupons/coupon-targets-keys.js +86 -0
  31. package/dist/customer-user/coupons/coupon-targets-model.d.ts +25 -0
  32. package/dist/customer-user/coupons/coupon-targets-model.js +76 -0
  33. package/dist/customer-user/coupons/coupons-model.d.ts +17 -0
  34. package/dist/customer-user/coupons/coupons-model.js +34 -3
  35. package/dist/customer-user/cutlery/cutlery-model.d.ts +27 -0
  36. package/dist/customer-user/cutlery/cutlery-model.js +27 -2
  37. package/dist/customer-user/default-platter/default-platters-model.d.ts +2 -0
  38. package/dist/customer-user/default-platter/default-platters-model.js +9 -1
  39. package/dist/customer-user/default-platter/default_platters_items.d.ts +5 -0
  40. package/dist/customer-user/default-platter/default_platters_items.js +21 -1
  41. package/dist/customer-user/elphie/elphie-errors.d.ts +15 -0
  42. package/dist/customer-user/elphie/elphie-errors.js +31 -0
  43. package/dist/customer-user/elphie/elphie-message-dao.d.ts +51 -0
  44. package/dist/customer-user/elphie/elphie-message-dao.js +160 -0
  45. package/dist/customer-user/elphie/elphie-message-model.d.ts +25 -0
  46. package/dist/customer-user/elphie/elphie-message-model.js +78 -0
  47. package/dist/customer-user/elphie/elphie-session-dao.d.ts +46 -0
  48. package/dist/customer-user/elphie/elphie-session-dao.js +134 -0
  49. package/dist/customer-user/elphie/elphie-session-model.d.ts +26 -0
  50. package/dist/customer-user/elphie/elphie-session-model.js +55 -0
  51. package/dist/customer-user/feedbacks/common-feedback-model.d.ts +1 -0
  52. package/dist/customer-user/feedbacks/common-feedback-model.js +5 -1
  53. package/dist/customer-user/fmpRequestCallback/fmp-request-callback-model.d.ts +2 -0
  54. package/dist/customer-user/fmpRequestCallback/fmp-request-callback-model.js +9 -1
  55. package/dist/customer-user/items/items-model.d.ts +3 -0
  56. package/dist/customer-user/items/items-model.js +13 -1
  57. package/dist/customer-user/items-bundle/items-bundle-dao.d.ts +72 -0
  58. package/dist/customer-user/items-bundle/items-bundle-dao.js +117 -0
  59. package/dist/customer-user/items-bundle/items-bundle-model.d.ts +23 -0
  60. package/dist/customer-user/items-bundle/items-bundle-model.js +62 -0
  61. package/dist/customer-user/lsq-priority-updation/lsq-priority-updation-dao.d.ts +140 -0
  62. package/dist/customer-user/lsq-priority-updation/lsq-priority-updation-dao.js +253 -0
  63. package/dist/customer-user/lsq-priority-updation/lsq-priority-updation-model.d.ts +63 -0
  64. package/dist/customer-user/lsq-priority-updation/lsq-priority-updation-model.js +135 -0
  65. package/dist/customer-user/order-module/order/order-model.d.ts +10 -0
  66. package/dist/customer-user/order-module/order/order-model.js +37 -2
  67. package/dist/customer-user/order-module/order-review/order-review-feedback-model.d.ts +12 -1
  68. package/dist/customer-user/order-module/order-review/order-review-feedback-model.js +1 -1
  69. package/dist/customer-user/order-module/payment/payment-model.d.ts +6 -0
  70. package/dist/customer-user/order-module/payment/payment-model.js +5 -1
  71. package/dist/customer-user/order-module/plate-order/plate-order-model.d.ts +59 -0
  72. package/dist/customer-user/order-module/plate-order/plate-order-model.js +167 -3
  73. package/dist/customer-user/order-module/plate-order-update/plate-order-update-dao.d.ts +62 -0
  74. package/dist/customer-user/order-module/plate-order-update/plate-order-update-dao.js +102 -0
  75. package/dist/customer-user/order-module/plate-order-update/plate-order-update-model.d.ts +207 -0
  76. package/dist/customer-user/order-module/plate-order-update/plate-order-update-model.js +315 -0
  77. package/dist/customer-user/order-module/tracking/tracking-model.d.ts +9 -0
  78. package/dist/customer-user/order-module/tracking/tracking-model.js +33 -2
  79. package/dist/customer-user/replace-items/replace-items-model.d.ts +1 -0
  80. package/dist/customer-user/replace-items/replace-items-model.js +5 -1
  81. package/dist/customer-user/resume-journey/resume-journey-model.d.ts +19 -0
  82. package/dist/customer-user/resume-journey/resume-journey-model.js +53 -2
  83. package/dist/customer-user/testing-session/testing-session-dao.d.ts +86 -0
  84. package/dist/customer-user/testing-session/testing-session-dao.js +149 -0
  85. package/dist/customer-user/testing-session/testing-session-model.d.ts +30 -0
  86. package/dist/customer-user/testing-session/testing-session-model.js +104 -0
  87. package/dist/customer-user/user/user-specifics-model.d.ts +2 -0
  88. package/dist/customer-user/user/user-specifics-model.js +9 -1
  89. package/dist/customer-user/whatsapp-invite/whatsapp-invite-dao.d.ts +78 -0
  90. package/dist/customer-user/whatsapp-invite/whatsapp-invite-dao.js +179 -0
  91. package/dist/customer-user/whatsapp-invite/whatsapp-invite-model.d.ts +59 -0
  92. package/dist/customer-user/whatsapp-invite/whatsapp-invite-model.js +124 -0
  93. package/dist/patner-third-party/third-party-api-key/third-party-api-key-dao.d.ts +114 -0
  94. package/dist/patner-third-party/third-party-api-key/third-party-api-key-dao.js +225 -0
  95. package/dist/patner-third-party/third-party-api-key/third-party-api-key-model.d.ts +21 -0
  96. package/dist/patner-third-party/third-party-api-key/third-party-api-key-model.js +70 -0
  97. package/index.js +58 -1
  98. package/package.json +1 -1
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.plateOrderUpdateDao = void 0;
4
+ const base_dao_1 = require("../../../base-dao");
5
+ const plate_order_update_model_1 = require("./plate-order-update-model");
6
+ class PlateOrderUpdateDAO extends base_dao_1.GenericDAO {
7
+ constructor() {
8
+ super(...arguments);
9
+ /**
10
+ * Fetches one update row by primary key `plateUpdateId`.
11
+ *
12
+ * Use when: detail / webhook follow-up / apply flow already has plateUpdateId.
13
+ */
14
+ this.getById = async (plateUpdateId) => {
15
+ const item = new plate_order_update_model_1.PlateOrderUpdateModel();
16
+ item.plateUpdateId = plateUpdateId;
17
+ return this.get(item);
18
+ };
19
+ /**
20
+ * Fetches all update/revision rows for a plate using GSI `plateUpdateIndex`.
21
+ * Sorted by `revisionNumber` descending (newest first) via scanIndexForward: false.
22
+ *
23
+ * Use when: plate-level update history / revision list.
24
+ */
25
+ this.getUpdatesByPlateId = async (plateId) => {
26
+ const updates = [];
27
+ const paginator = base_dao_1.mapper.query(plate_order_update_model_1.PlateOrderUpdateModel, { plateId }, { indexName: "plateUpdateIndex", scanIndexForward: false });
28
+ for await (const update of paginator) {
29
+ updates.push(update);
30
+ }
31
+ return updates;
32
+ };
33
+ /**
34
+ * Fetches all update/revision rows for an order using GSI `orderUpdateIndex`.
35
+ *
36
+ * Use when: order-level update history across plates.
37
+ */
38
+ this.getUpdatesByOrderId = async (orderId) => {
39
+ const updates = [];
40
+ const paginator = base_dao_1.mapper.query(plate_order_update_model_1.PlateOrderUpdateModel, { orderId }, { indexName: "orderUpdateIndex" });
41
+ for await (const update of paginator) {
42
+ updates.push(update);
43
+ }
44
+ return updates;
45
+ };
46
+ /**
47
+ * Returns the newest revision for a plate (highest revisionNumber), or null.
48
+ *
49
+ * Use when: showing last update attempt / computing next revisionNumber.
50
+ */
51
+ this.getLatestByPlateId = async (plateId) => {
52
+ const updates = await this.getUpdatesByPlateId(plateId);
53
+ return updates[0] ?? null;
54
+ };
55
+ /**
56
+ * Returns max revisionNumber for a plate (0 if none).
57
+ *
58
+ * Use when: assigning next revisionNumber = max + 1 before create.
59
+ */
60
+ this.getMaxRevisionNumber = async (plateId) => {
61
+ const latest = await this.getLatestByPlateId(plateId);
62
+ return latest?.revisionNumber ?? 0;
63
+ };
64
+ /**
65
+ * Filters plate updates by `status`.
66
+ *
67
+ * Use when: list only APPLIED / PENDING_PAYMENT / FAILED / CANCELLED rows.
68
+ */
69
+ this.getByPlateIdAndStatus = async (plateId, status) => {
70
+ const updates = await this.getUpdatesByPlateId(plateId);
71
+ return updates.filter((u) => u.status === status);
72
+ };
73
+ /**
74
+ * Plate updates waiting on payment (`PENDING_PAYMENT`).
75
+ *
76
+ * Use when: block new paid update if one is already pending, or timeout job.
77
+ */
78
+ this.getPendingPaymentByPlateId = async (plateId) => {
79
+ return this.getByPlateIdAndStatus(plateId, plate_order_update_model_1.PLATE_UPDATE_STATUS.PENDING_PAYMENT);
80
+ };
81
+ /**
82
+ * Successfully applied plate updates only.
83
+ *
84
+ * Use when: rebuild per-type `updateUsage` / frequency from history.
85
+ */
86
+ this.getAppliedByPlateId = async (plateId) => {
87
+ return this.getByPlateIdAndStatus(plateId, plate_order_update_model_1.PLATE_UPDATE_STATUS.APPLIED);
88
+ };
89
+ /**
90
+ * Finds an update on a plate by `paymentId` (in-memory filter after GSI query).
91
+ *
92
+ * Use when: payment callback / webhook resolved Payment row and you have plateId + paymentId.
93
+ * Payment status / razorpayOrderId → read from PaymentTable via paymentId (single source).
94
+ */
95
+ this.getByPaymentIdOnPlate = async (plateId, paymentId) => {
96
+ const updates = await this.getUpdatesByPlateId(plateId);
97
+ return updates.find((u) => u.paymentId === paymentId) ?? null;
98
+ };
99
+ }
100
+ }
101
+ exports.plateOrderUpdateDao = new PlateOrderUpdateDAO();
102
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGxhdGUtb3JkZXItdXBkYXRlLWRhby5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jdXN0b21lci11c2VyL29yZGVyLW1vZHVsZS9wbGF0ZS1vcmRlci11cGRhdGUvcGxhdGUtb3JkZXItdXBkYXRlLWRhby50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxnREFBdUQ7QUFDdkQseUVBR29DO0FBRXBDLE1BQU0sbUJBQW9CLFNBQVEscUJBQWlDO0lBQW5FOztRQUVJOzs7O1dBSUc7UUFDSCxZQUFPLEdBQUcsS0FBSyxFQUFFLGFBQXFCLEVBQWtDLEVBQUU7WUFDdEUsTUFBTSxJQUFJLEdBQUcsSUFBSSxnREFBcUIsRUFBRSxDQUFDO1lBQ3pDLElBQUksQ0FBQyxhQUFhLEdBQUcsYUFBYSxDQUFDO1lBQ25DLE9BQU8sSUFBSSxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUMxQixDQUFDLENBQUM7UUFFRjs7Ozs7V0FLRztRQUNILHdCQUFtQixHQUFHLEtBQUssRUFBRS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0 +1,207 @@
1
+ import { BaseModel } from "../../../base-model";
2
+ import { CutleryItem, ItemDetails } from "../plate-order/plate-order-model";
3
+ /**
4
+ * Append-only revision / audit log for paid plate-order updates.
5
+ * Parent PlateOrdersTable row remains the current state; each update is one row here.
6
+ */
7
+ export declare const PLATE_UPDATE_TYPE: {
8
+ readonly GUEST_COUNT: "GUEST_COUNT";
9
+ readonly DATE_TIME: "DATE_TIME";
10
+ readonly CUTLERY: "CUTLERY";
11
+ readonly SPECIAL_INSTRUCTIONS: "SPECIAL_INSTRUCTIONS";
12
+ readonly DELIVERY_SERVICE: "DELIVERY_SERVICE";
13
+ readonly ITEMS: "ITEMS";
14
+ /** Alternate contact number — scalar diff via changedFields, never needs payment. */
15
+ readonly ALTERNATE_NUMBER: "ALTERNATE_NUMBER";
16
+ };
17
+ export type PlateUpdateType = (typeof PLATE_UPDATE_TYPE)[keyof typeof PLATE_UPDATE_TYPE];
18
+ export declare const PLATE_UPDATE_STATUS: {
19
+ readonly PENDING_PAYMENT: "PENDING_PAYMENT";
20
+ readonly APPLIED: "APPLIED";
21
+ readonly FAILED: "FAILED";
22
+ readonly CANCELLED: "CANCELLED";
23
+ };
24
+ export type PlateUpdateStatus = (typeof PLATE_UPDATE_STATUS)[keyof typeof PLATE_UPDATE_STATUS];
25
+ export declare const ITEM_OPERATION_TYPE: {
26
+ readonly QTY_CHANGE: "QTY_CHANGE";
27
+ readonly REPLACE: "REPLACE";
28
+ readonly ADD: "ADD";
29
+ readonly REMOVE: "REMOVE";
30
+ };
31
+ export type ItemOperationType = (typeof ITEM_OPERATION_TYPE)[keyof typeof ITEM_OPERATION_TYPE];
32
+ /** Same ops as items — cutlery list on plate is CutleryItem[]. */
33
+ export declare const CUTLERY_OPERATION_TYPE: {
34
+ readonly QTY_CHANGE: "QTY_CHANGE";
35
+ readonly REPLACE: "REPLACE";
36
+ readonly ADD: "ADD";
37
+ readonly REMOVE: "REMOVE";
38
+ };
39
+ export type CutleryOperationType = (typeof CUTLERY_OPERATION_TYPE)[keyof typeof CUTLERY_OPERATION_TYPE];
40
+ export declare class PlateOrderUpdateModel extends BaseModel {
41
+ plateUpdateId: string;
42
+ plateId: string;
43
+ orderId: string;
44
+ userId: string;
45
+ /**
46
+ * 1, 2, 3… per plate — GSI plateUpdateIndex RANGE (sorted history).
47
+ * Distinct integers; no ms collision.
48
+ */
49
+ revisionNumber: number;
50
+ /** e.g. ["GUEST_COUNT","DATE_TIME"] — List of strings (nova-odm needs { type: "String" }, not bare "String") */
51
+ updateTypes: string[];
52
+ /**
53
+ * Simple scalar diffs only (GUEST_COUNT, DATE_TIME, ALTERNATE_NUMBER, plain string fields).
54
+ * Do NOT use for DELIVERY_SERVICE / SPECIAL_INSTRUCTIONS / ITEMS / CUTLERY —
55
+ * those have dedicated structured before/after below.
56
+ */
57
+ changedFields: ChangedField[];
58
+ /** Only for ITEMS updates */
59
+ itemOperations?: ItemOperation[];
60
+ /** Only for CUTLERY updates — same idea as itemOperations, shape = CutleryItem */
61
+ cutleryOperations?: CutleryOperation[];
62
+ /**
63
+ * DELIVERY_SERVICE — structured change.
64
+ * Assistive needs helperCount (1–8); string changedFields alone is not enough.
65
+ */
66
+ deliveryServiceChange?: DeliveryServiceChange;
67
+ /**
68
+ * SPECIAL_INSTRUCTIONS / preferences — spicyLevel, noOnionGarlic, notes, etc.
69
+ * Multiple fields in one update; string changedFields alone does not fit.
70
+ */
71
+ specialInstructionsChange?: SpecialInstructionsChange;
72
+ /**
73
+ * EXTRA charge for this update (what customer is billed for the change).
74
+ * One object, all fields optional — only the buckets that changed are filled:
75
+ * - FOOD change (guest / noOnionGarlic / items) → foodPrice, packing (+ gst, total)
76
+ * - CUTLERY change → cutleryPrice (+ gst, total)
77
+ * - DELIVERY change → deliveryPrice (+ gst, total)
78
+ * gst/total are for whatever is present. Combined update = multiple price fields set,
79
+ * total = sum of all + their gst. Works for individual and combined with one shape.
80
+ */
81
+ pricingBreakdown: PricingBreakdown;
82
+ /**
83
+ * Amount customer must PAY for this update (₹) = pricingBreakdown.total.
84
+ * → PaymentTable.amount when requiresPayment. 0 ⇒ no payment.
85
+ */
86
+ payableAmount: number;
87
+ /** "v1" | "v2" — which pricing engine computed this */
88
+ pricingVersion: string;
89
+ /**
90
+ * true → create PaymentTable row and set paymentId.
91
+ * false → no Payment row; leave paymentId unset and apply update directly.
92
+ * Payment details (razorpayOrderId, paymentStatus, amount) live ONLY on PaymentTable —
93
+ * fetch via paymentId to avoid status drift.
94
+ */
95
+ requiresPayment: boolean;
96
+ /** FK to PaymentTable — only when requiresPayment. Single link; no duplicated payment fields. */
97
+ paymentId?: string;
98
+ status: string;
99
+ }
100
+ /** Scalar before/after diff (stored as String for uniform typing). */
101
+ export declare class ChangedField {
102
+ field: string;
103
+ before: string;
104
+ after: string;
105
+ }
106
+ /**
107
+ * Item change — identity + qty live inside ItemDetails (itemId, itemQuantity, …).
108
+ * Do NOT duplicate ids/qty outside; use before/after snapshots only.
109
+ *
110
+ * ADD: after only | REMOVE: before only | QTY_CHANGE / REPLACE: before + after
111
+ */
112
+ export declare class ItemOperation {
113
+ /** QTY_CHANGE | REPLACE | ADD | REMOVE */
114
+ operationType: string;
115
+ /** Which category list on the plate (vegItems / nonVegItems / …) */
116
+ categoryId?: string;
117
+ /** State before change (REMOVE / QTY_CHANGE / REPLACE) */
118
+ before?: ItemDetails;
119
+ /** State after change (ADD / QTY_CHANGE / REPLACE) */
120
+ after?: ItemDetails;
121
+ }
122
+ /**
123
+ * Cutlery change — identity + qty live inside CutleryItem (cutleryId, cutleryQuantity, …).
124
+ * Same before/after pattern as ItemOperation — no duplicate cutleryId/qty fields.
125
+ *
126
+ * ADD: after only | REMOVE: before only | QTY_CHANGE / REPLACE: before + after
127
+ *
128
+ * Item-level charge for this update lives on the op (not inside CutleryItem):
129
+ * addedQuantity / lineAmount = delta for this revision only (Figma cutlery breakup).
130
+ */
131
+ export declare class CutleryOperation {
132
+ /** QTY_CHANGE | REPLACE | ADD | REMOVE */
133
+ operationType: string;
134
+ /** State before change (REMOVE / QTY_CHANGE / REPLACE) */
135
+ before?: CutleryItem;
136
+ /** State after change (ADD / QTY_CHANGE / REPLACE) */
137
+ after?: CutleryItem;
138
+ /**
139
+ * Qty added in this update only (e.g. +10), not final plate qty.
140
+ * Guest-auto bump (water bottle +N with guests) also uses this.
141
+ */
142
+ addedQuantity?: number;
143
+ /**
144
+ * Extra charge for this item in this update (₹, without GST).
145
+ * Same value pricing already computes as item lineAmount.
146
+ * Sum of ops’ lineAmount ≈ pricingBreakdown.cutleryPrice for pure CUTLERY updates.
147
+ */
148
+ lineAmount?: number;
149
+ }
150
+ /**
151
+ * Delivery tier snapshot.
152
+ * STANDARD / DOORSTEP / VALUE / SIGNATURE → mostly service + price.
153
+ * ASSISTIVE → also helperCount (1–8).
154
+ */
155
+ export declare class DeliveryServiceSnapshot {
156
+ /** STANDARD | DOORSTEP | ASSISTIVE | VALUE | SIGNATURE | … */
157
+ deliveryService: string;
158
+ /** Assistive only — helpers 1..8 */
159
+ helperCount?: number;
160
+ deliveryFees?: number;
161
+ doorStepServicePrice?: number;
162
+ cateringServiceCharge?: number;
163
+ }
164
+ export declare class DeliveryServiceChange {
165
+ before?: DeliveryServiceSnapshot;
166
+ after?: DeliveryServiceSnapshot;
167
+ }
168
+ /**
169
+ * Preferences / special-instructions snapshot (maps onto plate SetPreferences + instruction fields).
170
+ */
171
+ export declare class SpecialInstructionsSnapshot {
172
+ spicyLevel?: string;
173
+ isOnionGarlicSelected?: boolean;
174
+ noOnionGarlicCharge?: number;
175
+ /** Free-text notes */
176
+ tellUsMore?: string;
177
+ }
178
+ export declare class SpecialInstructionsChange {
179
+ before?: SpecialInstructionsSnapshot;
180
+ after?: SpecialInstructionsSnapshot;
181
+ }
182
+ /**
183
+ * EXTRA charge breakdown for an update — ONE shape for all cases.
184
+ * All price fields optional: fill only the buckets that changed.
185
+ * - FOOD change (guest / noOnionGarlic / items) → foodPrice (+ packing)
186
+ * - CUTLERY change → cutleryPrice
187
+ * - DELIVERY change → deliveryPrice
188
+ * gst = GST on whatever is present (food/cutlery ~5%, delivery ~18% — summed here).
189
+ * total = sum of all set price fields + gst. Individual = one price set; combined = many.
190
+ * payableAmount on the model mirrors total.
191
+ */
192
+ export declare class PricingBreakdown {
193
+ /** Extra food charge (guest scaling / items). */
194
+ foodPrice?: number;
195
+ /** noOnionGarlic uplift, if billed separately from food. */
196
+ noOnionGarlicPrice?: number;
197
+ /** Extra packaging (scales with food / guests). */
198
+ packing?: number;
199
+ /** Extra cutlery charge. */
200
+ cutleryPrice?: number;
201
+ /** Extra delivery / service charge. */
202
+ deliveryPrice?: number;
203
+ /** GST on the set price fields (combined across buckets). */
204
+ gst: number;
205
+ /** Grand total = set price fields + gst = payableAmount. */
206
+ total: number;
207
+ }