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,327 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Business Location schema definitions.
|
|
4
|
+
* @module business-mgt/business-location
|
|
5
|
+
*
|
|
6
|
+
* A Business Location is a physical or operational site belonging to an
|
|
7
|
+
* organization. It carries contact details, operating hours, geographic
|
|
8
|
+
* coordinates, and lifecycle status, and is referenced by downstream
|
|
9
|
+
* business-management resources.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Business location lifecycle status.
|
|
13
|
+
*
|
|
14
|
+
* Single source of truth for whether a location is operational. Replaces any
|
|
15
|
+
* separate boolean active flag.
|
|
16
|
+
*
|
|
17
|
+
* @enum {string}
|
|
18
|
+
*/
|
|
19
|
+
export declare enum BusinessLocationStatus {
|
|
20
|
+
/** Location is operational and available for use */
|
|
21
|
+
ACTIVE = "ACTIVE",
|
|
22
|
+
/** Location is not currently operational */
|
|
23
|
+
INACTIVE = "INACTIVE"
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Zod schema for geographic coordinates.
|
|
27
|
+
*
|
|
28
|
+
* Represents a single point on the Earth's surface in decimal degrees, used to
|
|
29
|
+
* place a business location on a map and to support proximity and bounding-box
|
|
30
|
+
* queries.
|
|
31
|
+
*
|
|
32
|
+
* @typedef {Object} GeoCoordinates
|
|
33
|
+
* @property {number} latitude - Latitude in decimal degrees, constrained to [-90, 90]
|
|
34
|
+
* @property {number} longitude - Longitude in decimal degrees, constrained to [-180, 180]
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const coordinates: GeoCoordinates = {
|
|
39
|
+
* latitude: 39.7817,
|
|
40
|
+
* longitude: -89.6501,
|
|
41
|
+
* };
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare const GeoCoordinatesSchema: z.ZodObject<{
|
|
45
|
+
latitude: z.ZodNumber;
|
|
46
|
+
longitude: z.ZodNumber;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
/**
|
|
49
|
+
* Zod schema for Business Location validation.
|
|
50
|
+
*
|
|
51
|
+
* A Business Location is a physical or operational site belonging to an organization.
|
|
52
|
+
* It captures the operating context for that site — contact details, weekly operating
|
|
53
|
+
* hours, mailing address, geographic coordinates, and lifecycle status — and is
|
|
54
|
+
* referenced by downstream business-management resources.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* **Architecture Context:**
|
|
58
|
+
* - **Extends**: {@link BaseModelSchema} (inherits `id`, `createdAt`, `updatedAt`)
|
|
59
|
+
* - **Composes**: {@link AddressSchema} (mailing address), {@link WeeklyScheduleSchema}
|
|
60
|
+
* (operating hours), {@link GeoCoordinatesSchema} (map placement)
|
|
61
|
+
* - **Lifecycle**: Governed by {@link BusinessLocationStatus}; `status` is the single
|
|
62
|
+
* source of truth for active state (there is no separate `isActive` flag)
|
|
63
|
+
*
|
|
64
|
+
* **Field Notes:**
|
|
65
|
+
* - `businessHours` is required — every location must declare a weekly schedule
|
|
66
|
+
* - Geographic filters require `coordinates` to be populated in order to match
|
|
67
|
+
* - `externalLocationId` links the record to an external system when synced or imported
|
|
68
|
+
*
|
|
69
|
+
* @typedef {Object} BusinessLocationProperties
|
|
70
|
+
* @property {string} id - Unique identifier for the location (inherited from base model)
|
|
71
|
+
* @property {number} [createdAt] - Unix timestamp (milliseconds) when created (inherited)
|
|
72
|
+
* @property {number} [updatedAt] - Unix timestamp (milliseconds) when last updated (inherited)
|
|
73
|
+
* @property {string} name - Human-readable location name (e.g., 'Downtown Branch')
|
|
74
|
+
* @property {string} [code] - Short internal code used to reference the location
|
|
75
|
+
* @property {string|null} [externalLocationId] - Identifier in an external system, if synced or imported
|
|
76
|
+
* @property {BusinessLocationStatus} status - Lifecycle status (default: ACTIVE)
|
|
77
|
+
* @property {boolean} isPrimary - Whether this is the organization's primary location (default: false)
|
|
78
|
+
* @property {string} [timezone] - IANA timezone identifier (e.g., 'America/New_York')
|
|
79
|
+
* @property {WeeklySchedule} businessHours - Weekly operating hours for the location
|
|
80
|
+
* @property {string} [phoneNumber] - Primary contact phone number
|
|
81
|
+
* @property {string} [email] - Primary contact email
|
|
82
|
+
* @property {Address} [address] - Physical mailing address
|
|
83
|
+
* @property {GeoCoordinates|null} [coordinates] - Geographic coordinates of the location
|
|
84
|
+
* @property {Record<string, any>} [metadata] - Additional metadata for organization, tagging, and filtering
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const location: BusinessLocation = {
|
|
89
|
+
* id: 'loc_downtown',
|
|
90
|
+
* name: 'Downtown Branch',
|
|
91
|
+
* code: 'DTWN',
|
|
92
|
+
* status: BusinessLocationStatus.ACTIVE,
|
|
93
|
+
* isPrimary: true,
|
|
94
|
+
* timezone: 'America/New_York',
|
|
95
|
+
* businessHours: {
|
|
96
|
+
* '1': { isOpen: true, startTime: '09:00', endTime: '17:00' },
|
|
97
|
+
* },
|
|
98
|
+
* phoneNumber: '+15551234567',
|
|
99
|
+
* email: 'downtown@example.com',
|
|
100
|
+
* coordinates: { latitude: 39.7817, longitude: -89.6501 },
|
|
101
|
+
* createdAt: Date.now(),
|
|
102
|
+
* updatedAt: Date.now(),
|
|
103
|
+
* };
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export declare const BusinessLocationSchema: z.ZodObject<{
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
createdAt: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
110
|
+
name: z.ZodString;
|
|
111
|
+
code: z.ZodOptional<z.ZodString>;
|
|
112
|
+
externalLocationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
113
|
+
status: z.ZodDefault<z.ZodEnum<typeof BusinessLocationStatus>>;
|
|
114
|
+
isPrimary: z.ZodDefault<z.ZodBoolean>;
|
|
115
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
116
|
+
businessHours: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
117
|
+
isOpen: z.ZodBoolean;
|
|
118
|
+
startTime: z.ZodString;
|
|
119
|
+
endTime: z.ZodString;
|
|
120
|
+
breakTimes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
121
|
+
start: z.ZodString;
|
|
122
|
+
end: z.ZodString;
|
|
123
|
+
}, z.core.$strip>>>;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
126
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
127
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
128
|
+
street: z.ZodString;
|
|
129
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
130
|
+
city: z.ZodString;
|
|
131
|
+
state: z.ZodString;
|
|
132
|
+
postalCode: z.ZodString;
|
|
133
|
+
country: z.ZodString;
|
|
134
|
+
}, z.core.$strip>>;
|
|
135
|
+
coordinates: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
136
|
+
latitude: z.ZodNumber;
|
|
137
|
+
longitude: z.ZodNumber;
|
|
138
|
+
}, z.core.$strip>>>;
|
|
139
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
/**
|
|
142
|
+
* Zod schema for creating a new business location.
|
|
143
|
+
*
|
|
144
|
+
* Omits the system-managed fields (`id`, `createdAt`, `updatedAt`) that are
|
|
145
|
+
* populated automatically during creation, while enforcing all required fields.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const newLocation: CreateBusinessLocation = {
|
|
150
|
+
* name: 'Airport Kiosk',
|
|
151
|
+
* status: BusinessLocationStatus.ACTIVE,
|
|
152
|
+
* isPrimary: false,
|
|
153
|
+
* timezone: 'America/Chicago',
|
|
154
|
+
* businessHours: {
|
|
155
|
+
* '1': { isOpen: true, startTime: '06:00', endTime: '22:00' },
|
|
156
|
+
* },
|
|
157
|
+
* };
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export declare const CreateBusinessLocationSchema: z.ZodObject<{
|
|
161
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
162
|
+
code: z.ZodOptional<z.ZodString>;
|
|
163
|
+
status: z.ZodDefault<z.ZodEnum<typeof BusinessLocationStatus>>;
|
|
164
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
165
|
+
name: z.ZodString;
|
|
166
|
+
isPrimary: z.ZodDefault<z.ZodBoolean>;
|
|
167
|
+
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
168
|
+
externalLocationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
169
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
170
|
+
businessHours: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
171
|
+
isOpen: z.ZodBoolean;
|
|
172
|
+
startTime: z.ZodString;
|
|
173
|
+
endTime: z.ZodString;
|
|
174
|
+
breakTimes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
175
|
+
start: z.ZodString;
|
|
176
|
+
end: z.ZodString;
|
|
177
|
+
}, z.core.$strip>>>;
|
|
178
|
+
}, z.core.$strip>>;
|
|
179
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
180
|
+
street: z.ZodString;
|
|
181
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
182
|
+
city: z.ZodString;
|
|
183
|
+
state: z.ZodString;
|
|
184
|
+
postalCode: z.ZodString;
|
|
185
|
+
country: z.ZodString;
|
|
186
|
+
}, z.core.$strip>>;
|
|
187
|
+
coordinates: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
188
|
+
latitude: z.ZodNumber;
|
|
189
|
+
longitude: z.ZodNumber;
|
|
190
|
+
}, z.core.$strip>>>;
|
|
191
|
+
}, z.core.$strip>;
|
|
192
|
+
/**
|
|
193
|
+
* Zod schema for updating an existing business location.
|
|
194
|
+
*
|
|
195
|
+
* All fields from {@link CreateBusinessLocationSchema} are made optional (partial),
|
|
196
|
+
* with `id` required to identify the record to update. Only the provided fields
|
|
197
|
+
* are modified.
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```typescript
|
|
201
|
+
* const updatePayload: UpdateBusinessLocation = {
|
|
202
|
+
* id: 'loc_downtown',
|
|
203
|
+
* status: BusinessLocationStatus.INACTIVE,
|
|
204
|
+
* };
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
export declare const UpdateBusinessLocationSchema: z.ZodObject<{
|
|
208
|
+
email: z.ZodOptional<z.ZodOptional<z.ZodEmail>>;
|
|
209
|
+
code: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
210
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<typeof BusinessLocationStatus>>>;
|
|
211
|
+
metadata: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
212
|
+
name: z.ZodOptional<z.ZodString>;
|
|
213
|
+
isPrimary: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
214
|
+
phoneNumber: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
215
|
+
externalLocationId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
216
|
+
timezone: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
217
|
+
businessHours: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
218
|
+
isOpen: z.ZodBoolean;
|
|
219
|
+
startTime: z.ZodString;
|
|
220
|
+
endTime: z.ZodString;
|
|
221
|
+
breakTimes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
222
|
+
start: z.ZodString;
|
|
223
|
+
end: z.ZodString;
|
|
224
|
+
}, z.core.$strip>>>;
|
|
225
|
+
}, z.core.$strip>>>;
|
|
226
|
+
address: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
227
|
+
street: z.ZodString;
|
|
228
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
229
|
+
city: z.ZodString;
|
|
230
|
+
state: z.ZodString;
|
|
231
|
+
postalCode: z.ZodString;
|
|
232
|
+
country: z.ZodString;
|
|
233
|
+
}, z.core.$strip>>>;
|
|
234
|
+
coordinates: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
235
|
+
latitude: z.ZodNumber;
|
|
236
|
+
longitude: z.ZodNumber;
|
|
237
|
+
}, z.core.$strip>>>>;
|
|
238
|
+
id: z.ZodString;
|
|
239
|
+
}, z.core.$strip>;
|
|
240
|
+
/**
|
|
241
|
+
* Geographic coordinates inferred from {@link GeoCoordinatesSchema}.
|
|
242
|
+
*/
|
|
243
|
+
export type GeoCoordinates = z.infer<typeof GeoCoordinatesSchema>;
|
|
244
|
+
/**
|
|
245
|
+
* Complete business location record inferred from {@link BusinessLocationSchema}.
|
|
246
|
+
*/
|
|
247
|
+
export type BusinessLocation = z.infer<typeof BusinessLocationSchema>;
|
|
248
|
+
/**
|
|
249
|
+
* Payload for creating a business location, inferred from {@link CreateBusinessLocationSchema}.
|
|
250
|
+
*/
|
|
251
|
+
export type CreateBusinessLocation = z.infer<typeof CreateBusinessLocationSchema>;
|
|
252
|
+
/**
|
|
253
|
+
* Partial update payload (with required `id`) inferred from {@link UpdateBusinessLocationSchema}.
|
|
254
|
+
*/
|
|
255
|
+
export type UpdateBusinessLocation = z.infer<typeof UpdateBusinessLocationSchema>;
|
|
256
|
+
/**
|
|
257
|
+
* Filter options for querying business locations.
|
|
258
|
+
*
|
|
259
|
+
* All filters are optional and combine with AND semantics. Geographic filters
|
|
260
|
+
* (`nearLocation`, `boundingBox`) only match locations that have `coordinates` set.
|
|
261
|
+
*
|
|
262
|
+
* @interface BusinessLocationFilters
|
|
263
|
+
*/
|
|
264
|
+
export interface BusinessLocationFilters {
|
|
265
|
+
/** Filter by lifecycle status */
|
|
266
|
+
status?: BusinessLocationStatus;
|
|
267
|
+
/** Filter to primary locations only */
|
|
268
|
+
isPrimary?: boolean;
|
|
269
|
+
/** Free-text search across name, code, and address */
|
|
270
|
+
search?: string;
|
|
271
|
+
/** Filter by radius around a geographic point */
|
|
272
|
+
nearLocation?: {
|
|
273
|
+
/** Center latitude in decimal degrees */
|
|
274
|
+
latitude: number;
|
|
275
|
+
/** Center longitude in decimal degrees */
|
|
276
|
+
longitude: number;
|
|
277
|
+
/** Search radius in kilometers */
|
|
278
|
+
radiusKm: number;
|
|
279
|
+
};
|
|
280
|
+
/** Filter by a geographic bounding box */
|
|
281
|
+
boundingBox?: {
|
|
282
|
+
/** Southern boundary latitude */
|
|
283
|
+
minLatitude: number;
|
|
284
|
+
/** Northern boundary latitude */
|
|
285
|
+
maxLatitude: number;
|
|
286
|
+
/** Western boundary longitude */
|
|
287
|
+
minLongitude: number;
|
|
288
|
+
/** Eastern boundary longitude */
|
|
289
|
+
maxLongitude: number;
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Sorting options for business location queries.
|
|
294
|
+
*
|
|
295
|
+
* @interface BusinessLocationSorting
|
|
296
|
+
*/
|
|
297
|
+
export interface BusinessLocationSorting {
|
|
298
|
+
/** Field to sort by */
|
|
299
|
+
field: "name" | "createdAt" | "updatedAt" | "status";
|
|
300
|
+
/** Sort direction */
|
|
301
|
+
direction: "asc" | "desc";
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Pagination, filtering, and sorting options for business location queries.
|
|
305
|
+
*
|
|
306
|
+
* @interface BusinessLocationQueryOptions
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```typescript
|
|
310
|
+
* const options: BusinessLocationQueryOptions = {
|
|
311
|
+
* page: 1,
|
|
312
|
+
* pageSize: 20,
|
|
313
|
+
* filters: { status: BusinessLocationStatus.ACTIVE, isPrimary: true },
|
|
314
|
+
* sorting: { field: 'name', direction: 'asc' },
|
|
315
|
+
* };
|
|
316
|
+
* ```
|
|
317
|
+
*/
|
|
318
|
+
export interface BusinessLocationQueryOptions {
|
|
319
|
+
/** Page number (1-indexed) */
|
|
320
|
+
page: number;
|
|
321
|
+
/** Items per page */
|
|
322
|
+
pageSize: number;
|
|
323
|
+
/** Optional filters */
|
|
324
|
+
filters?: BusinessLocationFilters;
|
|
325
|
+
/** Optional sorting */
|
|
326
|
+
sorting?: BusinessLocationSorting;
|
|
327
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateBusinessLocationSchema = exports.CreateBusinessLocationSchema = exports.BusinessLocationSchema = exports.GeoCoordinatesSchema = exports.BusinessLocationStatus = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const base_schema_1 = require("../base.schema");
|
|
6
|
+
const business_definitions_1 = require("../type-definitions/business-definitions");
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Business Location schema definitions.
|
|
9
|
+
* @module business-mgt/business-location
|
|
10
|
+
*
|
|
11
|
+
* A Business Location is a physical or operational site belonging to an
|
|
12
|
+
* organization. It carries contact details, operating hours, geographic
|
|
13
|
+
* coordinates, and lifecycle status, and is referenced by downstream
|
|
14
|
+
* business-management resources.
|
|
15
|
+
*/
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// ENUMS
|
|
18
|
+
// ============================================================================
|
|
19
|
+
/**
|
|
20
|
+
* Business location lifecycle status.
|
|
21
|
+
*
|
|
22
|
+
* Single source of truth for whether a location is operational. Replaces any
|
|
23
|
+
* separate boolean active flag.
|
|
24
|
+
*
|
|
25
|
+
* @enum {string}
|
|
26
|
+
*/
|
|
27
|
+
var BusinessLocationStatus;
|
|
28
|
+
(function (BusinessLocationStatus) {
|
|
29
|
+
/** Location is operational and available for use */
|
|
30
|
+
BusinessLocationStatus["ACTIVE"] = "ACTIVE";
|
|
31
|
+
/** Location is not currently operational */
|
|
32
|
+
BusinessLocationStatus["INACTIVE"] = "INACTIVE";
|
|
33
|
+
})(BusinessLocationStatus || (exports.BusinessLocationStatus = BusinessLocationStatus = {}));
|
|
34
|
+
// ============================================================================
|
|
35
|
+
// BUSINESS LOCATION SCHEMA
|
|
36
|
+
// ============================================================================
|
|
37
|
+
/**
|
|
38
|
+
* Zod schema for geographic coordinates.
|
|
39
|
+
*
|
|
40
|
+
* Represents a single point on the Earth's surface in decimal degrees, used to
|
|
41
|
+
* place a business location on a map and to support proximity and bounding-box
|
|
42
|
+
* queries.
|
|
43
|
+
*
|
|
44
|
+
* @typedef {Object} GeoCoordinates
|
|
45
|
+
* @property {number} latitude - Latitude in decimal degrees, constrained to [-90, 90]
|
|
46
|
+
* @property {number} longitude - Longitude in decimal degrees, constrained to [-180, 180]
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const coordinates: GeoCoordinates = {
|
|
51
|
+
* latitude: 39.7817,
|
|
52
|
+
* longitude: -89.6501,
|
|
53
|
+
* };
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
exports.GeoCoordinatesSchema = zod_1.z.object({
|
|
57
|
+
latitude: zod_1.z.number().min(-90).max(90).describe("Latitude coordinate in decimal degrees."),
|
|
58
|
+
longitude: zod_1.z.number().min(-180).max(180).describe("Longitude coordinate in decimal degrees."),
|
|
59
|
+
}).describe("Geographic coordinates of the location.");
|
|
60
|
+
/**
|
|
61
|
+
* Zod schema for Business Location validation.
|
|
62
|
+
*
|
|
63
|
+
* A Business Location is a physical or operational site belonging to an organization.
|
|
64
|
+
* It captures the operating context for that site — contact details, weekly operating
|
|
65
|
+
* hours, mailing address, geographic coordinates, and lifecycle status — and is
|
|
66
|
+
* referenced by downstream business-management resources.
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
* **Architecture Context:**
|
|
70
|
+
* - **Extends**: {@link BaseModelSchema} (inherits `id`, `createdAt`, `updatedAt`)
|
|
71
|
+
* - **Composes**: {@link AddressSchema} (mailing address), {@link WeeklyScheduleSchema}
|
|
72
|
+
* (operating hours), {@link GeoCoordinatesSchema} (map placement)
|
|
73
|
+
* - **Lifecycle**: Governed by {@link BusinessLocationStatus}; `status` is the single
|
|
74
|
+
* source of truth for active state (there is no separate `isActive` flag)
|
|
75
|
+
*
|
|
76
|
+
* **Field Notes:**
|
|
77
|
+
* - `businessHours` is required — every location must declare a weekly schedule
|
|
78
|
+
* - Geographic filters require `coordinates` to be populated in order to match
|
|
79
|
+
* - `externalLocationId` links the record to an external system when synced or imported
|
|
80
|
+
*
|
|
81
|
+
* @typedef {Object} BusinessLocationProperties
|
|
82
|
+
* @property {string} id - Unique identifier for the location (inherited from base model)
|
|
83
|
+
* @property {number} [createdAt] - Unix timestamp (milliseconds) when created (inherited)
|
|
84
|
+
* @property {number} [updatedAt] - Unix timestamp (milliseconds) when last updated (inherited)
|
|
85
|
+
* @property {string} name - Human-readable location name (e.g., 'Downtown Branch')
|
|
86
|
+
* @property {string} [code] - Short internal code used to reference the location
|
|
87
|
+
* @property {string|null} [externalLocationId] - Identifier in an external system, if synced or imported
|
|
88
|
+
* @property {BusinessLocationStatus} status - Lifecycle status (default: ACTIVE)
|
|
89
|
+
* @property {boolean} isPrimary - Whether this is the organization's primary location (default: false)
|
|
90
|
+
* @property {string} [timezone] - IANA timezone identifier (e.g., 'America/New_York')
|
|
91
|
+
* @property {WeeklySchedule} businessHours - Weekly operating hours for the location
|
|
92
|
+
* @property {string} [phoneNumber] - Primary contact phone number
|
|
93
|
+
* @property {string} [email] - Primary contact email
|
|
94
|
+
* @property {Address} [address] - Physical mailing address
|
|
95
|
+
* @property {GeoCoordinates|null} [coordinates] - Geographic coordinates of the location
|
|
96
|
+
* @property {Record<string, any>} [metadata] - Additional metadata for organization, tagging, and filtering
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const location: BusinessLocation = {
|
|
101
|
+
* id: 'loc_downtown',
|
|
102
|
+
* name: 'Downtown Branch',
|
|
103
|
+
* code: 'DTWN',
|
|
104
|
+
* status: BusinessLocationStatus.ACTIVE,
|
|
105
|
+
* isPrimary: true,
|
|
106
|
+
* timezone: 'America/New_York',
|
|
107
|
+
* businessHours: {
|
|
108
|
+
* '1': { isOpen: true, startTime: '09:00', endTime: '17:00' },
|
|
109
|
+
* },
|
|
110
|
+
* phoneNumber: '+15551234567',
|
|
111
|
+
* email: 'downtown@example.com',
|
|
112
|
+
* coordinates: { latitude: 39.7817, longitude: -89.6501 },
|
|
113
|
+
* createdAt: Date.now(),
|
|
114
|
+
* updatedAt: Date.now(),
|
|
115
|
+
* };
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
exports.BusinessLocationSchema = base_schema_1.BaseModelSchema.safeExtend({
|
|
119
|
+
name: zod_1.z.string().min(1).describe("Human-readable location name (e.g., 'Downtown Branch')."),
|
|
120
|
+
code: zod_1.z.string().optional().describe("Short internal code used to reference the location."),
|
|
121
|
+
externalLocationId: zod_1.z.string().nullable().optional().describe("Identifier for this location in an external system, if synced or imported."),
|
|
122
|
+
status: zod_1.z.enum(BusinessLocationStatus).default(BusinessLocationStatus.ACTIVE).describe("Lifecycle status of the location."),
|
|
123
|
+
isPrimary: zod_1.z.boolean().default(false).describe("Whether this is the organization's primary location."),
|
|
124
|
+
timezone: zod_1.z.string().optional().describe("IANA timezone identifier for the location (e.g., 'America/New_York')."),
|
|
125
|
+
businessHours: business_definitions_1.WeeklyScheduleSchema.describe("Weekly operating hours for the location."),
|
|
126
|
+
phoneNumber: zod_1.z.string().optional().describe("Primary contact phone number for the location."),
|
|
127
|
+
email: zod_1.z.email().optional().describe("Primary contact email for the location."),
|
|
128
|
+
address: base_schema_1.AddressSchema.optional().describe("Physical mailing address of the location."),
|
|
129
|
+
coordinates: exports.GeoCoordinatesSchema.nullable().optional().describe("Geographic coordinates of the location."),
|
|
130
|
+
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe("Additional metadata for organization, tagging, and filtering."),
|
|
131
|
+
});
|
|
132
|
+
// ============================================================================
|
|
133
|
+
// CREATE/UPDATE SCHEMAS
|
|
134
|
+
// ============================================================================
|
|
135
|
+
/**
|
|
136
|
+
* Zod schema for creating a new business location.
|
|
137
|
+
*
|
|
138
|
+
* Omits the system-managed fields (`id`, `createdAt`, `updatedAt`) that are
|
|
139
|
+
* populated automatically during creation, while enforcing all required fields.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const newLocation: CreateBusinessLocation = {
|
|
144
|
+
* name: 'Airport Kiosk',
|
|
145
|
+
* status: BusinessLocationStatus.ACTIVE,
|
|
146
|
+
* isPrimary: false,
|
|
147
|
+
* timezone: 'America/Chicago',
|
|
148
|
+
* businessHours: {
|
|
149
|
+
* '1': { isOpen: true, startTime: '06:00', endTime: '22:00' },
|
|
150
|
+
* },
|
|
151
|
+
* };
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
exports.CreateBusinessLocationSchema = exports.BusinessLocationSchema.omit({
|
|
155
|
+
id: true,
|
|
156
|
+
createdAt: true,
|
|
157
|
+
updatedAt: true,
|
|
158
|
+
});
|
|
159
|
+
/**
|
|
160
|
+
* Zod schema for updating an existing business location.
|
|
161
|
+
*
|
|
162
|
+
* All fields from {@link CreateBusinessLocationSchema} are made optional (partial),
|
|
163
|
+
* with `id` required to identify the record to update. Only the provided fields
|
|
164
|
+
* are modified.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* const updatePayload: UpdateBusinessLocation = {
|
|
169
|
+
* id: 'loc_downtown',
|
|
170
|
+
* status: BusinessLocationStatus.INACTIVE,
|
|
171
|
+
* };
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
exports.UpdateBusinessLocationSchema = exports.CreateBusinessLocationSchema.partial().safeExtend({
|
|
175
|
+
id: zod_1.z.string().describe("Unique identifier of the business location to update."),
|
|
176
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Customer Group schema definitions for business management.
|
|
4
|
+
* @module business-mgt/customer-group
|
|
5
|
+
*
|
|
6
|
+
* Customer groups enable segmentation for pricing tiers and special terms
|
|
7
|
+
* (e.g., Retail, Wholesale, VIP, Gold Tier).
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Customer Group schema.
|
|
11
|
+
* Groups customers for pricing tiers and special terms.
|
|
12
|
+
*
|
|
13
|
+
* @typedef {Object} CustomerGroup
|
|
14
|
+
* @property {string} name - Group name (e.g., Retail, Wholesale, VIP)
|
|
15
|
+
* @property {string} [description] - Group description
|
|
16
|
+
* @property {string} [code] - Short code (e.g., WS, VIP, GOLD)
|
|
17
|
+
* @property {boolean} isDefault - Whether this is the default group
|
|
18
|
+
*/
|
|
19
|
+
export declare const CustomerGroupSchema: z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
createdAt: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
+
isDefault: z.ZodDefault<z.ZodBoolean>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
/**
|
|
29
|
+
* Schema for creating a new customer group.
|
|
30
|
+
* Omits auto-generated fields.
|
|
31
|
+
*/
|
|
32
|
+
export declare const CreateCustomerGroupSchema: z.ZodObject<{
|
|
33
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
36
|
+
isDefault: z.ZodDefault<z.ZodBoolean>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
/**
|
|
39
|
+
* Schema for updating an existing customer group.
|
|
40
|
+
* All fields optional except id (required).
|
|
41
|
+
*/
|
|
42
|
+
export declare const UpdateCustomerGroupSchema: z.ZodObject<{
|
|
43
|
+
code: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
44
|
+
name: z.ZodOptional<z.ZodString>;
|
|
45
|
+
description: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
46
|
+
isDefault: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
export type CustomerGroup = z.infer<typeof CustomerGroupSchema>;
|
|
50
|
+
export type CreateCustomerGroup = z.infer<typeof CreateCustomerGroupSchema>;
|
|
51
|
+
export type UpdateCustomerGroup = z.infer<typeof UpdateCustomerGroupSchema>;
|
|
52
|
+
/**
|
|
53
|
+
* Customer group filter options.
|
|
54
|
+
* @interface CustomerGroupFilters
|
|
55
|
+
*/
|
|
56
|
+
export interface CustomerGroupFilters {
|
|
57
|
+
/** Text search across name/description/code */
|
|
58
|
+
search?: string;
|
|
59
|
+
/** Filter by code */
|
|
60
|
+
code?: string;
|
|
61
|
+
/** Filter by default status */
|
|
62
|
+
isDefault?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Customer group sorting options.
|
|
66
|
+
* @interface CustomerGroupSorting
|
|
67
|
+
*/
|
|
68
|
+
export interface CustomerGroupSorting {
|
|
69
|
+
/** Field to sort by */
|
|
70
|
+
field: "name" | "code" | "createdAt";
|
|
71
|
+
/** Sort direction */
|
|
72
|
+
direction: "asc" | "desc";
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Customer group query options.
|
|
76
|
+
* @interface CustomerGroupQueryOptions
|
|
77
|
+
*/
|
|
78
|
+
export interface CustomerGroupQueryOptions {
|
|
79
|
+
/** Page number (1-indexed) */
|
|
80
|
+
page: number;
|
|
81
|
+
/** Items per page */
|
|
82
|
+
pageSize: number;
|
|
83
|
+
/** Optional filters */
|
|
84
|
+
filters?: CustomerGroupFilters;
|
|
85
|
+
/** Optional sorting */
|
|
86
|
+
sorting?: CustomerGroupSorting;
|
|
87
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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.UpdateCustomerGroupSchema = exports.CreateCustomerGroupSchema = exports.CustomerGroupSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const base_schema_1 = require("../../base.schema");
|
|
9
|
+
/**
|
|
10
|
+
* @fileoverview Customer Group schema definitions for business management.
|
|
11
|
+
* @module business-mgt/customer-group
|
|
12
|
+
*
|
|
13
|
+
* Customer groups enable segmentation for pricing tiers and special terms
|
|
14
|
+
* (e.g., Retail, Wholesale, VIP, Gold Tier).
|
|
15
|
+
*/
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// CUSTOMER GROUP SCHEMA
|
|
18
|
+
// ============================================================================
|
|
19
|
+
/**
|
|
20
|
+
* Customer Group schema.
|
|
21
|
+
* Groups customers for pricing tiers and special terms.
|
|
22
|
+
*
|
|
23
|
+
* @typedef {Object} CustomerGroup
|
|
24
|
+
* @property {string} name - Group name (e.g., Retail, Wholesale, VIP)
|
|
25
|
+
* @property {string} [description] - Group description
|
|
26
|
+
* @property {string} [code] - Short code (e.g., WS, VIP, GOLD)
|
|
27
|
+
* @property {boolean} isDefault - Whether this is the default group
|
|
28
|
+
*/
|
|
29
|
+
exports.CustomerGroupSchema = base_schema_1.BaseModelSchema.safeExtend({
|
|
30
|
+
name: zod_1.default.string().min(1, "Group name is required").describe("Customer group name (e.g., Retail, Wholesale, VIP, Gold Tier)"),
|
|
31
|
+
description: zod_1.default.string().nullable().optional().describe("Group description"),
|
|
32
|
+
code: zod_1.default.string().nullable().optional().describe("Short code for the group (e.g., WS, VIP, GOLD)"),
|
|
33
|
+
isDefault: zod_1.default.boolean().default(false).describe("Whether this is the default customer group"),
|
|
34
|
+
});
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// CREATE/UPDATE SCHEMAS
|
|
37
|
+
// ============================================================================
|
|
38
|
+
/**
|
|
39
|
+
* Schema for creating a new customer group.
|
|
40
|
+
* Omits auto-generated fields.
|
|
41
|
+
*/
|
|
42
|
+
exports.CreateCustomerGroupSchema = exports.CustomerGroupSchema.omit({
|
|
43
|
+
id: true,
|
|
44
|
+
createdAt: true,
|
|
45
|
+
updatedAt: true,
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Schema for updating an existing customer group.
|
|
49
|
+
* All fields optional except id (required).
|
|
50
|
+
*/
|
|
51
|
+
exports.UpdateCustomerGroupSchema = exports.CreateCustomerGroupSchema.partial().safeExtend({
|
|
52
|
+
id: zod_1.default.string().describe("Unique identifier of the CustomerGroup to update"),
|
|
53
|
+
});
|