@api-client/core 0.18.21 → 0.18.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/build/src/modeling/helpers/Intelisense.d.ts +1 -0
  2. package/build/src/modeling/helpers/Intelisense.d.ts.map +1 -1
  3. package/build/src/modeling/helpers/Intelisense.js +1 -0
  4. package/build/src/modeling/helpers/Intelisense.js.map +1 -1
  5. package/build/src/modeling/templates/index.d.ts +1 -0
  6. package/build/src/modeling/templates/index.d.ts.map +1 -1
  7. package/build/src/modeling/templates/index.js +2 -0
  8. package/build/src/modeling/templates/index.js.map +1 -1
  9. package/build/src/modeling/templates/meta/education-management-platform.json +1 -0
  10. package/build/src/modeling/templates/meta/financial-services-platform.json +1 -0
  11. package/build/src/modeling/templates/meta/gaming-platform.json +1 -0
  12. package/build/src/modeling/templates/meta/healthcare-management-platform.json +1 -0
  13. package/build/src/modeling/templates/meta/hospitality-platform.json +1 -0
  14. package/build/src/modeling/templates/meta/index.d.ts +2 -2
  15. package/build/src/modeling/templates/meta/index.d.ts.map +1 -1
  16. package/build/src/modeling/templates/meta/index.js +31 -1
  17. package/build/src/modeling/templates/meta/index.js.map +1 -1
  18. package/build/src/modeling/templates/meta/iot-smart-home-platform.json +1 -0
  19. package/build/src/modeling/templates/meta/legal-services-platform.json +1 -0
  20. package/build/src/modeling/templates/meta/manufacturing-platform.json +1 -0
  21. package/build/src/modeling/templates/meta/non-profit-platform.json +1 -0
  22. package/build/src/modeling/templates/meta/real-estate-management-platform.json +1 -0
  23. package/build/src/modeling/templates/template-registry.d.ts +14 -0
  24. package/build/src/modeling/templates/template-registry.d.ts.map +1 -1
  25. package/build/src/modeling/templates/template-registry.js +63 -0
  26. package/build/src/modeling/templates/template-registry.js.map +1 -1
  27. package/build/src/modeling/templates/{ecommerce-domain.d.ts → verticals/business-services/ecommerce-domain.d.ts} +2 -2
  28. package/build/src/modeling/templates/verticals/business-services/ecommerce-domain.d.ts.map +1 -0
  29. package/build/src/modeling/templates/{ecommerce-domain.js → verticals/business-services/ecommerce-domain.js} +6 -6
  30. package/build/src/modeling/templates/verticals/business-services/ecommerce-domain.js.map +1 -0
  31. package/build/src/modeling/templates/verticals/business-services/financial-services-domain.d.ts +40 -0
  32. package/build/src/modeling/templates/verticals/business-services/financial-services-domain.d.ts.map +1 -0
  33. package/build/src/modeling/templates/verticals/business-services/financial-services-domain.js +744 -0
  34. package/build/src/modeling/templates/verticals/business-services/financial-services-domain.js.map +1 -0
  35. package/build/src/modeling/templates/verticals/business-services/hospitality-domain.d.ts +45 -0
  36. package/build/src/modeling/templates/verticals/business-services/hospitality-domain.d.ts.map +1 -0
  37. package/build/src/modeling/templates/verticals/business-services/hospitality-domain.js +797 -0
  38. package/build/src/modeling/templates/verticals/business-services/hospitality-domain.js.map +1 -0
  39. package/build/src/modeling/templates/verticals/business-services/index.d.ts +21 -0
  40. package/build/src/modeling/templates/verticals/business-services/index.d.ts.map +1 -0
  41. package/build/src/modeling/templates/verticals/business-services/index.js +50 -0
  42. package/build/src/modeling/templates/verticals/business-services/index.js.map +1 -0
  43. package/build/src/modeling/templates/verticals/business-services/legal-services-domain.d.ts +46 -0
  44. package/build/src/modeling/templates/verticals/business-services/legal-services-domain.d.ts.map +1 -0
  45. package/build/src/modeling/templates/verticals/business-services/legal-services-domain.js +837 -0
  46. package/build/src/modeling/templates/verticals/business-services/legal-services-domain.js.map +1 -0
  47. package/build/src/modeling/templates/verticals/education-training/education-domain.d.ts +40 -0
  48. package/build/src/modeling/templates/verticals/education-training/education-domain.d.ts.map +1 -0
  49. package/build/src/modeling/templates/verticals/education-training/education-domain.js +725 -0
  50. package/build/src/modeling/templates/verticals/education-training/education-domain.js.map +1 -0
  51. package/build/src/modeling/templates/verticals/education-training/index.d.ts +18 -0
  52. package/build/src/modeling/templates/verticals/education-training/index.d.ts.map +1 -0
  53. package/build/src/modeling/templates/verticals/education-training/index.js +21 -0
  54. package/build/src/modeling/templates/verticals/education-training/index.js.map +1 -0
  55. package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.d.ts +40 -0
  56. package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.d.ts.map +1 -0
  57. package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.js +859 -0
  58. package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.js.map +1 -0
  59. package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.d.ts +18 -0
  60. package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.d.ts.map +1 -0
  61. package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.js +21 -0
  62. package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.js.map +1 -0
  63. package/build/src/modeling/templates/verticals/index.d.ts +79 -0
  64. package/build/src/modeling/templates/verticals/index.d.ts.map +1 -0
  65. package/build/src/modeling/templates/verticals/index.js +186 -0
  66. package/build/src/modeling/templates/verticals/index.js.map +1 -0
  67. package/build/src/modeling/templates/verticals/manufacturing-logistics/index.d.ts +18 -0
  68. package/build/src/modeling/templates/verticals/manufacturing-logistics/index.d.ts.map +1 -0
  69. package/build/src/modeling/templates/verticals/manufacturing-logistics/index.js +22 -0
  70. package/build/src/modeling/templates/verticals/manufacturing-logistics/index.js.map +1 -0
  71. package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.d.ts +45 -0
  72. package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.d.ts.map +1 -0
  73. package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.js +710 -0
  74. package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.js.map +1 -0
  75. package/build/src/modeling/templates/verticals/public-sector/index.d.ts +18 -0
  76. package/build/src/modeling/templates/verticals/public-sector/index.d.ts.map +1 -0
  77. package/build/src/modeling/templates/verticals/public-sector/index.js +22 -0
  78. package/build/src/modeling/templates/verticals/public-sector/index.js.map +1 -0
  79. package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.d.ts +47 -0
  80. package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.d.ts.map +1 -0
  81. package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.js +864 -0
  82. package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.js.map +1 -0
  83. package/build/src/modeling/templates/verticals/real-estate-construction/index.d.ts +18 -0
  84. package/build/src/modeling/templates/verticals/real-estate-construction/index.d.ts.map +1 -0
  85. package/build/src/modeling/templates/verticals/real-estate-construction/index.js +21 -0
  86. package/build/src/modeling/templates/verticals/real-estate-construction/index.js.map +1 -0
  87. package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.d.ts +40 -0
  88. package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.d.ts.map +1 -0
  89. package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.js +727 -0
  90. package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.js.map +1 -0
  91. package/build/src/modeling/templates/{blog-domain.d.ts → verticals/technology-media/blog-domain.d.ts} +2 -2
  92. package/build/src/modeling/templates/verticals/technology-media/blog-domain.d.ts.map +1 -0
  93. package/build/src/modeling/templates/{blog-domain.js → verticals/technology-media/blog-domain.js} +5 -5
  94. package/build/src/modeling/templates/verticals/technology-media/blog-domain.js.map +1 -0
  95. package/build/src/modeling/templates/verticals/technology-media/gaming-domain.d.ts +46 -0
  96. package/build/src/modeling/templates/verticals/technology-media/gaming-domain.d.ts.map +1 -0
  97. package/build/src/modeling/templates/verticals/technology-media/gaming-domain.js +1033 -0
  98. package/build/src/modeling/templates/verticals/technology-media/gaming-domain.js.map +1 -0
  99. package/build/src/modeling/templates/verticals/technology-media/index.d.ts +21 -0
  100. package/build/src/modeling/templates/verticals/technology-media/index.d.ts.map +1 -0
  101. package/build/src/modeling/templates/verticals/technology-media/index.js +42 -0
  102. package/build/src/modeling/templates/verticals/technology-media/index.js.map +1 -0
  103. package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.d.ts +47 -0
  104. package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.d.ts.map +1 -0
  105. package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.js +1027 -0
  106. package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.js.map +1 -0
  107. package/build/tsconfig.tsbuildinfo +1 -1
  108. package/package.json +1 -1
  109. package/src/modeling/helpers/Intelisense.ts +1 -0
  110. package/src/modeling/templates/meta/education-management-platform.json +1 -0
  111. package/src/modeling/templates/meta/financial-services-platform.json +1 -0
  112. package/src/modeling/templates/meta/gaming-platform.json +1 -0
  113. package/src/modeling/templates/meta/healthcare-management-platform.json +1 -0
  114. package/src/modeling/templates/meta/hospitality-platform.json +1 -0
  115. package/src/modeling/templates/meta/iot-smart-home-platform.json +1 -0
  116. package/src/modeling/templates/meta/legal-services-platform.json +1 -0
  117. package/src/modeling/templates/meta/manufacturing-platform.json +1 -0
  118. package/src/modeling/templates/meta/non-profit-platform.json +1 -0
  119. package/src/modeling/templates/meta/real-estate-management-platform.json +1 -0
  120. package/src/modeling/templates/readme.md +14 -0
  121. package/src/modeling/templates/template-registry.ts +73 -0
  122. package/src/modeling/templates/verticals/README.md +122 -0
  123. package/src/modeling/templates/{ecommerce-domain.ts → verticals/business-services/ecommerce-domain.ts} +7 -7
  124. package/src/modeling/templates/verticals/business-services/financial-services-domain.ts +943 -0
  125. package/src/modeling/templates/verticals/business-services/hospitality-domain.ts +994 -0
  126. package/src/modeling/templates/verticals/business-services/legal-services-domain.ts +1059 -0
  127. package/src/modeling/templates/verticals/education-training/education-domain.ts +922 -0
  128. package/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.ts +1111 -0
  129. package/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.ts +895 -0
  130. package/src/modeling/templates/verticals/public-sector/non-profit-domain.ts +1109 -0
  131. package/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.ts +944 -0
  132. package/src/modeling/templates/{blog-domain.ts → verticals/technology-media/blog-domain.ts} +6 -6
  133. package/src/modeling/templates/verticals/technology-media/gaming-domain.ts +1290 -0
  134. package/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.ts +1287 -0
  135. package/build/src/modeling/templates/blog-domain.d.ts.map +0 -1
  136. package/build/src/modeling/templates/blog-domain.js.map +0 -1
  137. package/build/src/modeling/templates/ecommerce-domain.d.ts.map +0 -1
  138. package/build/src/modeling/templates/ecommerce-domain.js.map +0 -1
