wiil-core-js 0.0.82
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.
- package/LICENSE +21 -0
- package/README.md +174 -0
- package/dist/core/account/index.d.ts +7 -0
- package/dist/core/account/index.js +23 -0
- package/dist/core/account/organization.schema.d.ts +118 -0
- package/dist/core/account/organization.schema.js +91 -0
- package/dist/core/account/project.schema.d.ts +121 -0
- package/dist/core/account/project.schema.js +102 -0
- package/dist/core/account/supported-business-verticals.d.ts +8 -0
- package/dist/core/account/supported-business-verticals.js +23 -0
- package/dist/core/assistant-setups/assistant-setup-result.schema.d.ts +115 -0
- package/dist/core/assistant-setups/assistant-setup-result.schema.js +17 -0
- package/dist/core/assistant-setups/base-assistant-setup.schema.d.ts +61 -0
- package/dist/core/assistant-setups/base-assistant-setup.schema.js +29 -0
- package/dist/core/assistant-setups/index.d.ts +4 -0
- package/dist/core/assistant-setups/index.js +21 -0
- package/dist/core/assistant-setups/phone-assistant-setup.schema.d.ts +63 -0
- package/dist/core/assistant-setups/phone-assistant-setup.schema.js +14 -0
- package/dist/core/assistant-setups/web-assitant-setup.schema.d.ts +56 -0
- package/dist/core/assistant-setups/web-assitant-setup.schema.js +17 -0
- package/dist/core/base.schema.d.ts +34 -0
- package/dist/core/base.schema.js +36 -0
- package/dist/core/business-mgt/appointment-additional-info.schema.d.ts +63 -0
- package/dist/core/business-mgt/appointment-additional-info.schema.js +53 -0
- package/dist/core/business-mgt/appointment-field-config.schema.d.ts +251 -0
- package/dist/core/business-mgt/appointment-field-config.schema.js +49 -0
- package/dist/core/business-mgt/bookings.shared.schema.d.ts +47 -0
- package/dist/core/business-mgt/bookings.shared.schema.js +60 -0
- package/dist/core/business-mgt/business-location.schema.d.ts +327 -0
- package/dist/core/business-mgt/business-location.schema.js +176 -0
- package/dist/core/business-mgt/customer-management/customer-group.schema.d.ts +87 -0
- package/dist/core/business-mgt/customer-management/customer-group.schema.js +53 -0
- package/dist/core/business-mgt/customer-management/customer.schema.d.ts +156 -0
- package/dist/core/business-mgt/customer-management/customer.schema.js +93 -0
- package/dist/core/business-mgt/customer-management/index.d.ts +7 -0
- package/dist/core/business-mgt/customer-management/index.js +23 -0
- package/dist/core/business-mgt/customer-management/shipping-address.schema.d.ts +112 -0
- package/dist/core/business-mgt/customer-management/shipping-address.schema.js +79 -0
- package/dist/core/business-mgt/customer.schema.d.ts +111 -0
- package/dist/core/business-mgt/customer.schema.js +73 -0
- package/dist/core/business-mgt/discount-rule.schema.d.ts +183 -0
- package/dist/core/business-mgt/discount-rule.schema.js +108 -0
- package/dist/core/business-mgt/index.d.ts +16 -0
- package/dist/core/business-mgt/index.js +38 -0
- package/dist/core/business-mgt/menu-config.schema.d.ts +165 -0
- package/dist/core/business-mgt/menu-config.schema.js +86 -0
- package/dist/core/business-mgt/menu-management/index.d.ts +11 -0
- package/dist/core/business-mgt/menu-management/index.js +27 -0
- package/dist/core/business-mgt/menu-management/menu-catalog.schema.d.ts +386 -0
- package/dist/core/business-mgt/menu-management/menu-catalog.schema.js +58 -0
- package/dist/core/business-mgt/menu-management/menu-config.schema.d.ts +301 -0
- package/dist/core/business-mgt/menu-management/menu-config.schema.js +169 -0
- package/dist/core/business-mgt/menu-management/menu-item-variant.schema.d.ts +143 -0
- package/dist/core/business-mgt/menu-management/menu-item-variant.schema.js +86 -0
- package/dist/core/business-mgt/menu-management/menu-pricing-rule.schema.d.ts +239 -0
- package/dist/core/business-mgt/menu-management/menu-pricing-rule.schema.js +117 -0
- package/dist/core/business-mgt/menu-management/menu-set.schema.d.ts +420 -0
- package/dist/core/business-mgt/menu-management/menu-set.schema.js +283 -0
- package/dist/core/business-mgt/menu-management/menu.order.schema.d.ts +654 -0
- package/dist/core/business-mgt/menu-management/menu.order.schema.js +204 -0
- package/dist/core/business-mgt/menu-management/modifier.schema.d.ts +585 -0
- package/dist/core/business-mgt/menu-management/modifier.schema.js +341 -0
- package/dist/core/business-mgt/menu.order.schema.d.ts +335 -0
- package/dist/core/business-mgt/menu.order.schema.js +149 -0
- package/dist/core/business-mgt/order.schema.d.ts +222 -0
- package/dist/core/business-mgt/order.schema.js +205 -0
- package/dist/core/business-mgt/pricing-rule.shared.schema.d.ts +56 -0
- package/dist/core/business-mgt/pricing-rule.shared.schema.js +68 -0
- package/dist/core/business-mgt/product-config.schema.d.ts +177 -0
- package/dist/core/business-mgt/product-config.schema.js +106 -0
- package/dist/core/business-mgt/product-management/index.d.ts +12 -0
- package/dist/core/business-mgt/product-management/index.js +28 -0
- package/dist/core/business-mgt/product-management/product-axis-binding.schema.d.ts +54 -0
- package/dist/core/business-mgt/product-management/product-axis-binding.schema.js +54 -0
- package/dist/core/business-mgt/product-management/product-config.schema.d.ts +1042 -0
- package/dist/core/business-mgt/product-management/product-config.schema.js +392 -0
- package/dist/core/business-mgt/product-management/product-display.schema.d.ts +548 -0
- package/dist/core/business-mgt/product-management/product-display.schema.js +80 -0
- package/dist/core/business-mgt/product-management/product-order.schema.d.ts +493 -0
- package/dist/core/business-mgt/product-management/product-order.schema.js +158 -0
- package/dist/core/business-mgt/product-management/product-pricing-rule.schema.d.ts +167 -0
- package/dist/core/business-mgt/product-management/product-pricing-rule.schema.js +68 -0
- package/dist/core/business-mgt/product-management/product-set.schema.d.ts +488 -0
- package/dist/core/business-mgt/product-management/product-set.schema.js +273 -0
- package/dist/core/business-mgt/product-management/product-variant-axis.schema.d.ts +156 -0
- package/dist/core/business-mgt/product-management/product-variant-axis.schema.js +98 -0
- package/dist/core/business-mgt/product-management/product-variant.schema.d.ts +219 -0
- package/dist/core/business-mgt/product-management/product-variant.schema.js +130 -0
- package/dist/core/business-mgt/product-order.schema.d.ts +326 -0
- package/dist/core/business-mgt/product-order.schema.js +153 -0
- package/dist/core/business-mgt/property-config.schema.d.ts +621 -0
- package/dist/core/business-mgt/property-config.schema.js +224 -0
- package/dist/core/business-mgt/property-inquiry.schema.d.ts +222 -0
- package/dist/core/business-mgt/property-inquiry.schema.js +112 -0
- package/dist/core/business-mgt/property-management/index.d.ts +6 -0
- package/dist/core/business-mgt/property-management/index.js +22 -0
- package/dist/core/business-mgt/property-management/property-config.schema.d.ts +1306 -0
- package/dist/core/business-mgt/property-management/property-config.schema.js +367 -0
- package/dist/core/business-mgt/property-management/property-inquiry.schema.d.ts +254 -0
- package/dist/core/business-mgt/property-management/property-inquiry.schema.js +131 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/index.d.ts +3 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/index.js +19 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-rental-assignment.schema.d.ts +139 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-rental-assignment.schema.js +90 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-room-assignment.schema.d.ts +104 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-room-assignment.schema.js +70 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-table-assignment.schema.d.ts +104 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-table-assignment.schema.js +72 -0
- package/dist/core/business-mgt/reservation-mgt/index.d.ts +14 -0
- package/dist/core/business-mgt/reservation-mgt/index.js +31 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-floor-plan-definition.schema.d.ts +180 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-floor-plan-definition.schema.js +75 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-maintenance-block.schema.d.ts +91 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-maintenance-block.schema.js +57 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-rental.schema.d.ts +334 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-rental.schema.js +179 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-room.schema.d.ts +195 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-room.schema.js +106 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-section.schema.d.ts +402 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-section.schema.js +198 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-settings.schema.d.ts +229 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-settings.schema.js +127 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-slot-query.schema.d.ts +382 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-slot-query.schema.js +322 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table-layout.schema.d.ts +123 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table-layout.schema.js +83 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table.schema.d.ts +167 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table.schema.js +84 -0
- package/dist/core/business-mgt/reservation-mgt/reservation.schema.d.ts +0 -0
- package/dist/core/business-mgt/reservation-mgt/reservation.schema.js +153 -0
- package/dist/core/business-mgt/reservation-mgt/resource/index.d.ts +4 -0
- package/dist/core/business-mgt/reservation-mgt/resource/index.js +20 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-category.schema.d.ts +157 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-category.schema.js +76 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-instance.schema.d.ts +137 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-instance.schema.js +94 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource.schema.d.ts +713 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource.schema.js +363 -0
- package/dist/core/business-mgt/reservation-mgt/resource/resource-versioning.schema.d.ts +151 -0
- package/dist/core/business-mgt/reservation-mgt/resource/resource-versioning.schema.js +147 -0
- package/dist/core/business-mgt/reservation-resource.schema.d.ts +154 -0
- package/dist/core/business-mgt/reservation-resource.schema.js +100 -0
- package/dist/core/business-mgt/reservation.schema.d.ts +119 -0
- package/dist/core/business-mgt/reservation.schema.js +89 -0
- package/dist/core/business-mgt/service-appointment.schema.d.ts +105 -0
- package/dist/core/business-mgt/service-appointment.schema.js +69 -0
- package/dist/core/business-mgt/service-config.schema.d.ts +453 -0
- package/dist/core/business-mgt/service-config.schema.js +102 -0
- package/dist/core/business-mgt/service-management/appointment-additional-info.schema.d.ts +110 -0
- package/dist/core/business-mgt/service-management/appointment-additional-info.schema.js +78 -0
- package/dist/core/business-mgt/service-management/appointment-field-config.schema.d.ts +304 -0
- package/dist/core/business-mgt/service-management/appointment-field-config.schema.js +75 -0
- package/dist/core/business-mgt/service-management/business-service-config.schema.d.ts +1226 -0
- package/dist/core/business-mgt/service-management/business-service-config.schema.js +317 -0
- package/dist/core/business-mgt/service-management/index.d.ts +13 -0
- package/dist/core/business-mgt/service-management/index.js +29 -0
- package/dist/core/business-mgt/service-management/service-appointment.schema.d.ts +531 -0
- package/dist/core/business-mgt/service-management/service-appointment.schema.js +116 -0
- package/dist/core/business-mgt/service-management/service-person.schema.d.ts +122 -0
- package/dist/core/business-mgt/service-management/service-person.schema.js +66 -0
- package/dist/core/business-mgt/service-management/service-pricing-rule.schema.d.ts +221 -0
- package/dist/core/business-mgt/service-management/service-pricing-rule.schema.js +118 -0
- package/dist/core/business-mgt/service-management/service-provider.schema.d.ts +90 -0
- package/dist/core/business-mgt/service-management/service-provider.schema.js +54 -0
- package/dist/core/business-mgt/service-management/service-slot-query.schema.d.ts +90 -0
- package/dist/core/business-mgt/service-management/service-slot-query.schema.js +113 -0
- package/dist/core/business-mgt/service-management/service-time-off.schema.d.ts +121 -0
- package/dist/core/business-mgt/service-management/service-time-off.schema.js +95 -0
- package/dist/core/business-mgt/service-person.schema.d.ts +43 -0
- package/dist/core/business-mgt/service-person.schema.js +38 -0
- package/dist/core/business-mgt/tax-rule.schema.d.ts +161 -0
- package/dist/core/business-mgt/tax-rule.schema.js +90 -0
- package/dist/core/conversation/conversation-config.schema.d.ts +644 -0
- package/dist/core/conversation/conversation-config.schema.js +351 -0
- package/dist/core/conversation/conversation-message.schema.d.ts +307 -0
- package/dist/core/conversation/conversation-message.schema.js +275 -0
- package/dist/core/conversation/index.d.ts +12 -0
- package/dist/core/conversation/index.js +28 -0
- package/dist/core/conversation/outbound-call.schema.d.ts +209 -0
- package/dist/core/conversation/outbound-call.schema.js +116 -0
- package/dist/core/conversation/outbound-email.schema.d.ts +338 -0
- package/dist/core/conversation/outbound-email.schema.js +150 -0
- package/dist/core/conversation/outbound-sms.schema.d.ts +163 -0
- package/dist/core/conversation/outbound-sms.schema.js +85 -0
- package/dist/core/conversation/outbound-template.schema.d.ts +375 -0
- package/dist/core/conversation/outbound-template.schema.js +160 -0
- package/dist/core/conversation/translation-config.schema.d.ts +92 -0
- package/dist/core/conversation/translation-config.schema.js +88 -0
- package/dist/core/conversation/translation-conversation.schema.d.ts +469 -0
- package/dist/core/conversation/translation-conversation.schema.js +175 -0
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.js +30 -0
- package/dist/core/service-configuration/agent-config.schema.d.ts +236 -0
- package/dist/core/service-configuration/agent-config.schema.js +152 -0
- package/dist/core/service-configuration/base-agent-setup.d.ts +147 -0
- package/dist/core/service-configuration/base-agent-setup.js +123 -0
- package/dist/core/service-configuration/call-transfer-config.schema.d.ts +60 -0
- package/dist/core/service-configuration/call-transfer-config.schema.js +53 -0
- package/dist/core/service-configuration/deployment-config.schema.d.ts +522 -0
- package/dist/core/service-configuration/deployment-config.schema.js +271 -0
- package/dist/core/service-configuration/dynamic_setup/base-agent-setup.d.ts +130 -0
- package/dist/core/service-configuration/dynamic_setup/base-agent-setup.js +110 -0
- package/dist/core/service-configuration/dynamic_setup/index.d.ts +10 -0
- package/dist/core/service-configuration/dynamic_setup/index.js +26 -0
- package/dist/core/service-configuration/dynamic_setup/phone-agent-setup.d.ts +111 -0
- package/dist/core/service-configuration/dynamic_setup/phone-agent-setup.js +56 -0
- package/dist/core/service-configuration/dynamic_setup/web-agent-setup.d.ts +113 -0
- package/dist/core/service-configuration/dynamic_setup/web-agent-setup.js +55 -0
- package/dist/core/service-configuration/index.d.ts +17 -0
- package/dist/core/service-configuration/index.js +33 -0
- package/dist/core/service-configuration/instruction-config.schema.d.ts +183 -0
- package/dist/core/service-configuration/instruction-config.schema.js +139 -0
- package/dist/core/service-configuration/interaction-channels.schema.d.ts +469 -0
- package/dist/core/service-configuration/interaction-channels.schema.js +390 -0
- package/dist/core/service-configuration/knowledge.schema.d.ts +107 -0
- package/dist/core/service-configuration/knowledge.schema.js +106 -0
- package/dist/core/service-configuration/phone-config.schema.d.ts +206 -0
- package/dist/core/service-configuration/phone-config.schema.js +121 -0
- package/dist/core/service-configuration/phone-number.schema.d.ts +236 -0
- package/dist/core/service-configuration/phone-number.schema.js +211 -0
- package/dist/core/service-configuration/provisioning-config.d.ts +429 -0
- package/dist/core/service-configuration/provisioning-config.js +307 -0
- package/dist/core/service-configuration/support-llm.d.ts +95 -0
- package/dist/core/service-configuration/support-llm.js +76 -0
- package/dist/core/service-configuration/voice-language.schema.d.ts +200 -0
- package/dist/core/service-configuration/voice-language.schema.js +166 -0
- package/dist/core/type-definitions/account-definitions.d.ts +82 -0
- package/dist/core/type-definitions/account-definitions.js +88 -0
- package/dist/core/type-definitions/business-definitions.d.ts +394 -0
- package/dist/core/type-definitions/business-definitions.js +447 -0
- package/dist/core/type-definitions/conversation.type.definition.d.ts +223 -0
- package/dist/core/type-definitions/conversation.type.definition.js +236 -0
- package/dist/core/type-definitions/display-order.d.ts +154 -0
- package/dist/core/type-definitions/display-order.js +154 -0
- package/dist/core/type-definitions/dynamic-fields/field-definition.schema.d.ts +165 -0
- package/dist/core/type-definitions/dynamic-fields/field-definition.schema.js +97 -0
- package/dist/core/type-definitions/dynamic-fields/field-types.d.ts +49 -0
- package/dist/core/type-definitions/dynamic-fields/field-types.js +104 -0
- package/dist/core/type-definitions/dynamic-fields/index.d.ts +9 -0
- package/dist/core/type-definitions/dynamic-fields/index.js +25 -0
- package/dist/core/type-definitions/index.d.ts +10 -0
- package/dist/core/type-definitions/index.js +26 -0
- package/dist/core/type-definitions/knowledge-definitions.d.ts +30 -0
- package/dist/core/type-definitions/knowledge-definitions.js +37 -0
- package/dist/core/type-definitions/service-config.definitions.d.ts +112 -0
- package/dist/core/type-definitions/service-config.definitions.js +135 -0
- package/dist/core/validators/channel-validation.d.ts +19 -0
- package/dist/core/validators/channel-validation.js +40 -0
- package/dist/core/validators/index.d.ts +5 -0
- package/dist/core/validators/index.js +21 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +24 -0
- package/dist/request/index.d.ts +5 -0
- package/dist/request/index.js +21 -0
- package/dist/request/models/index.d.ts +6 -0
- package/dist/request/models/index.js +22 -0
- package/dist/request/models/paginated-quest.schema.d.ts +33 -0
- package/dist/request/models/paginated-quest.schema.js +35 -0
- package/dist/request/models/paginated-result.schema.d.ts +124 -0
- package/dist/request/models/paginated-result.schema.js +94 -0
- package/package.json +43 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UpdateMenuOrderStatusSchema = exports.UpdateMenuOrderSchema = exports.CreateMenuOrderSchema = exports.MenuOrderSchema = exports.MenuOrderItemSchema = exports.MenuOrderItemBaseSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const base_schema_1 = require("../base.schema");
|
|
9
|
+
const order_schema_1 = require("./order.schema");
|
|
10
|
+
const type_definitions_1 = require("../type-definitions");
|
|
11
|
+
/**
|
|
12
|
+
* @fileoverview Menu order schema definitions for restaurant/food service.
|
|
13
|
+
* @module business-mgt/menu-order
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Base menu order item schema (without IDs for creation).
|
|
17
|
+
*
|
|
18
|
+
* @typedef {Object} MenuOrderItemBase
|
|
19
|
+
* @property {string} menuItemId - Menu item ID being ordered
|
|
20
|
+
* @property {string} itemName - Name of the menu item
|
|
21
|
+
* @property {number} quantity - Quantity ordered
|
|
22
|
+
* @property {number} unitPrice - Price per unit
|
|
23
|
+
* @property {number} totalPrice - Total price for this item
|
|
24
|
+
* @property {string} [specialInstructions] - Special preparation instructions
|
|
25
|
+
* @property {Array} [customizations] - Item customizations with additional costs
|
|
26
|
+
* @property {string} status - Item status
|
|
27
|
+
* @property {number} [preparationTime] - Estimated prep time in minutes
|
|
28
|
+
* @property {string} [notes] - Additional notes
|
|
29
|
+
*/
|
|
30
|
+
exports.MenuOrderItemBaseSchema = zod_1.default.object({
|
|
31
|
+
menuItemId: zod_1.default.string().describe("References MenuItem from menu-config.schema that is being ordered. Links order item to catalog for pricing, availability, and preparation details."),
|
|
32
|
+
itemName: zod_1.default.string().describe("Display name of the menu item captured at order time. Preserved even if catalog item is later renamed, ensuring historical order accuracy."),
|
|
33
|
+
quantity: zod_1.default.number().int().positive().describe("Number of units ordered for this menu item. Used for pricing calculations and kitchen preparation quantities."),
|
|
34
|
+
unitPrice: zod_1.default.number().nonnegative().describe("Price per unit at the time of order. Captures pricing snapshot for order integrity even if catalog prices change later."),
|
|
35
|
+
totalPrice: zod_1.default.number().nonnegative().describe("Total price for this line item: unitPrice × quantity + customization costs. Used in order subtotal calculations."),
|
|
36
|
+
// Restaurant-specific
|
|
37
|
+
specialInstructions: zod_1.default.string().nullable().default(null).describe("Customer's special preparation requests (e.g., 'no onions', 'extra sauce', 'well done'). Communicated to kitchen staff for customized preparation."),
|
|
38
|
+
customizations: zod_1.default.array(zod_1.default.object({
|
|
39
|
+
name: zod_1.default.string().describe("Customization option name (e.g., 'Extra Cheese', 'Gluten-Free Bread', 'Add Bacon')."),
|
|
40
|
+
value: zod_1.default.string().describe("Selected customization value or specification (e.g., 'Yes', 'Large', 'On the side')."),
|
|
41
|
+
additionalCost: zod_1.default.number().nonnegative().default(0).describe("Extra charge for this customization. Defaults to 0 for no-cost modifications.")
|
|
42
|
+
})).nullable().default(null).describe("Item customizations with pricing. Enables upselling and personalization in AI-powered Menu Order conversations."),
|
|
43
|
+
status: zod_1.default.enum(type_definitions_1.OrderStatus).default(type_definitions_1.OrderStatus.PENDING).describe("Current preparation status of this individual item. Enables per-item tracking in kitchen workflow. Defaults to PENDING."),
|
|
44
|
+
preparationTime: zod_1.default.number().int().positive().nullable().default(null).describe("Estimated preparation time in minutes for this specific item. Used for kitchen scheduling and customer ready-time estimates."),
|
|
45
|
+
notes: zod_1.default.string().nullable().default(null).describe("Internal notes about this item for kitchen or service staff. Not visible to customers.")
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Menu order item schema with IDs (for existing items).
|
|
49
|
+
*/
|
|
50
|
+
exports.MenuOrderItemSchema = exports.MenuOrderItemBaseSchema.safeExtend({
|
|
51
|
+
id: zod_1.default.string().describe("Unique identifier for this menu order item instance."),
|
|
52
|
+
menuOrderId: zod_1.default.string().describe("References parent MenuOrder this item belongs to. Maintains order-item relationship for order management and fulfillment tracking."),
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Menu order schema - for restaurants/food service.
|
|
56
|
+
*
|
|
57
|
+
* @typedef {Object} MenuOrder
|
|
58
|
+
* @property {string} [orderNumber] - Human-readable order number
|
|
59
|
+
* @property {string} type - Order type (dine-in, takeout, delivery)
|
|
60
|
+
* @property {string} status - Current order status
|
|
61
|
+
* @property {Array} items - Items in the order
|
|
62
|
+
* @property {string} customerId - ID of the customer placing the order
|
|
63
|
+
* @property {Object} [customer] - Customer information
|
|
64
|
+
* @property {Object} pricing - Pricing details
|
|
65
|
+
* @property {string} paymentStatus - Payment status
|
|
66
|
+
* @property {string} [paymentMethod] - Payment method used
|
|
67
|
+
* @property {string} [paymentReference] - Payment reference number
|
|
68
|
+
* @property {number} orderDate - Order date as Unix timestamp
|
|
69
|
+
* @property {number} [requestedTime] - Requested pickup/delivery time
|
|
70
|
+
* @property {number} [estimatedReadyTime] - Estimated ready time
|
|
71
|
+
* @property {number} [actualReadyTime] - Actual ready time
|
|
72
|
+
* @property {string} [specialInstructions] - Special instructions
|
|
73
|
+
* @property {string[]} [allergies] - Customer allergies
|
|
74
|
+
* @property {string} [tableNumber] - Table number for dine-in
|
|
75
|
+
* @property {string} [externalOrderId] - External order ID for integrations
|
|
76
|
+
* @property {string} source - Order source
|
|
77
|
+
* @property {string} [cancelReason] - Reason for cancellation
|
|
78
|
+
* @property {string} [notes] - Additional notes
|
|
79
|
+
* @property {string} [serviceConversationConfigId] - Service conversation config ID
|
|
80
|
+
* @property {Object} [deliveryAddress] - Delivery address if applicable
|
|
81
|
+
* @property {number} [tip] - Tip amount for the order
|
|
82
|
+
*/
|
|
83
|
+
exports.MenuOrderSchema = base_schema_1.BaseModelSchema.safeExtend({
|
|
84
|
+
orderNumber: zod_1.default.string().nullable().default(null).describe("Human-readable order number displayed to customers and staff (e.g., '#1234', 'A-42'). Generated by Menu Management for easy reference and communication."),
|
|
85
|
+
type: zod_1.default.enum(type_definitions_1.MenuOrderType).describe("Order fulfillment type: DINE_IN (eat at restaurant), TAKEOUT (customer pickup), or DELIVERY (courier delivery). Determines workflow and address requirements."),
|
|
86
|
+
status: zod_1.default.enum(type_definitions_1.OrderStatus).default(type_definitions_1.OrderStatus.PENDING).describe("Current order status tracking progression from placement to fulfillment. Used by kitchen display systems and customer notifications. Defaults to PENDING."),
|
|
87
|
+
items: zod_1.default.array(exports.MenuOrderItemSchema).min(1, "Order must have at least one item").describe("Menu items in this order with quantities, pricing, and customizations. Minimum one item required for valid order."),
|
|
88
|
+
customerId: zod_1.default.string().describe("References Customer who placed this order. Links to customer profile for order history, preferences, and communication."),
|
|
89
|
+
customer: order_schema_1.OrderCustomerSchema.nullable().default(null).describe("Populated customer information for convenient access. Includes name, contact details, and delivery address from order.schema.ts."),
|
|
90
|
+
pricing: order_schema_1.OrderPricingSchema.describe("Complete pricing breakdown including subtotal, tax, tip, delivery fees, and discounts. From order.schema.ts for consistent pricing across order types."),
|
|
91
|
+
// Payment
|
|
92
|
+
paymentStatus: zod_1.default.enum(type_definitions_1.PaymentStatus).default(type_definitions_1.PaymentStatus.PENDING).describe("Payment processing status. Tracks whether order is paid, pending, failed, or refunded. Defaults to PENDING."),
|
|
93
|
+
paymentMethod: zod_1.default.string().nullable().default(null).describe("Payment method used (e.g., 'credit_card', 'cash', 'digital_wallet'). Captured for accounting and reconciliation."),
|
|
94
|
+
paymentReference: zod_1.default.string().nullable().default(null).describe("External payment system reference or transaction ID. Used for payment verification and dispute resolution."),
|
|
95
|
+
// Restaurant-specific timing
|
|
96
|
+
orderDate: zod_1.default.number().describe("Unix timestamp when order was placed. Used for order history, analytics, and time-based reporting."),
|
|
97
|
+
requestedTime: zod_1.default.number().nullable().default(null).describe("Unix timestamp for customer's requested pickup or delivery time. Used for scheduling kitchen preparation and delivery coordination."),
|
|
98
|
+
estimatedReadyTime: zod_1.default.number().nullable().default(null).describe("Unix timestamp when kitchen estimates order will be ready. Communicated to customers via AI Powered Services and used for pickup/delivery scheduling."),
|
|
99
|
+
actualReadyTime: zod_1.default.number().nullable().default(null).describe("Unix timestamp when order was actually completed and ready. Used for performance tracking and customer communication accuracy."),
|
|
100
|
+
// Restaurant-specific requests
|
|
101
|
+
specialInstructions: zod_1.default.string().nullable().default(null).describe("Order-level special instructions from customer (e.g., 'ring doorbell', 'leave at door', 'call upon arrival'). Applies to entire order vs item-specific instructions."),
|
|
102
|
+
allergies: zod_1.default.array(zod_1.default.string()).nullable().default(null).describe("Customer's allergy information for this order (e.g., ['peanuts', 'shellfish']). Critical for kitchen safety protocols and cross-contamination prevention."),
|
|
103
|
+
tableNumber: zod_1.default.string().nullable().default(null).describe("Table number for DINE_IN orders. Links order to physical location for server delivery and bill management."),
|
|
104
|
+
// Integration
|
|
105
|
+
externalOrderId: zod_1.default.string().nullable().default(null).describe("Order ID from external system (third-party delivery platform, POS system). Enables order synchronization and cross-platform tracking."),
|
|
106
|
+
source: zod_1.default.string().default('direct').describe("Order source channel (e.g., 'direct', 'web', 'phone', 'third_party_platform'). Used for attribution tracking and channel analytics. Defaults to 'direct'."),
|
|
107
|
+
cancelReason: zod_1.default.string().nullable().default(null).describe("Reason provided when order is cancelled. Used for analytics, process improvement, and customer service follow-up."),
|
|
108
|
+
notes: zod_1.default.string().nullable().default(null).describe("Internal operational notes about this order. Not visible to customers; used by staff for coordination and special handling."),
|
|
109
|
+
serviceConversationConfigId: zod_1.default.string().nullable().default(null).describe("References the AI Powered Services conversation configuration that powered this order. Links order to deployment channel and conversation history."),
|
|
110
|
+
deliveryAddress: zod_1.default.object({
|
|
111
|
+
street: zod_1.default.string().describe("Delivery street address for DELIVERY type orders. Primary location for courier navigation."),
|
|
112
|
+
city: zod_1.default.string().nullable().default(null).describe("Delivery city for regional routing and delivery fee calculation."),
|
|
113
|
+
postalCode: zod_1.default.string().nullable().default(null).describe("Delivery postal code for address validation and delivery zone determination."),
|
|
114
|
+
}).nullable().default(null).describe("Delivery address for DELIVERY type orders. Required when type is DELIVERY; unused for DINE_IN or TAKEOUT."),
|
|
115
|
+
tip: zod_1.default.number().nonnegative().nullable().default(null).describe("Tip amount for the order."),
|
|
116
|
+
});
|
|
117
|
+
/**
|
|
118
|
+
* Schema for creating a new menu order.
|
|
119
|
+
* Omits auto-generated fields and uses base items without IDs.
|
|
120
|
+
*/
|
|
121
|
+
exports.CreateMenuOrderSchema = exports.MenuOrderSchema.omit({
|
|
122
|
+
id: true,
|
|
123
|
+
orderNumber: true,
|
|
124
|
+
createdAt: true,
|
|
125
|
+
updatedAt: true,
|
|
126
|
+
actualReadyTime: true,
|
|
127
|
+
items: true,
|
|
128
|
+
cancelReason: true,
|
|
129
|
+
serviceConversationConfigId: true,
|
|
130
|
+
}).safeExtend({
|
|
131
|
+
items: zod_1.default.array(exports.MenuOrderItemBaseSchema).min(1, "Order must have at least one item"),
|
|
132
|
+
cancelReason: zod_1.default.string().nullable().default(null),
|
|
133
|
+
});
|
|
134
|
+
/**
|
|
135
|
+
* Schema for updating an existing menu order.
|
|
136
|
+
* All fields are optional except id.
|
|
137
|
+
*/
|
|
138
|
+
exports.UpdateMenuOrderSchema = exports.CreateMenuOrderSchema.partial().safeExtend({
|
|
139
|
+
id: zod_1.default.string(),
|
|
140
|
+
});
|
|
141
|
+
/**
|
|
142
|
+
* Quick status update schema for menu orders.
|
|
143
|
+
*/
|
|
144
|
+
exports.UpdateMenuOrderStatusSchema = zod_1.default.object({
|
|
145
|
+
id: zod_1.default.string().describe("Unique identifier of the MenuOrder to update status for."),
|
|
146
|
+
status: zod_1.default.enum(type_definitions_1.OrderStatus).describe("New order status to transition to (e.g., from PENDING to PREPARING to READY). Validates against OrderStatus enum for workflow consistency."),
|
|
147
|
+
estimatedReadyTime: zod_1.default.number().nullable().default(null).describe("Updated Unix timestamp for estimated completion. Used when kitchen adjusts timing based on current workload or delays."),
|
|
148
|
+
actualReadyTime: zod_1.default.number().nullable().default(null).describe("Unix timestamp when order was actually completed. Set when status transitions to READY or COMPLETED for performance tracking."),
|
|
149
|
+
});
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { DiscountScope, DiscountType, PricingRuleAdjustmentType, PricingRuleApplyLevel, TaxRateType, TaxScope } from "../type-definitions";
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Shared order schema definitions used across menu and product orders.
|
|
5
|
+
* @module business-mgt/order
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Order address schema.
|
|
9
|
+
* Extends base address with delivery-specific instructions.
|
|
10
|
+
*
|
|
11
|
+
* @typedef {Object} OrderAddress
|
|
12
|
+
* @property {string} [deliveryInstructions] - Special delivery instructions for couriers
|
|
13
|
+
*/
|
|
14
|
+
export declare const OrderAddress: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
street: z.ZodString;
|
|
16
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
17
|
+
city: z.ZodString;
|
|
18
|
+
state: z.ZodString;
|
|
19
|
+
postalCode: z.ZodString;
|
|
20
|
+
country: z.ZodString;
|
|
21
|
+
deliveryInstructions: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
/**
|
|
24
|
+
* Order customer schema.
|
|
25
|
+
* Captures customer information for order identification and communication.
|
|
26
|
+
*
|
|
27
|
+
* @typedef {Object} OrderCustomer
|
|
28
|
+
* @property {string} [customerId] - Customer ID if registered
|
|
29
|
+
* @property {string} name - Customer's full name
|
|
30
|
+
* @property {string} [phone] - Customer's phone number
|
|
31
|
+
* @property {string} [email] - Customer's email address
|
|
32
|
+
* @property {Object} [address] - Customer address for delivery/billing
|
|
33
|
+
*/
|
|
34
|
+
export declare const OrderCustomerSchema: z.ZodObject<{
|
|
35
|
+
customerId: z.ZodOptional<z.ZodString>;
|
|
36
|
+
name: z.ZodString;
|
|
37
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
38
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
39
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
street: z.ZodString;
|
|
41
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
42
|
+
city: z.ZodString;
|
|
43
|
+
state: z.ZodString;
|
|
44
|
+
postalCode: z.ZodString;
|
|
45
|
+
country: z.ZodString;
|
|
46
|
+
deliveryInstructions: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
/**
|
|
50
|
+
* Applied discount schema.
|
|
51
|
+
* Captures a discount applied to an order with calculated amounts.
|
|
52
|
+
*
|
|
53
|
+
* @typedef {Object} AppliedDiscount
|
|
54
|
+
* @property {string} [discountRuleId] - Internal discount rule ID
|
|
55
|
+
* @property {string} [externalDiscountId] - External system discount ID
|
|
56
|
+
* @property {string} name - Discount display name
|
|
57
|
+
* @property {string} [code] - Discount code if applicable
|
|
58
|
+
* @property {DiscountScope} scope - Discount scope (order, item, category)
|
|
59
|
+
* @property {DiscountType} type - Discount type (percentage, fixed)
|
|
60
|
+
* @property {number} value - Discount value
|
|
61
|
+
* @property {number} discountableAmount - Amount eligible for discount
|
|
62
|
+
* @property {number} discountAmount - Calculated discount amount
|
|
63
|
+
* @property {boolean} isStacked - Whether this discount was stacked
|
|
64
|
+
*/
|
|
65
|
+
export declare const AppliedDiscountSchema: z.ZodObject<{
|
|
66
|
+
discountRuleId: z.ZodOptional<z.ZodString>;
|
|
67
|
+
externalDiscountId: z.ZodOptional<z.ZodString>;
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
code: z.ZodOptional<z.ZodString>;
|
|
70
|
+
scope: z.ZodDefault<z.ZodEnum<typeof DiscountScope>>;
|
|
71
|
+
type: z.ZodEnum<typeof DiscountType>;
|
|
72
|
+
value: z.ZodNumber;
|
|
73
|
+
discountableAmount: z.ZodNumber;
|
|
74
|
+
discountAmount: z.ZodNumber;
|
|
75
|
+
isStacked: z.ZodDefault<z.ZodBoolean>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export type AppliedDiscount = z.infer<typeof AppliedDiscountSchema>;
|
|
78
|
+
/**
|
|
79
|
+
* Applied pricing rule schema.
|
|
80
|
+
* Captures a pricing rule applied to an order with calculated adjustments.
|
|
81
|
+
*
|
|
82
|
+
* @typedef {Object} AppliedPricingRule
|
|
83
|
+
* @property {string} [pricingRuleId] - Internal pricing rule ID
|
|
84
|
+
* @property {string} [externalPricingRuleId] - External system pricing rule ID
|
|
85
|
+
* @property {string} name - Pricing rule display name
|
|
86
|
+
* @property {PricingRuleApplyLevel} applyLevel - Level at which rule was applied
|
|
87
|
+
* @property {PricingRuleAdjustmentType} adjustmentType - Type of price adjustment
|
|
88
|
+
* @property {number} adjustmentValue - Adjustment value
|
|
89
|
+
* @property {number} baseAmount - Original amount before adjustment
|
|
90
|
+
* @property {number} adjustedAmount - Amount after adjustment
|
|
91
|
+
* @property {number} deltaAmount - Difference (can be negative)
|
|
92
|
+
* @property {number} [appliedAt] - Timestamp when rule was applied
|
|
93
|
+
*/
|
|
94
|
+
export declare const AppliedPricingRuleSchema: z.ZodObject<{
|
|
95
|
+
pricingRuleId: z.ZodOptional<z.ZodString>;
|
|
96
|
+
externalPricingRuleId: z.ZodOptional<z.ZodString>;
|
|
97
|
+
name: z.ZodString;
|
|
98
|
+
applyLevel: z.ZodDefault<z.ZodEnum<typeof PricingRuleApplyLevel>>;
|
|
99
|
+
adjustmentType: z.ZodEnum<typeof PricingRuleAdjustmentType>;
|
|
100
|
+
adjustmentValue: z.ZodNumber;
|
|
101
|
+
baseAmount: z.ZodNumber;
|
|
102
|
+
adjustedAmount: z.ZodNumber;
|
|
103
|
+
deltaAmount: z.ZodNumber;
|
|
104
|
+
appliedAt: z.ZodOptional<z.ZodNumber>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
export type AppliedPricingRule = z.infer<typeof AppliedPricingRuleSchema>;
|
|
107
|
+
/**
|
|
108
|
+
* Applied tax schema.
|
|
109
|
+
* Captures a tax applied to an order with calculated amounts.
|
|
110
|
+
*
|
|
111
|
+
* @typedef {Object} AppliedTax
|
|
112
|
+
* @property {string} [taxRuleId] - Internal tax rule ID
|
|
113
|
+
* @property {string} [externalTaxId] - External system tax ID
|
|
114
|
+
* @property {string} name - Tax display name
|
|
115
|
+
* @property {TaxScope} scope - Tax scope (order, item, category)
|
|
116
|
+
* @property {TaxRateType} rateType - Tax rate type (percentage, fixed)
|
|
117
|
+
* @property {number} rateValue - Tax rate value
|
|
118
|
+
* @property {number} taxableAmount - Amount subject to tax
|
|
119
|
+
* @property {number} taxAmount - Calculated tax amount
|
|
120
|
+
* @property {boolean} isInclusive - Whether tax is included in prices
|
|
121
|
+
*/
|
|
122
|
+
export declare const AppliedTaxSchema: z.ZodObject<{
|
|
123
|
+
taxRuleId: z.ZodOptional<z.ZodString>;
|
|
124
|
+
externalTaxId: z.ZodOptional<z.ZodString>;
|
|
125
|
+
name: z.ZodString;
|
|
126
|
+
scope: z.ZodDefault<z.ZodEnum<typeof TaxScope>>;
|
|
127
|
+
rateType: z.ZodEnum<typeof TaxRateType>;
|
|
128
|
+
rateValue: z.ZodNumber;
|
|
129
|
+
taxableAmount: z.ZodNumber;
|
|
130
|
+
taxAmount: z.ZodNumber;
|
|
131
|
+
isInclusive: z.ZodDefault<z.ZodBoolean>;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
export type AppliedTax = z.infer<typeof AppliedTaxSchema>;
|
|
134
|
+
/**
|
|
135
|
+
* Order pricing schema.
|
|
136
|
+
* Comprehensive pricing breakdown including subtotals, discounts, taxes, and fees.
|
|
137
|
+
*
|
|
138
|
+
* @typedef {Object} OrderPricing
|
|
139
|
+
* @property {number} subtotal - Subtotal before tax and fees
|
|
140
|
+
* @property {number} tax - Tax amount
|
|
141
|
+
* @property {number} tip - Tip/gratuity amount
|
|
142
|
+
* @property {number} shippingAmount - Shipping amount if applicable
|
|
143
|
+
* @property {number} discount - Discount amount applied
|
|
144
|
+
* @property {number} total - Final total amount
|
|
145
|
+
* @property {string} currency - Currency code (ISO 4217 format)
|
|
146
|
+
*/
|
|
147
|
+
export declare const OrderPricingSchema: z.ZodObject<{
|
|
148
|
+
subtotalBeforeTax: z.ZodOptional<z.ZodNumber>;
|
|
149
|
+
subtotal: z.ZodNumber;
|
|
150
|
+
appliedPricingRules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
151
|
+
pricingRuleId: z.ZodOptional<z.ZodString>;
|
|
152
|
+
externalPricingRuleId: z.ZodOptional<z.ZodString>;
|
|
153
|
+
name: z.ZodString;
|
|
154
|
+
applyLevel: z.ZodDefault<z.ZodEnum<typeof PricingRuleApplyLevel>>;
|
|
155
|
+
adjustmentType: z.ZodEnum<typeof PricingRuleAdjustmentType>;
|
|
156
|
+
adjustmentValue: z.ZodNumber;
|
|
157
|
+
baseAmount: z.ZodNumber;
|
|
158
|
+
adjustedAmount: z.ZodNumber;
|
|
159
|
+
deltaAmount: z.ZodNumber;
|
|
160
|
+
appliedAt: z.ZodOptional<z.ZodNumber>;
|
|
161
|
+
}, z.core.$strip>>>;
|
|
162
|
+
totalPricingAdjustmentAmount: z.ZodDefault<z.ZodNumber>;
|
|
163
|
+
subtotalAfterPricingRules: z.ZodOptional<z.ZodNumber>;
|
|
164
|
+
appliedDiscounts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
165
|
+
discountRuleId: z.ZodOptional<z.ZodString>;
|
|
166
|
+
externalDiscountId: z.ZodOptional<z.ZodString>;
|
|
167
|
+
name: z.ZodString;
|
|
168
|
+
code: z.ZodOptional<z.ZodString>;
|
|
169
|
+
scope: z.ZodDefault<z.ZodEnum<typeof DiscountScope>>;
|
|
170
|
+
type: z.ZodEnum<typeof DiscountType>;
|
|
171
|
+
value: z.ZodNumber;
|
|
172
|
+
discountableAmount: z.ZodNumber;
|
|
173
|
+
discountAmount: z.ZodNumber;
|
|
174
|
+
isStacked: z.ZodDefault<z.ZodBoolean>;
|
|
175
|
+
}, z.core.$strip>>>;
|
|
176
|
+
totalDiscountAmount: z.ZodDefault<z.ZodNumber>;
|
|
177
|
+
subtotalAfterDiscount: z.ZodOptional<z.ZodNumber>;
|
|
178
|
+
appliedTaxes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
179
|
+
taxRuleId: z.ZodOptional<z.ZodString>;
|
|
180
|
+
externalTaxId: z.ZodOptional<z.ZodString>;
|
|
181
|
+
name: z.ZodString;
|
|
182
|
+
scope: z.ZodDefault<z.ZodEnum<typeof TaxScope>>;
|
|
183
|
+
rateType: z.ZodEnum<typeof TaxRateType>;
|
|
184
|
+
rateValue: z.ZodNumber;
|
|
185
|
+
taxableAmount: z.ZodNumber;
|
|
186
|
+
taxAmount: z.ZodNumber;
|
|
187
|
+
isInclusive: z.ZodDefault<z.ZodBoolean>;
|
|
188
|
+
}, z.core.$strip>>>;
|
|
189
|
+
totalTaxAmount: z.ZodDefault<z.ZodNumber>;
|
|
190
|
+
tax: z.ZodDefault<z.ZodNumber>;
|
|
191
|
+
tip: z.ZodDefault<z.ZodNumber>;
|
|
192
|
+
shippingAmount: z.ZodDefault<z.ZodNumber>;
|
|
193
|
+
discount: z.ZodDefault<z.ZodNumber>;
|
|
194
|
+
subtotalAfterTax: z.ZodOptional<z.ZodNumber>;
|
|
195
|
+
total: z.ZodNumber;
|
|
196
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
export type OrderCustomer = z.infer<typeof OrderCustomerSchema>;
|
|
199
|
+
export type OrderPricing = z.infer<typeof OrderPricingSchema>;
|
|
200
|
+
export type OrderAddress = z.infer<typeof OrderAddress>;
|
|
201
|
+
/**
|
|
202
|
+
* Menu item daypart schema.
|
|
203
|
+
* Defines time-based availability windows for menu items.
|
|
204
|
+
*
|
|
205
|
+
* @typedef {Object} MenuItemDaypart
|
|
206
|
+
* @property {string} name - Daypart name (e.g., Breakfast, Lunch)
|
|
207
|
+
* @property {string} startTime - Daypart start time in HH:MM format
|
|
208
|
+
* @property {string} endTime - Daypart end time in HH:MM format
|
|
209
|
+
* @property {string[]} [daysOfWeek] - Optional active days (0-6, Sunday=0)
|
|
210
|
+
*/
|
|
211
|
+
export declare const MenuItemDaypartSchema: z.ZodObject<{
|
|
212
|
+
name: z.ZodString;
|
|
213
|
+
startTime: z.ZodString;
|
|
214
|
+
endTime: z.ZodString;
|
|
215
|
+
daysOfWeek: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
216
|
+
}, z.core.$strip>;
|
|
217
|
+
/**
|
|
218
|
+
* Default menu item dayparts.
|
|
219
|
+
* Standard time windows for meal periods.
|
|
220
|
+
*/
|
|
221
|
+
export declare const DEFAULT_MENU_ITEM_DAYPARTS: z.infer<typeof MenuItemDaypartSchema>[];
|
|
222
|
+
export type MenuItemDaypart = z.infer<typeof MenuItemDaypartSchema>;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DEFAULT_MENU_ITEM_DAYPARTS = exports.MenuItemDaypartSchema = exports.OrderPricingSchema = exports.AppliedTaxSchema = exports.AppliedPricingRuleSchema = exports.AppliedDiscountSchema = exports.OrderCustomerSchema = exports.OrderAddress = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const base_schema_1 = require("../base.schema");
|
|
9
|
+
const type_definitions_1 = require("../type-definitions");
|
|
10
|
+
/**
|
|
11
|
+
* @fileoverview Shared order schema definitions used across menu and product orders.
|
|
12
|
+
* @module business-mgt/order
|
|
13
|
+
*/
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// ADDRESS SCHEMA
|
|
16
|
+
// ============================================================================
|
|
17
|
+
/**
|
|
18
|
+
* Order address schema.
|
|
19
|
+
* Extends base address with delivery-specific instructions.
|
|
20
|
+
*
|
|
21
|
+
* @typedef {Object} OrderAddress
|
|
22
|
+
* @property {string} [deliveryInstructions] - Special delivery instructions for couriers
|
|
23
|
+
*/
|
|
24
|
+
exports.OrderAddress = base_schema_1.AddressSchema.safeExtend({
|
|
25
|
+
deliveryInstructions: zod_1.default.string().optional().describe("Special delivery instructions (gate code, building entrance, drop-off location) for couriers and delivery personnel.")
|
|
26
|
+
}).optional();
|
|
27
|
+
// ============================================================================
|
|
28
|
+
// ORDER CUSTOMER SCHEMA
|
|
29
|
+
// ============================================================================
|
|
30
|
+
/**
|
|
31
|
+
* Order customer schema.
|
|
32
|
+
* Captures customer information for order identification and communication.
|
|
33
|
+
*
|
|
34
|
+
* @typedef {Object} OrderCustomer
|
|
35
|
+
* @property {string} [customerId] - Customer ID if registered
|
|
36
|
+
* @property {string} name - Customer's full name
|
|
37
|
+
* @property {string} [phone] - Customer's phone number
|
|
38
|
+
* @property {string} [email] - Customer's email address
|
|
39
|
+
* @property {Object} [address] - Customer address for delivery/billing
|
|
40
|
+
*/
|
|
41
|
+
exports.OrderCustomerSchema = zod_1.default.object({
|
|
42
|
+
customerId: zod_1.default.string().optional().describe("References Customer ID if customer is registered in the system. Used to link order history, preferences, and loyalty data."),
|
|
43
|
+
name: zod_1.default.string().min(1, "Customer name is required").describe("Customer's full name for order identification, receipts, and communication. Required for all orders."),
|
|
44
|
+
phone: zod_1.default.string().optional().describe("Customer's contact phone for order updates, delivery coordination, and support. Used by AI Powered Services for SMS notifications."),
|
|
45
|
+
email: zod_1.default.email().optional().describe("Customer's email for digital receipts, order confirmations, and AI-generated order summaries."),
|
|
46
|
+
address: exports.OrderAddress.describe("Customer address for delivery (menu/product orders) or billing purposes. Extended with delivery-specific instructions.")
|
|
47
|
+
});
|
|
48
|
+
// ============================================================================
|
|
49
|
+
// APPLIED DISCOUNT SCHEMA
|
|
50
|
+
// ============================================================================
|
|
51
|
+
/**
|
|
52
|
+
* Applied discount schema.
|
|
53
|
+
* Captures a discount applied to an order with calculated amounts.
|
|
54
|
+
*
|
|
55
|
+
* @typedef {Object} AppliedDiscount
|
|
56
|
+
* @property {string} [discountRuleId] - Internal discount rule ID
|
|
57
|
+
* @property {string} [externalDiscountId] - External system discount ID
|
|
58
|
+
* @property {string} name - Discount display name
|
|
59
|
+
* @property {string} [code] - Discount code if applicable
|
|
60
|
+
* @property {DiscountScope} scope - Discount scope (order, item, category)
|
|
61
|
+
* @property {DiscountType} type - Discount type (percentage, fixed)
|
|
62
|
+
* @property {number} value - Discount value
|
|
63
|
+
* @property {number} discountableAmount - Amount eligible for discount
|
|
64
|
+
* @property {number} discountAmount - Calculated discount amount
|
|
65
|
+
* @property {boolean} isStacked - Whether this discount was stacked
|
|
66
|
+
*/
|
|
67
|
+
exports.AppliedDiscountSchema = zod_1.default.object({
|
|
68
|
+
discountRuleId: zod_1.default.string().optional(),
|
|
69
|
+
externalDiscountId: zod_1.default.string().optional(),
|
|
70
|
+
name: zod_1.default.string().min(1),
|
|
71
|
+
code: zod_1.default.string().optional(),
|
|
72
|
+
scope: zod_1.default.enum(type_definitions_1.DiscountScope).default(type_definitions_1.DiscountScope.ORDER),
|
|
73
|
+
type: zod_1.default.enum(type_definitions_1.DiscountType),
|
|
74
|
+
value: zod_1.default.number().nonnegative(),
|
|
75
|
+
discountableAmount: zod_1.default.number().nonnegative(),
|
|
76
|
+
discountAmount: zod_1.default.number().nonnegative(),
|
|
77
|
+
isStacked: zod_1.default.boolean().default(false),
|
|
78
|
+
});
|
|
79
|
+
// ============================================================================
|
|
80
|
+
// APPLIED PRICING RULE SCHEMA
|
|
81
|
+
// ============================================================================
|
|
82
|
+
/**
|
|
83
|
+
* Applied pricing rule schema.
|
|
84
|
+
* Captures a pricing rule applied to an order with calculated adjustments.
|
|
85
|
+
*
|
|
86
|
+
* @typedef {Object} AppliedPricingRule
|
|
87
|
+
* @property {string} [pricingRuleId] - Internal pricing rule ID
|
|
88
|
+
* @property {string} [externalPricingRuleId] - External system pricing rule ID
|
|
89
|
+
* @property {string} name - Pricing rule display name
|
|
90
|
+
* @property {PricingRuleApplyLevel} applyLevel - Level at which rule was applied
|
|
91
|
+
* @property {PricingRuleAdjustmentType} adjustmentType - Type of price adjustment
|
|
92
|
+
* @property {number} adjustmentValue - Adjustment value
|
|
93
|
+
* @property {number} baseAmount - Original amount before adjustment
|
|
94
|
+
* @property {number} adjustedAmount - Amount after adjustment
|
|
95
|
+
* @property {number} deltaAmount - Difference (can be negative)
|
|
96
|
+
* @property {number} [appliedAt] - Timestamp when rule was applied
|
|
97
|
+
*/
|
|
98
|
+
exports.AppliedPricingRuleSchema = zod_1.default.object({
|
|
99
|
+
pricingRuleId: zod_1.default.string().optional(),
|
|
100
|
+
externalPricingRuleId: zod_1.default.string().optional(),
|
|
101
|
+
name: zod_1.default.string().min(1),
|
|
102
|
+
applyLevel: zod_1.default.enum(type_definitions_1.PricingRuleApplyLevel).default(type_definitions_1.PricingRuleApplyLevel.ORDER),
|
|
103
|
+
adjustmentType: zod_1.default.enum(type_definitions_1.PricingRuleAdjustmentType),
|
|
104
|
+
adjustmentValue: zod_1.default.number().nonnegative(),
|
|
105
|
+
baseAmount: zod_1.default.number().nonnegative(),
|
|
106
|
+
adjustedAmount: zod_1.default.number().nonnegative(),
|
|
107
|
+
deltaAmount: zod_1.default.number(),
|
|
108
|
+
appliedAt: zod_1.default.number().int().nonnegative().optional(),
|
|
109
|
+
});
|
|
110
|
+
// ============================================================================
|
|
111
|
+
// APPLIED TAX SCHEMA
|
|
112
|
+
// ============================================================================
|
|
113
|
+
/**
|
|
114
|
+
* Applied tax schema.
|
|
115
|
+
* Captures a tax applied to an order with calculated amounts.
|
|
116
|
+
*
|
|
117
|
+
* @typedef {Object} AppliedTax
|
|
118
|
+
* @property {string} [taxRuleId] - Internal tax rule ID
|
|
119
|
+
* @property {string} [externalTaxId] - External system tax ID
|
|
120
|
+
* @property {string} name - Tax display name
|
|
121
|
+
* @property {TaxScope} scope - Tax scope (order, item, category)
|
|
122
|
+
* @property {TaxRateType} rateType - Tax rate type (percentage, fixed)
|
|
123
|
+
* @property {number} rateValue - Tax rate value
|
|
124
|
+
* @property {number} taxableAmount - Amount subject to tax
|
|
125
|
+
* @property {number} taxAmount - Calculated tax amount
|
|
126
|
+
* @property {boolean} isInclusive - Whether tax is included in prices
|
|
127
|
+
*/
|
|
128
|
+
exports.AppliedTaxSchema = zod_1.default.object({
|
|
129
|
+
taxRuleId: zod_1.default.string().optional(),
|
|
130
|
+
externalTaxId: zod_1.default.string().optional(),
|
|
131
|
+
name: zod_1.default.string().min(1),
|
|
132
|
+
scope: zod_1.default.enum(type_definitions_1.TaxScope).default(type_definitions_1.TaxScope.ORDER),
|
|
133
|
+
rateType: zod_1.default.enum(type_definitions_1.TaxRateType),
|
|
134
|
+
rateValue: zod_1.default.number().nonnegative(),
|
|
135
|
+
taxableAmount: zod_1.default.number().nonnegative(),
|
|
136
|
+
taxAmount: zod_1.default.number().nonnegative(),
|
|
137
|
+
isInclusive: zod_1.default.boolean().default(false),
|
|
138
|
+
});
|
|
139
|
+
// ============================================================================
|
|
140
|
+
// ORDER PRICING SCHEMA
|
|
141
|
+
// ============================================================================
|
|
142
|
+
/**
|
|
143
|
+
* Order pricing schema.
|
|
144
|
+
* Comprehensive pricing breakdown including subtotals, discounts, taxes, and fees.
|
|
145
|
+
*
|
|
146
|
+
* @typedef {Object} OrderPricing
|
|
147
|
+
* @property {number} subtotal - Subtotal before tax and fees
|
|
148
|
+
* @property {number} tax - Tax amount
|
|
149
|
+
* @property {number} tip - Tip/gratuity amount
|
|
150
|
+
* @property {number} shippingAmount - Shipping amount if applicable
|
|
151
|
+
* @property {number} discount - Discount amount applied
|
|
152
|
+
* @property {number} total - Final total amount
|
|
153
|
+
* @property {string} currency - Currency code (ISO 4217 format)
|
|
154
|
+
*/
|
|
155
|
+
exports.OrderPricingSchema = zod_1.default.object({
|
|
156
|
+
subtotalBeforeTax: zod_1.default.number().nonnegative().optional().describe("Subtotal before tax"),
|
|
157
|
+
subtotal: zod_1.default.number().nonnegative().describe("Subtotal before tax and fees"),
|
|
158
|
+
appliedPricingRules: zod_1.default.array(exports.AppliedPricingRuleSchema).default([]).describe("Detailed applied pricing rule breakdown"),
|
|
159
|
+
totalPricingAdjustmentAmount: zod_1.default.number().default(0).describe("Net adjustment amount from appliedPricingRules"),
|
|
160
|
+
subtotalAfterPricingRules: zod_1.default.number().nonnegative().optional().describe("Subtotal after pricing rules and before discounts"),
|
|
161
|
+
appliedDiscounts: zod_1.default.array(exports.AppliedDiscountSchema).default([]).describe("Detailed applied discount breakdown"),
|
|
162
|
+
totalDiscountAmount: zod_1.default.number().nonnegative().default(0).describe("Total discount amount from appliedDiscounts"),
|
|
163
|
+
subtotalAfterDiscount: zod_1.default.number().nonnegative().optional().describe("Subtotal after discounts and before tax"),
|
|
164
|
+
appliedTaxes: zod_1.default.array(exports.AppliedTaxSchema).default([]).describe("Detailed applied tax breakdown"),
|
|
165
|
+
totalTaxAmount: zod_1.default.number().nonnegative().default(0).describe("Total tax amount from appliedTaxes"),
|
|
166
|
+
tax: zod_1.default.number().nonnegative().default(0).describe("Tax amount"),
|
|
167
|
+
tip: zod_1.default.number().nonnegative().default(0).describe("Tip/gratuity amount"),
|
|
168
|
+
shippingAmount: zod_1.default.number().nonnegative().default(0).describe("Shipping amount if applicable"),
|
|
169
|
+
discount: zod_1.default.number().nonnegative().default(0).describe("Discount amount applied"),
|
|
170
|
+
subtotalAfterTax: zod_1.default.number().nonnegative().optional().describe("Subtotal after tax and before tips/shipping"),
|
|
171
|
+
total: zod_1.default.number().nonnegative().describe("Final total amount"),
|
|
172
|
+
currency: zod_1.default.string().length(3).default("USD").describe("Currency code (ISO 4217 format)")
|
|
173
|
+
});
|
|
174
|
+
// ============================================================================
|
|
175
|
+
// MENU ITEM DAYPART SCHEMA
|
|
176
|
+
// ============================================================================
|
|
177
|
+
/**
|
|
178
|
+
* Menu item daypart schema.
|
|
179
|
+
* Defines time-based availability windows for menu items.
|
|
180
|
+
*
|
|
181
|
+
* @typedef {Object} MenuItemDaypart
|
|
182
|
+
* @property {string} name - Daypart name (e.g., Breakfast, Lunch)
|
|
183
|
+
* @property {string} startTime - Daypart start time in HH:MM format
|
|
184
|
+
* @property {string} endTime - Daypart end time in HH:MM format
|
|
185
|
+
* @property {string[]} [daysOfWeek] - Optional active days (0-6, Sunday=0)
|
|
186
|
+
*/
|
|
187
|
+
exports.MenuItemDaypartSchema = zod_1.default.object({
|
|
188
|
+
name: zod_1.default.string().min(1).describe("Daypart name (e.g., Breakfast, Lunch)"),
|
|
189
|
+
startTime: zod_1.default.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/, "Invalid time format (HH:MM)").describe("Daypart start time in HH:MM format"),
|
|
190
|
+
endTime: zod_1.default.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/, "Invalid time format (HH:MM)").describe("Daypart end time in HH:MM format"),
|
|
191
|
+
daysOfWeek: zod_1.default.array(zod_1.default.string().regex(/^[0-6]$/, "Day must be 0-6")).optional().describe("Optional active days where 0 = Sunday and 6 = Saturday"),
|
|
192
|
+
});
|
|
193
|
+
// ============================================================================
|
|
194
|
+
// DEFAULT DAYPARTS
|
|
195
|
+
// ============================================================================
|
|
196
|
+
/**
|
|
197
|
+
* Default menu item dayparts.
|
|
198
|
+
* Standard time windows for meal periods.
|
|
199
|
+
*/
|
|
200
|
+
exports.DEFAULT_MENU_ITEM_DAYPARTS = [
|
|
201
|
+
{ name: "Breakfast", startTime: "06:00", endTime: "11:00" },
|
|
202
|
+
{ name: "Lunch", startTime: "11:00", endTime: "16:00" },
|
|
203
|
+
{ name: "Dinner", startTime: "16:00", endTime: "22:00" },
|
|
204
|
+
{ name: "Happy hour", startTime: "15:00", endTime: "18:00" },
|
|
205
|
+
];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PricingChannel, PricingRuleAdjustmentType, PricingRuleApplyLevel } from "../type-definitions";
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Shared pricing rule schema definitions used across menu and product pricing.
|
|
5
|
+
* @module business-mgt/pricing-rule-shared
|
|
6
|
+
*/
|
|
7
|
+
export { PricingChannel, PricingRuleAdjustmentType, PricingRuleApplyLevel };
|
|
8
|
+
/**
|
|
9
|
+
* Pricing rule channel mapping schema.
|
|
10
|
+
* Maps pricing rules to external platform pricing rule IDs.
|
|
11
|
+
*
|
|
12
|
+
* @typedef {Object} PricingRuleChannelMapping
|
|
13
|
+
* @property {string} channelId - Channel identifier
|
|
14
|
+
* @property {string} externalPricingRuleId - External pricing rule ID
|
|
15
|
+
*/
|
|
16
|
+
export declare const PricingRuleChannelMappingSchema: z.ZodObject<{
|
|
17
|
+
channelId: z.ZodString;
|
|
18
|
+
externalPricingRuleId: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export type PricingRuleChannelMapping = z.infer<typeof PricingRuleChannelMappingSchema>;
|
|
21
|
+
/**
|
|
22
|
+
* Pricing rule common condition schema.
|
|
23
|
+
* Defines when a pricing rule should be applied based on time, day, customer, and channel.
|
|
24
|
+
*
|
|
25
|
+
* @typedef {Object} PricingRuleCommonCondition
|
|
26
|
+
* @property {number[]} daysOfWeek - Days of week (0-6, Sunday=0)
|
|
27
|
+
* @property {number} [startMinute] - Start minute of day (0-1439)
|
|
28
|
+
* @property {number} [endMinute] - End minute of day (0-1439)
|
|
29
|
+
* @property {string[]} [customerSegmentIds] - Target customer segment IDs
|
|
30
|
+
* @property {PricingChannel} channel - Channel scope for the rule
|
|
31
|
+
*/
|
|
32
|
+
export declare const PricingRuleCommonConditionSchema: z.ZodObject<{
|
|
33
|
+
daysOfWeek: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
34
|
+
startMinute: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
endMinute: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
customerSegmentIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
37
|
+
channel: z.ZodDefault<z.ZodEnum<typeof PricingChannel>>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
/**
|
|
40
|
+
* Pricing rule action schema.
|
|
41
|
+
* Defines the price adjustment to apply when rule conditions are met.
|
|
42
|
+
*
|
|
43
|
+
* @typedef {Object} PricingRuleAction
|
|
44
|
+
* @property {PricingRuleAdjustmentType} adjustmentType - Type of price adjustment
|
|
45
|
+
* @property {number} adjustmentValue - Adjustment value (percentage or fixed amount)
|
|
46
|
+
* @property {string} currency - Currency code for fixed adjustments
|
|
47
|
+
* @property {number} [maxAdjustmentAmount] - Maximum adjustment cap
|
|
48
|
+
*/
|
|
49
|
+
export declare const PricingRuleActionSchema: z.ZodObject<{
|
|
50
|
+
adjustmentType: z.ZodEnum<typeof PricingRuleAdjustmentType>;
|
|
51
|
+
adjustmentValue: z.ZodNumber;
|
|
52
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
53
|
+
maxAdjustmentAmount: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export type PricingRuleCommonCondition = z.infer<typeof PricingRuleCommonConditionSchema>;
|
|
56
|
+
export type PricingRuleAction = z.infer<typeof PricingRuleActionSchema>;
|