@@ -0,0 +1,1027 @@
1
+ /**
2
+ * IoT/Smart Home Domain Template
3
+ *
4
+ * A comprehensive IoT/Smart Home data domain following domain-driven design principles.
5
+ * This template covers the complete IoT ecosystem lifecycle including:
6
+ *
7
+ * - Device Management: Devices, sensors, connectivity, firmware
8
+ * - Data Collection: Sensor data, telemetry, analytics
9
+ * - Automation: Rules, triggers, actions, schedules
10
+ * - User Management: Users, permissions, device access
11
+ * - Monitoring: Alerts, notifications, health status
12
+ * - Integration: Third-party services, APIs, protocols
13
+ *
14
+ * Key Features:
15
+ * - Complete device lifecycle management
16
+ * - Real-time data collection and analytics
17
+ * - Smart automation and rules engine
18
+ * - User access and permission management
19
+ * - System monitoring and alerting
20
+ * - Third-party service integration
21
+ * - IoT ecosystem management
22
+ *
23
+ * Use Cases:
24
+ * - Smart home systems
25
+ * - IoT device management
26
+ * - Home automation
27
+ * - Sensor data analytics
28
+ * - Device monitoring and maintenance
29
+ * - User access control
30
+ * - Third-party integrations
31
+ */
32
+ import { DataDomain } from '../../../DataDomain.js';
33
+ import { addIdField, addNameField, addDescriptionField, addEmailField, addPhoneField, addCustomStatusField, addCreatedAtField, addUpdatedAtField, } from '../../../helpers/Intelisense.js';
34
+ function createDomain() {
35
+ return new DataDomain({
36
+ info: {
37
+ name: 'IoT Smart Home Platform',
38
+ displayName: 'IoT Smart Home Platform',
39
+ description: 'A comprehensive IoT/Smart Home platform with device management, data collection, ' +
40
+ 'automation, user management, monitoring, and integration',
41
+ },
42
+ });
43
+ }
44
+ /**
45
+ * Creates a comprehensive IoT/Smart Home data domain following domain-driven design principles.
46
+ *
47
+ * This function demonstrates the proper hierarchy and organization for an IoT/Smart Home platform:
48
+ * 1. Creates the root DataDomain for the IoT/Smart Home platform
49
+ * 2. Organizes functionality into logical namespaces (Device Management, Data Collection, etc.)
50
+ * 3. Groups related entities into models within each namespace
51
+ * 4. Defines entities with proper semantic annotations for IoT workflows
52
+ * 5. Establishes associations with appropriate cardinality for IoT relationships
53
+ *
54
+ * @returns A fully configured DataDomain with all IoT/Smart Home entities and relationships
55
+ */
56
+ export default function createIoTSmartHomeDomain(options = {}) {
57
+ // Ensure the root data domain
58
+ const domain = options.domain ?? createDomain();
59
+ //
60
+ // 1. DEVICE MANAGEMENT NAMESPACE
61
+ //
62
+ const deviceManagement = domain.addNamespace({
63
+ info: {
64
+ name: 'DeviceManagement',
65
+ displayName: 'Device Management',
66
+ description: 'Devices, sensors, connectivity, and firmware',
67
+ },
68
+ });
69
+ // Device Model
70
+ const deviceModel = deviceManagement.addModel({
71
+ info: {
72
+ name: 'Devices',
73
+ displayName: 'Device Management',
74
+ description: 'IoT devices and sensors',
75
+ },
76
+ });
77
+ // Device Entity
78
+ const deviceEntity = deviceModel.addEntity({
79
+ info: {
80
+ name: 'device',
81
+ displayName: 'Device',
82
+ description: 'IoT device with sensors and capabilities',
83
+ },
84
+ });
85
+ addIdField(deviceEntity, { displayName: 'Device ID', description: 'Unique identifier for the device' });
86
+ addNameField(deviceEntity, { description: 'Device name and model' });
87
+ addDescriptionField(deviceEntity, { description: 'Device description and capabilities' });
88
+ deviceEntity.addProperty({
89
+ info: { name: 'device_type', displayName: 'Device Type', description: 'Type of IoT device' },
90
+ type: 'string',
91
+ required: true,
92
+ schema: {
93
+ enum: [
94
+ 'sensor',
95
+ 'actuator',
96
+ 'controller',
97
+ 'gateway',
98
+ 'camera',
99
+ 'thermostat',
100
+ 'light',
101
+ 'lock',
102
+ 'appliance',
103
+ 'speaker',
104
+ ],
105
+ },
106
+ });
107
+ deviceEntity.addProperty({
108
+ info: { name: 'manufacturer', displayName: 'Manufacturer', description: 'Device manufacturer' },
109
+ type: 'string',
110
+ required: true,
111
+ });
112
+ deviceEntity.addProperty({
113
+ info: { name: 'model', displayName: 'Model', description: 'Device model' },
114
+ type: 'string',
115
+ required: true,
116
+ });
117
+ deviceEntity.addProperty({
118
+ info: { name: 'serial_number', displayName: 'Serial Number', description: 'Device serial number' },
119
+ type: 'string',
120
+ required: true,
121
+ unique: true,
122
+ });
123
+ deviceEntity.addProperty({
124
+ info: { name: 'mac_address', displayName: 'MAC Address', description: 'Device MAC address' },
125
+ type: 'string',
126
+ required: true,
127
+ unique: true,
128
+ });
129
+ deviceEntity.addProperty({
130
+ info: { name: 'ip_address', displayName: 'IP Address', description: 'Device IP address' },
131
+ type: 'string',
132
+ required: false,
133
+ });
134
+ deviceEntity.addProperty({
135
+ info: { name: 'location', displayName: 'Location', description: 'Device location in home' },
136
+ type: 'string',
137
+ required: false,
138
+ });
139
+ deviceEntity.addProperty({
140
+ info: { name: 'firmware_version', displayName: 'Firmware Version', description: 'Current firmware version' },
141
+ type: 'string',
142
+ required: true,
143
+ });
144
+ addCustomStatusField(deviceEntity, ['online', 'offline', 'maintenance', 'error', 'updating'], {
145
+ displayName: 'Device Status',
146
+ description: 'Current status of the device',
147
+ });
148
+ addCreatedAtField(deviceEntity, { description: 'When the device was created' });
149
+ addUpdatedAtField(deviceEntity, { description: 'When the device was last updated' });
150
+ // Sensor Entity
151
+ const sensorEntity = deviceModel.addEntity({
152
+ info: {
153
+ name: 'sensor',
154
+ displayName: 'Sensor',
155
+ description: 'IoT sensor with measurement capabilities',
156
+ },
157
+ });
158
+ addIdField(sensorEntity, { displayName: 'Sensor ID', description: 'Unique identifier for the sensor' });
159
+ addNameField(sensorEntity, { description: 'Sensor name and type' });
160
+ addDescriptionField(sensorEntity, { description: 'Sensor description and capabilities' });
161
+ sensorEntity.addProperty({
162
+ info: { name: 'sensor_type', displayName: 'Sensor Type', description: 'Type of sensor' },
163
+ type: 'string',
164
+ required: true,
165
+ schema: {
166
+ enum: [
167
+ 'temperature',
168
+ 'humidity',
169
+ 'pressure',
170
+ 'motion',
171
+ 'light',
172
+ 'sound',
173
+ 'air_quality',
174
+ 'water_level',
175
+ 'smoke',
176
+ 'carbon_monoxide',
177
+ ],
178
+ },
179
+ });
180
+ sensorEntity.addProperty({
181
+ info: { name: 'measurement_unit', displayName: 'Measurement Unit', description: 'Unit of measurement' },
182
+ type: 'string',
183
+ required: true,
184
+ });
185
+ sensorEntity.addProperty({
186
+ info: { name: 'min_value', displayName: 'Minimum Value', description: 'Minimum measurement value' },
187
+ type: 'number',
188
+ required: false,
189
+ });
190
+ sensorEntity.addProperty({
191
+ info: { name: 'max_value', displayName: 'Maximum Value', description: 'Maximum measurement value' },
192
+ type: 'number',
193
+ required: false,
194
+ });
195
+ addCustomStatusField(sensorEntity, ['active', 'inactive', 'calibrating', 'error'], {
196
+ displayName: 'Sensor Status',
197
+ description: 'Current status of the sensor',
198
+ });
199
+ addCreatedAtField(sensorEntity, { description: 'When the sensor was created' });
200
+ // Sensor-Device Association (Many-to-One)
201
+ sensorEntity.addAssociation({ key: deviceEntity.key }, {
202
+ info: { name: 'device', displayName: 'Device', description: 'Device for this sensor' },
203
+ required: true,
204
+ multiple: false,
205
+ });
206
+ // Firmware Entity
207
+ const firmwareEntity = deviceModel.addEntity({
208
+ info: {
209
+ name: 'firmware',
210
+ displayName: 'Firmware',
211
+ description: 'Device firmware versions and updates',
212
+ },
213
+ });
214
+ addIdField(firmwareEntity, { displayName: 'Firmware ID', description: 'Unique identifier for the firmware' });
215
+ addNameField(firmwareEntity, { description: 'Firmware name and version' });
216
+ addDescriptionField(firmwareEntity, { description: 'Firmware description and changes' });
217
+ firmwareEntity.addProperty({
218
+ info: { name: 'version', displayName: 'Version', description: 'Firmware version number' },
219
+ type: 'string',
220
+ required: true,
221
+ });
222
+ firmwareEntity.addProperty({
223
+ info: { name: 'release_date', displayName: 'Release Date', description: 'Firmware release date' },
224
+ type: 'date',
225
+ required: true,
226
+ });
227
+ firmwareEntity.addProperty({
228
+ info: { name: 'file_size', displayName: 'File Size', description: 'Firmware file size in bytes' },
229
+ type: 'number',
230
+ required: true,
231
+ schema: {
232
+ minimum: 0,
233
+ },
234
+ });
235
+ firmwareEntity.addProperty({
236
+ info: { name: 'compatibility', displayName: 'Compatibility', description: 'Compatible device models' },
237
+ type: 'string',
238
+ required: true,
239
+ });
240
+ addCustomStatusField(firmwareEntity, ['available', 'installing', 'installed', 'failed'], {
241
+ displayName: 'Firmware Status',
242
+ description: 'Current status of the firmware',
243
+ });
244
+ addCreatedAtField(firmwareEntity, { description: 'When the firmware was created' });
245
+ // Firmware-Device Association (Many-to-One)
246
+ firmwareEntity.addAssociation({ key: deviceEntity.key }, {
247
+ info: { name: 'device', displayName: 'Device', description: 'Device for this firmware' },
248
+ required: true,
249
+ multiple: false,
250
+ });
251
+ //
252
+ // 2. DATA COLLECTION NAMESPACE
253
+ //
254
+ const dataCollection = domain.addNamespace({
255
+ info: {
256
+ name: 'DataCollection',
257
+ displayName: 'Data Collection',
258
+ description: 'Sensor data, telemetry, and analytics',
259
+ },
260
+ });
261
+ // Data Model
262
+ const dataModel = dataCollection.addModel({
263
+ info: {
264
+ name: 'Data',
265
+ displayName: 'Data Collection',
266
+ description: 'Sensor data and telemetry',
267
+ },
268
+ });
269
+ // Sensor Data Entity
270
+ const sensorDataEntity = dataModel.addEntity({
271
+ info: {
272
+ name: 'sensor_data',
273
+ displayName: 'Sensor Data',
274
+ description: 'Sensor measurement data',
275
+ },
276
+ });
277
+ addIdField(sensorDataEntity, { displayName: 'Data ID', description: 'Unique identifier for the sensor data' });
278
+ addNameField(sensorDataEntity, { description: 'Data name and description' });
279
+ sensorDataEntity.addProperty({
280
+ info: { name: 'timestamp', displayName: 'Timestamp', description: 'Data timestamp' },
281
+ type: 'datetime',
282
+ required: true,
283
+ });
284
+ sensorDataEntity.addProperty({
285
+ info: { name: 'value', displayName: 'Value', description: 'Sensor measurement value' },
286
+ type: 'number',
287
+ required: true,
288
+ });
289
+ sensorDataEntity.addProperty({
290
+ info: { name: 'unit', displayName: 'Unit', description: 'Measurement unit' },
291
+ type: 'string',
292
+ required: true,
293
+ });
294
+ sensorDataEntity.addProperty({
295
+ info: { name: 'quality', displayName: 'Quality', description: 'Data quality indicator' },
296
+ type: 'string',
297
+ required: true,
298
+ schema: {
299
+ enum: ['excellent', 'good', 'fair', 'poor'],
300
+ },
301
+ });
302
+ addCustomStatusField(sensorDataEntity, ['raw', 'processed', 'archived'], {
303
+ displayName: 'Data Status',
304
+ description: 'Current status of the sensor data',
305
+ });
306
+ addCreatedAtField(sensorDataEntity, { description: 'When the data was created' });
307
+ // SensorData-Sensor Association (Many-to-One)
308
+ sensorDataEntity.addAssociation({ key: sensorEntity.key }, {
309
+ info: { name: 'sensor', displayName: 'Sensor', description: 'Sensor for this data' },
310
+ required: true,
311
+ multiple: false,
312
+ });
313
+ // Telemetry Entity
314
+ const telemetryEntity = dataModel.addEntity({
315
+ info: {
316
+ name: 'telemetry',
317
+ displayName: 'Telemetry',
318
+ description: 'Device telemetry and system metrics',
319
+ },
320
+ });
321
+ addIdField(telemetryEntity, { displayName: 'Telemetry ID', description: 'Unique identifier for the telemetry' });
322
+ addNameField(telemetryEntity, { description: 'Telemetry name and description' });
323
+ telemetryEntity.addProperty({
324
+ info: { name: 'timestamp', displayName: 'Timestamp', description: 'Telemetry timestamp' },
325
+ type: 'datetime',
326
+ required: true,
327
+ });
328
+ telemetryEntity.addProperty({
329
+ info: { name: 'metric_type', displayName: 'Metric Type', description: 'Type of telemetry metric' },
330
+ type: 'string',
331
+ required: true,
332
+ schema: {
333
+ enum: ['cpu_usage', 'memory_usage', 'network_traffic', 'battery_level', 'signal_strength', 'temperature'],
334
+ },
335
+ });
336
+ telemetryEntity.addProperty({
337
+ info: { name: 'value', displayName: 'Value', description: 'Telemetry value' },
338
+ type: 'number',
339
+ required: true,
340
+ });
341
+ telemetryEntity.addProperty({
342
+ info: { name: 'unit', displayName: 'Unit', description: 'Measurement unit' },
343
+ type: 'string',
344
+ required: true,
345
+ });
346
+ addCustomStatusField(telemetryEntity, ['normal', 'warning', 'critical'], {
347
+ displayName: 'Telemetry Status',
348
+ description: 'Current status of the telemetry',
349
+ });
350
+ addCreatedAtField(telemetryEntity, { description: 'When the telemetry was created' });
351
+ // Telemetry-Device Association (Many-to-One)
352
+ telemetryEntity.addAssociation({ key: deviceEntity.key }, {
353
+ info: { name: 'device', displayName: 'Device', description: 'Device for this telemetry' },
354
+ required: true,
355
+ multiple: false,
356
+ });
357
+ // Analytics Entity
358
+ const analyticsEntity = dataModel.addEntity({
359
+ info: {
360
+ name: 'analytics',
361
+ displayName: 'Analytics',
362
+ description: 'Data analytics and insights',
363
+ },
364
+ });
365
+ addIdField(analyticsEntity, { displayName: 'Analytics ID', description: 'Unique identifier for the analytics' });
366
+ addNameField(analyticsEntity, { description: 'Analytics name and description' });
367
+ addDescriptionField(analyticsEntity, { description: 'Analytics description and insights' });
368
+ analyticsEntity.addProperty({
369
+ info: { name: 'analytics_type', displayName: 'Analytics Type', description: 'Type of analytics' },
370
+ type: 'string',
371
+ required: true,
372
+ schema: {
373
+ enum: ['trend_analysis', 'pattern_recognition', 'anomaly_detection', 'predictive_modeling', 'usage_statistics'],
374
+ },
375
+ });
376
+ analyticsEntity.addProperty({
377
+ info: { name: 'time_period', displayName: 'Time Period', description: 'Analytics time period' },
378
+ type: 'string',
379
+ required: true,
380
+ schema: {
381
+ enum: ['hourly', 'daily', 'weekly', 'monthly', 'yearly'],
382
+ },
383
+ });
384
+ analyticsEntity.addProperty({
385
+ info: { name: 'start_date', displayName: 'Start Date', description: 'Analytics start date' },
386
+ type: 'date',
387
+ required: true,
388
+ });
389
+ analyticsEntity.addProperty({
390
+ info: { name: 'end_date', displayName: 'End Date', description: 'Analytics end date' },
391
+ type: 'date',
392
+ required: true,
393
+ });
394
+ addCustomStatusField(analyticsEntity, ['processing', 'completed', 'failed'], {
395
+ displayName: 'Analytics Status',
396
+ description: 'Current status of the analytics',
397
+ });
398
+ addCreatedAtField(analyticsEntity, { description: 'When the analytics was created' });
399
+ //
400
+ // 3. AUTOMATION NAMESPACE
401
+ //
402
+ const automation = domain.addNamespace({
403
+ info: {
404
+ name: 'Automation',
405
+ displayName: 'Automation',
406
+ description: 'Rules, triggers, actions, and schedules',
407
+ },
408
+ });
409
+ // Automation Model
410
+ const automationModel = automation.addModel({
411
+ info: {
412
+ name: 'Automation',
413
+ displayName: 'Automation Management',
414
+ description: 'Automation rules and schedules',
415
+ },
416
+ });
417
+ // Rule Entity
418
+ const ruleEntity = automationModel.addEntity({
419
+ info: {
420
+ name: 'rule',
421
+ displayName: 'Rule',
422
+ description: 'Automation rule with conditions and actions',
423
+ },
424
+ });
425
+ addIdField(ruleEntity, { displayName: 'Rule ID', description: 'Unique identifier for the rule' });
426
+ addNameField(ruleEntity, { description: 'Rule name and description' });
427
+ addDescriptionField(ruleEntity, { description: 'Rule description and logic' });
428
+ ruleEntity.addProperty({
429
+ info: { name: 'rule_type', displayName: 'Rule Type', description: 'Type of automation rule' },
430
+ type: 'string',
431
+ required: true,
432
+ schema: {
433
+ enum: ['if_then', 'schedule', 'location_based', 'time_based', 'condition_based'],
434
+ },
435
+ });
436
+ ruleEntity.addProperty({
437
+ info: { name: 'condition', displayName: 'Condition', description: 'Rule condition logic' },
438
+ type: 'string',
439
+ required: true,
440
+ });
441
+ ruleEntity.addProperty({
442
+ info: { name: 'action', displayName: 'Action', description: 'Rule action to execute' },
443
+ type: 'string',
444
+ required: true,
445
+ });
446
+ ruleEntity.addProperty({
447
+ info: { name: 'priority', displayName: 'Priority', description: 'Rule priority level' },
448
+ type: 'string',
449
+ required: true,
450
+ schema: {
451
+ enum: ['low', 'medium', 'high', 'critical'],
452
+ },
453
+ });
454
+ addCustomStatusField(ruleEntity, ['active', 'inactive', 'testing', 'error'], {
455
+ displayName: 'Rule Status',
456
+ description: 'Current status of the rule',
457
+ });
458
+ addCreatedAtField(ruleEntity, { description: 'When the rule was created' });
459
+ // Trigger Entity
460
+ const triggerEntity = automationModel.addEntity({
461
+ info: {
462
+ name: 'trigger',
463
+ displayName: 'Trigger',
464
+ description: 'Automation trigger event',
465
+ },
466
+ });
467
+ addIdField(triggerEntity, { displayName: 'Trigger ID', description: 'Unique identifier for the trigger' });
468
+ addNameField(triggerEntity, { description: 'Trigger name and description' });
469
+ addDescriptionField(triggerEntity, { description: 'Trigger description and conditions' });
470
+ triggerEntity.addProperty({
471
+ info: { name: 'trigger_type', displayName: 'Trigger Type', description: 'Type of trigger' },
472
+ type: 'string',
473
+ required: true,
474
+ schema: {
475
+ enum: ['sensor_threshold', 'time_schedule', 'location_change', 'device_state', 'user_action'],
476
+ },
477
+ });
478
+ triggerEntity.addProperty({
479
+ info: { name: 'condition', displayName: 'Condition', description: 'Trigger condition' },
480
+ type: 'string',
481
+ required: true,
482
+ });
483
+ triggerEntity.addProperty({
484
+ info: { name: 'frequency', displayName: 'Frequency', description: 'Trigger frequency' },
485
+ type: 'string',
486
+ required: false,
487
+ schema: {
488
+ enum: ['once', 'recurring', 'continuous'],
489
+ },
490
+ });
491
+ addCustomStatusField(triggerEntity, ['active', 'inactive', 'paused'], {
492
+ displayName: 'Trigger Status',
493
+ description: 'Current status of the trigger',
494
+ });
495
+ addCreatedAtField(triggerEntity, { description: 'When the trigger was created' });
496
+ // Trigger-Rule Association (Many-to-One)
497
+ triggerEntity.addAssociation({ key: ruleEntity.key }, {
498
+ info: { name: 'rule', displayName: 'Rule', description: 'Rule for this trigger' },
499
+ required: true,
500
+ multiple: false,
501
+ });
502
+ // Action Entity
503
+ const actionEntity = automationModel.addEntity({
504
+ info: {
505
+ name: 'action',
506
+ displayName: 'Action',
507
+ description: 'Automation action to execute',
508
+ },
509
+ });
510
+ addIdField(actionEntity, { displayName: 'Action ID', description: 'Unique identifier for the action' });
511
+ addNameField(actionEntity, { description: 'Action name and description' });
512
+ addDescriptionField(actionEntity, { description: 'Action description and parameters' });
513
+ actionEntity.addProperty({
514
+ info: { name: 'action_type', displayName: 'Action Type', description: 'Type of action' },
515
+ type: 'string',
516
+ required: true,
517
+ schema: {
518
+ enum: ['device_control', 'notification', 'data_logging', 'api_call', 'script_execution'],
519
+ },
520
+ });
521
+ actionEntity.addProperty({
522
+ info: { name: 'parameters', displayName: 'Parameters', description: 'Action parameters' },
523
+ type: 'string',
524
+ required: false,
525
+ });
526
+ actionEntity.addProperty({
527
+ info: { name: 'delay', displayName: 'Delay', description: 'Action delay in seconds' },
528
+ type: 'number',
529
+ required: false,
530
+ schema: {
531
+ minimum: 0,
532
+ },
533
+ });
534
+ addCustomStatusField(actionEntity, ['pending', 'executing', 'completed', 'failed'], {
535
+ displayName: 'Action Status',
536
+ description: 'Current status of the action',
537
+ });
538
+ addCreatedAtField(actionEntity, { description: 'When the action was created' });
539
+ // Action-Rule Association (Many-to-One)
540
+ actionEntity.addAssociation({ key: ruleEntity.key }, {
541
+ info: { name: 'rule', displayName: 'Rule', description: 'Rule for this action' },
542
+ required: true,
543
+ multiple: false,
544
+ });
545
+ // Schedule Entity
546
+ const scheduleEntity = automationModel.addEntity({
547
+ info: {
548
+ name: 'schedule',
549
+ displayName: 'Schedule',
550
+ description: 'Automation schedule',
551
+ },
552
+ });
553
+ addIdField(scheduleEntity, { displayName: 'Schedule ID', description: 'Unique identifier for the schedule' });
554
+ addNameField(scheduleEntity, { description: 'Schedule name and description' });
555
+ addDescriptionField(scheduleEntity, { description: 'Schedule description and timing' });
556
+ scheduleEntity.addProperty({
557
+ info: { name: 'schedule_type', displayName: 'Schedule Type', description: 'Type of schedule' },
558
+ type: 'string',
559
+ required: true,
560
+ schema: {
561
+ enum: ['daily', 'weekly', 'monthly', 'custom', 'sunrise_sunset'],
562
+ },
563
+ });
564
+ scheduleEntity.addProperty({
565
+ info: { name: 'start_time', displayName: 'Start Time', description: 'Schedule start time' },
566
+ type: 'time',
567
+ required: true,
568
+ });
569
+ scheduleEntity.addProperty({
570
+ info: { name: 'end_time', displayName: 'End Time', description: 'Schedule end time' },
571
+ type: 'time',
572
+ required: false,
573
+ });
574
+ scheduleEntity.addProperty({
575
+ info: { name: 'days_of_week', displayName: 'Days of Week', description: 'Days of week for schedule' },
576
+ type: 'string',
577
+ required: false,
578
+ });
579
+ addCustomStatusField(scheduleEntity, ['active', 'inactive', 'paused'], {
580
+ displayName: 'Schedule Status',
581
+ description: 'Current status of the schedule',
582
+ });
583
+ addCreatedAtField(scheduleEntity, { description: 'When the schedule was created' });
584
+ // Schedule-Rule Association (Many-to-One)
585
+ scheduleEntity.addAssociation({ key: ruleEntity.key }, {
586
+ info: { name: 'rule', displayName: 'Rule', description: 'Rule for this schedule' },
587
+ required: true,
588
+ multiple: false,
589
+ });
590
+ //
591
+ // 4. USER MANAGEMENT NAMESPACE
592
+ //
593
+ const userManagement = domain.addNamespace({
594
+ info: {
595
+ name: 'UserManagement',
596
+ displayName: 'User Management',
597
+ description: 'Users, permissions, and device access',
598
+ },
599
+ });
600
+ // User Model
601
+ const userModel = userManagement.addModel({
602
+ info: {
603
+ name: 'Users',
604
+ displayName: 'User Management',
605
+ description: 'User accounts and permissions',
606
+ },
607
+ });
608
+ // User Entity
609
+ const userEntity = userModel.addEntity({
610
+ info: {
611
+ name: 'user',
612
+ displayName: 'User',
613
+ description: 'System user with access permissions',
614
+ },
615
+ });
616
+ addIdField(userEntity, { displayName: 'User ID', description: 'Unique identifier for the user' });
617
+ addNameField(userEntity, { description: 'User name and title' });
618
+ addDescriptionField(userEntity, { description: 'User description and notes' });
619
+ addEmailField(userEntity, { description: 'User email address' });
620
+ addPhoneField(userEntity, { description: 'User phone number' });
621
+ userEntity.addProperty({
622
+ info: { name: 'user_type', displayName: 'User Type', description: 'Type of user' },
623
+ type: 'string',
624
+ required: true,
625
+ schema: {
626
+ enum: ['owner', 'admin', 'family_member', 'guest', 'service_account'],
627
+ },
628
+ });
629
+ userEntity.addProperty({
630
+ info: { name: 'username', displayName: 'Username', description: 'User login username' },
631
+ type: 'string',
632
+ required: true,
633
+ unique: true,
634
+ });
635
+ userEntity.addProperty({
636
+ info: { name: 'last_login', displayName: 'Last Login', description: 'User last login date' },
637
+ type: 'datetime',
638
+ required: false,
639
+ });
640
+ addCustomStatusField(userEntity, ['active', 'inactive', 'suspended', 'pending'], {
641
+ displayName: 'User Status',
642
+ description: 'Current status of the user',
643
+ });
644
+ addCreatedAtField(userEntity, { description: 'When the user was created' });
645
+ addUpdatedAtField(userEntity, { description: 'When the user was last updated' });
646
+ // Permission Entity
647
+ const permissionEntity = userModel.addEntity({
648
+ info: {
649
+ name: 'permission',
650
+ displayName: 'Permission',
651
+ description: 'User permissions and access rights',
652
+ },
653
+ });
654
+ addIdField(permissionEntity, {
655
+ displayName: 'Permission ID',
656
+ description: 'Unique identifier for the permission',
657
+ });
658
+ addNameField(permissionEntity, { description: 'Permission name and description' });
659
+ addDescriptionField(permissionEntity, { description: 'Permission description and scope' });
660
+ permissionEntity.addProperty({
661
+ info: { name: 'permission_type', displayName: 'Permission Type', description: 'Type of permission' },
662
+ type: 'string',
663
+ required: true,
664
+ schema: {
665
+ enum: ['read', 'write', 'admin', 'control', 'view', 'configure'],
666
+ },
667
+ });
668
+ permissionEntity.addProperty({
669
+ info: { name: 'resource', displayName: 'Resource', description: 'Resource for permission' },
670
+ type: 'string',
671
+ required: true,
672
+ });
673
+ permissionEntity.addProperty({
674
+ info: { name: 'scope', displayName: 'Scope', description: 'Permission scope' },
675
+ type: 'string',
676
+ required: true,
677
+ schema: {
678
+ enum: ['all', 'specific', 'room', 'device', 'system'],
679
+ },
680
+ });
681
+ addCustomStatusField(permissionEntity, ['active', 'inactive', 'temporary'], {
682
+ displayName: 'Permission Status',
683
+ description: 'Current status of the permission',
684
+ });
685
+ addCreatedAtField(permissionEntity, { description: 'When the permission was created' });
686
+ // Permission-User Association (Many-to-One)
687
+ permissionEntity.addAssociation({ key: userEntity.key }, {
688
+ info: { name: 'user', displayName: 'User', description: 'User for this permission' },
689
+ required: true,
690
+ multiple: false,
691
+ });
692
+ // Device Access Entity
693
+ const deviceAccessEntity = userModel.addEntity({
694
+ info: {
695
+ name: 'device_access',
696
+ displayName: 'Device Access',
697
+ description: 'User access to specific devices',
698
+ },
699
+ });
700
+ addIdField(deviceAccessEntity, {
701
+ displayName: 'Access ID',
702
+ description: 'Unique identifier for the device access',
703
+ });
704
+ addNameField(deviceAccessEntity, { description: 'Access name and description' });
705
+ deviceAccessEntity.addProperty({
706
+ info: { name: 'access_type', displayName: 'Access Type', description: 'Type of device access' },
707
+ type: 'string',
708
+ required: true,
709
+ schema: {
710
+ enum: ['full_control', 'read_only', 'limited_control', 'monitor_only'],
711
+ },
712
+ });
713
+ deviceAccessEntity.addProperty({
714
+ info: { name: 'granted_date', displayName: 'Granted Date', description: 'Access granted date' },
715
+ type: 'date',
716
+ required: true,
717
+ });
718
+ deviceAccessEntity.addProperty({
719
+ info: { name: 'expiry_date', displayName: 'Expiry Date', description: 'Access expiry date' },
720
+ type: 'date',
721
+ required: false,
722
+ });
723
+ addCustomStatusField(deviceAccessEntity, ['active', 'expired', 'revoked'], {
724
+ displayName: 'Access Status',
725
+ description: 'Current status of the device access',
726
+ });
727
+ addCreatedAtField(deviceAccessEntity, { description: 'When the access was created' });
728
+ // DeviceAccess-User Association (Many-to-One)
729
+ deviceAccessEntity.addAssociation({ key: userEntity.key }, {
730
+ info: { name: 'user', displayName: 'User', description: 'User for this device access' },
731
+ required: true,
732
+ multiple: false,
733
+ });
734
+ // DeviceAccess-Device Association (Many-to-One)
735
+ deviceAccessEntity.addAssociation({ key: deviceEntity.key }, {
736
+ info: { name: 'device', displayName: 'Device', description: 'Device for this access' },
737
+ required: true,
738
+ multiple: false,
739
+ });
740
+ //
741
+ // 5. MONITORING NAMESPACE
742
+ //
743
+ const monitoring = domain.addNamespace({
744
+ info: {
745
+ name: 'Monitoring',
746
+ displayName: 'Monitoring',
747
+ description: 'Alerts, notifications, and health status',
748
+ },
749
+ });
750
+ // Monitoring Model
751
+ const monitoringModel = monitoring.addModel({
752
+ info: {
753
+ name: 'Monitoring',
754
+ displayName: 'Monitoring Management',
755
+ description: 'System monitoring and alerting',
756
+ },
757
+ });
758
+ // Alert Entity
759
+ const alertEntity = monitoringModel.addEntity({
760
+ info: {
761
+ name: 'alert',
762
+ displayName: 'Alert',
763
+ description: 'System alert or notification',
764
+ },
765
+ });
766
+ addIdField(alertEntity, { displayName: 'Alert ID', description: 'Unique identifier for the alert' });
767
+ addNameField(alertEntity, { description: 'Alert name and title' });
768
+ addDescriptionField(alertEntity, { description: 'Alert description and details' });
769
+ alertEntity.addProperty({
770
+ info: { name: 'alert_type', displayName: 'Alert Type', description: 'Type of alert' },
771
+ type: 'string',
772
+ required: true,
773
+ schema: {
774
+ enum: ['error', 'warning', 'info', 'critical', 'maintenance'],
775
+ },
776
+ });
777
+ alertEntity.addProperty({
778
+ info: { name: 'severity', displayName: 'Severity', description: 'Alert severity level' },
779
+ type: 'string',
780
+ required: true,
781
+ schema: {
782
+ enum: ['low', 'medium', 'high', 'critical'],
783
+ },
784
+ });
785
+ alertEntity.addProperty({
786
+ info: { name: 'triggered_at', displayName: 'Triggered At', description: 'Alert trigger time' },
787
+ type: 'datetime',
788
+ required: true,
789
+ });
790
+ alertEntity.addProperty({
791
+ info: { name: 'resolved_at', displayName: 'Resolved At', description: 'Alert resolution time' },
792
+ type: 'datetime',
793
+ required: false,
794
+ });
795
+ addCustomStatusField(alertEntity, ['active', 'acknowledged', 'resolved', 'dismissed'], {
796
+ displayName: 'Alert Status',
797
+ description: 'Current status of the alert',
798
+ });
799
+ addCreatedAtField(alertEntity, { description: 'When the alert was created' });
800
+ // Alert-Device Association (Many-to-One)
801
+ alertEntity.addAssociation({ key: deviceEntity.key }, {
802
+ info: { name: 'device', displayName: 'Device', description: 'Device for this alert' },
803
+ required: false,
804
+ multiple: false,
805
+ });
806
+ // Notification Entity
807
+ const notificationEntity = monitoringModel.addEntity({
808
+ info: {
809
+ name: 'notification',
810
+ displayName: 'Notification',
811
+ description: 'User notification message',
812
+ },
813
+ });
814
+ addIdField(notificationEntity, {
815
+ displayName: 'Notification ID',
816
+ description: 'Unique identifier for the notification',
817
+ });
818
+ addNameField(notificationEntity, { description: 'Notification name and title' });
819
+ addDescriptionField(notificationEntity, { description: 'Notification message content' });
820
+ notificationEntity.addProperty({
821
+ info: { name: 'notification_type', displayName: 'Notification Type', description: 'Type of notification' },
822
+ type: 'string',
823
+ required: true,
824
+ schema: {
825
+ enum: ['email', 'sms', 'push', 'in_app', 'webhook'],
826
+ },
827
+ });
828
+ notificationEntity.addProperty({
829
+ info: { name: 'recipient', displayName: 'Recipient', description: 'Notification recipient' },
830
+ type: 'string',
831
+ required: true,
832
+ });
833
+ notificationEntity.addProperty({
834
+ info: { name: 'sent_at', displayName: 'Sent At', description: 'Notification sent time' },
835
+ type: 'datetime',
836
+ required: true,
837
+ });
838
+ notificationEntity.addProperty({
839
+ info: { name: 'read_at', displayName: 'Read At', description: 'Notification read time' },
840
+ type: 'datetime',
841
+ required: false,
842
+ });
843
+ addCustomStatusField(notificationEntity, ['pending', 'sent', 'delivered', 'read', 'failed'], {
844
+ displayName: 'Notification Status',
845
+ description: 'Current status of the notification',
846
+ });
847
+ addCreatedAtField(notificationEntity, { description: 'When the notification was created' });
848
+ // Notification-User Association (Many-to-One)
849
+ notificationEntity.addAssociation({ key: userEntity.key }, {
850
+ info: { name: 'user', displayName: 'User', description: 'User for this notification' },
851
+ required: true,
852
+ multiple: false,
853
+ });
854
+ // Health Status Entity
855
+ const healthStatusEntity = monitoringModel.addEntity({
856
+ info: {
857
+ name: 'health_status',
858
+ displayName: 'Health Status',
859
+ description: 'System and device health status',
860
+ },
861
+ });
862
+ addIdField(healthStatusEntity, {
863
+ displayName: 'Health ID',
864
+ description: 'Unique identifier for the health status',
865
+ });
866
+ addNameField(healthStatusEntity, { description: 'Health status name and description' });
867
+ healthStatusEntity.addProperty({
868
+ info: { name: 'health_type', displayName: 'Health Type', description: 'Type of health status' },
869
+ type: 'string',
870
+ required: true,
871
+ schema: {
872
+ enum: ['system', 'device', 'network', 'battery', 'connectivity'],
873
+ },
874
+ });
875
+ healthStatusEntity.addProperty({
876
+ info: { name: 'check_time', displayName: 'Check Time', description: 'Health check time' },
877
+ type: 'datetime',
878
+ required: true,
879
+ });
880
+ healthStatusEntity.addProperty({
881
+ info: { name: 'score', displayName: 'Score', description: 'Health score (0-100)' },
882
+ type: 'number',
883
+ required: true,
884
+ schema: {
885
+ minimum: 0,
886
+ maximum: 100,
887
+ },
888
+ });
889
+ addCustomStatusField(healthStatusEntity, ['excellent', 'good', 'fair', 'poor', 'critical'], {
890
+ displayName: 'Health Status',
891
+ description: 'Current health status',
892
+ });
893
+ addCreatedAtField(healthStatusEntity, { description: 'When the health status was created' });
894
+ // HealthStatus-Device Association (Many-to-One)
895
+ healthStatusEntity.addAssociation({ key: deviceEntity.key }, {
896
+ info: { name: 'device', displayName: 'Device', description: 'Device for this health status' },
897
+ required: false,
898
+ multiple: false,
899
+ });
900
+ //
901
+ // 6. INTEGRATION NAMESPACE
902
+ //
903
+ const integration = domain.addNamespace({
904
+ info: {
905
+ name: 'Integration',
906
+ displayName: 'Integration',
907
+ description: 'Third-party services, APIs, and protocols',
908
+ },
909
+ });
910
+ // Integration Model
911
+ const integrationModel = integration.addModel({
912
+ info: {
913
+ name: 'Integrations',
914
+ displayName: 'Integration Management',
915
+ description: 'Third-party integrations and APIs',
916
+ },
917
+ });
918
+ // Integration Entity
919
+ const integrationEntity = integrationModel.addEntity({
920
+ info: {
921
+ name: 'integration',
922
+ displayName: 'Integration',
923
+ description: 'Third-party service integration',
924
+ },
925
+ });
926
+ addIdField(integrationEntity, {
927
+ displayName: 'Integration ID',
928
+ description: 'Unique identifier for the integration',
929
+ });
930
+ addNameField(integrationEntity, { description: 'Integration name and description' });
931
+ addDescriptionField(integrationEntity, { description: 'Integration description and capabilities' });
932
+ integrationEntity.addProperty({
933
+ info: { name: 'integration_type', displayName: 'Integration Type', description: 'Type of integration' },
934
+ type: 'string',
935
+ required: true,
936
+ schema: {
937
+ enum: ['api', 'webhook', 'protocol', 'service', 'platform'],
938
+ },
939
+ });
940
+ integrationEntity.addProperty({
941
+ info: { name: 'provider', displayName: 'Provider', description: 'Integration provider' },
942
+ type: 'string',
943
+ required: true,
944
+ });
945
+ integrationEntity.addProperty({
946
+ info: { name: 'endpoint_url', displayName: 'Endpoint URL', description: 'Integration endpoint URL' },
947
+ type: 'string',
948
+ required: false,
949
+ });
950
+ integrationEntity.addProperty({
951
+ info: { name: 'api_key', displayName: 'API Key', description: 'Integration API key' },
952
+ type: 'string',
953
+ required: false,
954
+ });
955
+ integrationEntity.addProperty({
956
+ info: { name: 'protocol', displayName: 'Protocol', description: 'Integration protocol' },
957
+ type: 'string',
958
+ required: false,
959
+ schema: {
960
+ enum: ['http', 'https', 'mqtt', 'coap', 'websocket', 'tcp'],
961
+ },
962
+ });
963
+ addCustomStatusField(integrationEntity, ['active', 'inactive', 'testing', 'error'], {
964
+ displayName: 'Integration Status',
965
+ description: 'Current status of the integration',
966
+ });
967
+ addCreatedAtField(integrationEntity, { description: 'When the integration was created' });
968
+ // API Call Entity
969
+ const apiCallEntity = integrationModel.addEntity({
970
+ info: {
971
+ name: 'api_call',
972
+ displayName: 'API Call',
973
+ description: 'API call to third-party service',
974
+ },
975
+ });
976
+ addIdField(apiCallEntity, { displayName: 'Call ID', description: 'Unique identifier for the API call' });
977
+ addNameField(apiCallEntity, { description: 'API call name and description' });
978
+ apiCallEntity.addProperty({
979
+ info: { name: 'endpoint', displayName: 'Endpoint', description: 'API endpoint' },
980
+ type: 'string',
981
+ required: true,
982
+ });
983
+ apiCallEntity.addProperty({
984
+ info: { name: 'method', displayName: 'Method', description: 'HTTP method' },
985
+ type: 'string',
986
+ required: true,
987
+ schema: {
988
+ enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
989
+ },
990
+ });
991
+ apiCallEntity.addProperty({
992
+ info: { name: 'request_data', displayName: 'Request Data', description: 'API request data' },
993
+ type: 'string',
994
+ required: false,
995
+ });
996
+ apiCallEntity.addProperty({
997
+ info: { name: 'response_data', displayName: 'Response Data', description: 'API response data' },
998
+ type: 'string',
999
+ required: false,
1000
+ });
1001
+ apiCallEntity.addProperty({
1002
+ info: { name: 'response_code', displayName: 'Response Code', description: 'HTTP response code' },
1003
+ type: 'number',
1004
+ required: false,
1005
+ });
1006
+ apiCallEntity.addProperty({
1007
+ info: { name: 'duration', displayName: 'Duration', description: 'API call duration in milliseconds' },
1008
+ type: 'number',
1009
+ required: false,
1010
+ schema: {
1011
+ minimum: 0,
1012
+ },
1013
+ });
1014
+ addCustomStatusField(apiCallEntity, ['pending', 'in_progress', 'completed', 'failed', 'timeout'], {
1015
+ displayName: 'Call Status',
1016
+ description: 'Current status of the API call',
1017
+ });
1018
+ addCreatedAtField(apiCallEntity, { description: 'When the API call was created' });
1019
+ // ApiCall-Integration Association (Many-to-One)
1020
+ apiCallEntity.addAssociation({ key: integrationEntity.key }, {
1021
+ info: { name: 'integration', displayName: 'Integration', description: 'Integration for this API call' },
1022
+ required: true,
1023
+ multiple: false,
1024
+ });
1025
+ return domain;
1026
+ }
1027
+ //# sourceMappingURL=iot-smart-home-domain.js.map