@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,859 @@
1
+ /**
2
+ * Healthcare Data Domain Example
3
+ *
4
+ * This file demonstrates how to create a comprehensive healthcare data domain
5
+ * using the API Client Core modeling system. It follows the business-first approach
6
+ * and demonstrates proper use of namespaces, models, entities, properties,
7
+ * associations, and semantic annotations.
8
+ *
9
+ * The example includes:
10
+ * - Patient Management with demographics, medical history, and contact information
11
+ * - Provider Management with doctors, nurses, specialists, and facilities
12
+ * - Appointment Scheduling with availability, booking, and scheduling rules
13
+ * - Medical Records with diagnoses, treatments, prescriptions, and lab results
14
+ * - Insurance & Billing with claims, coverage, and payment processing
15
+ * - Compliance features for HIPAA, audit trails, and data privacy
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * import { createHealthcareDomain } from './healthcare-domain.js'
20
+ *
21
+ * const domain = createHealthcareDomain()
22
+ * console.log('Healthcare domain created with', domain.graph.nodeCount(), 'nodes')
23
+ * ```
24
+ */
25
+ import { DataDomain } from '../../../DataDomain.js';
26
+ import { createSummarySemantic } from '../../../definitions/Summary.js';
27
+ import { addIdField, addNameField, addDescriptionField, addEmailField, addFirstNameField, addLastNameField, addPhoneField, addCustomStatusField, addCreatedAtField, addUpdatedAtField, addBooleanField, addCurrencyAmountField, } from '../../../helpers/Intelisense.js';
28
+ function createDomain() {
29
+ return new DataDomain({
30
+ info: {
31
+ name: 'Healthcare Management Platform',
32
+ displayName: 'Healthcare Management Platform',
33
+ description: 'A comprehensive healthcare management platform with patient care, provider management, ' +
34
+ 'appointment scheduling, and medical records',
35
+ },
36
+ });
37
+ }
38
+ /**
39
+ * Creates a comprehensive healthcare data domain following domain-driven design principles.
40
+ *
41
+ * This function demonstrates the proper hierarchy and organization for a healthcare platform:
42
+ * 1. Creates the root DataDomain for the healthcare platform
43
+ * 2. Organizes functionality into logical namespaces (Patient Care, Provider Management, etc.)
44
+ * 3. Groups related entities into models within each namespace
45
+ * 4. Defines entities with proper semantic annotations for healthcare workflows
46
+ * 5. Establishes associations with appropriate cardinality for patient-provider relationships
47
+ *
48
+ * @returns A fully configured DataDomain with all healthcare entities and relationships
49
+ */
50
+ export default function createHealthcareDomain(options = {}) {
51
+ // Ensure the root data domain
52
+ const domain = options.domain ?? createDomain();
53
+ //
54
+ // 1. PATIENT CARE NAMESPACE
55
+ //
56
+ const patientCare = domain.addNamespace({
57
+ info: {
58
+ name: 'PatientCare',
59
+ displayName: 'Patient Care',
60
+ description: 'Patient management, demographics, and medical history',
61
+ },
62
+ });
63
+ // Patient Management Model
64
+ const patientModel = patientCare.addModel({
65
+ info: {
66
+ name: 'Patients',
67
+ displayName: 'Patient Management',
68
+ description: 'Patient records and demographic information',
69
+ },
70
+ });
71
+ // Patient Entity
72
+ const patientEntity = patientModel.addEntity({
73
+ info: {
74
+ name: 'patient',
75
+ displayName: 'Patient',
76
+ description: 'Patient record with demographic and medical information',
77
+ },
78
+ });
79
+ addIdField(patientEntity, { displayName: 'Patient ID', description: 'Unique identifier for the patient' });
80
+ patientEntity.addProperty({
81
+ info: { name: 'mrn', displayName: 'Medical Record Number', description: 'Medical record number for the patient' },
82
+ type: 'string',
83
+ required: true,
84
+ unique: true,
85
+ schema: { defaultValue: { type: 'function', value: 'uuid-v4' } },
86
+ });
87
+ addFirstNameField(patientEntity, { description: 'Patient first name' });
88
+ addLastNameField(patientEntity, { description: 'Patient last name' });
89
+ patientEntity.addProperty({
90
+ info: { name: 'date_of_birth', displayName: 'Date of Birth', description: 'Patient date of birth' },
91
+ type: 'date',
92
+ required: true,
93
+ });
94
+ patientEntity.addProperty({
95
+ info: { name: 'gender', displayName: 'Gender', description: 'Patient gender identity' },
96
+ type: 'string',
97
+ required: true,
98
+ schema: {
99
+ enum: ['male', 'female', 'other', 'prefer_not_to_say'],
100
+ },
101
+ });
102
+ addPhoneField(patientEntity, { description: 'Patient primary phone number' });
103
+ addEmailField(patientEntity, { description: 'Patient email address' });
104
+ patientEntity.addProperty({
105
+ info: {
106
+ name: 'emergency_contact_name',
107
+ displayName: 'Emergency Contact Name',
108
+ description: 'Name of emergency contact',
109
+ },
110
+ type: 'string',
111
+ });
112
+ addPhoneField(patientEntity, {
113
+ name: 'emergency_contact_phone',
114
+ displayName: 'Emergency Contact Phone',
115
+ description: 'Phone number of emergency contact',
116
+ });
117
+ patientEntity.addProperty({
118
+ info: { name: 'blood_type', displayName: 'Blood Type', description: 'Patient blood type' },
119
+ type: 'string',
120
+ schema: {
121
+ enum: ['A+', 'A-', 'B+', 'B-', 'AB+', 'AB-', 'O+', 'O-'],
122
+ },
123
+ });
124
+ patientEntity.addProperty({
125
+ info: { name: 'allergies', displayName: 'Allergies', description: 'Known allergies and reactions' },
126
+ type: 'string',
127
+ });
128
+ patientEntity.addProperty({
129
+ info: { name: 'medical_history', displayName: 'Medical History', description: 'Summary of medical history' },
130
+ type: 'string',
131
+ semantics: [createSummarySemantic()],
132
+ });
133
+ addCustomStatusField(patientEntity, ['active', 'inactive', 'deceased'], {
134
+ displayName: 'Patient Status',
135
+ description: 'Current status of the patient',
136
+ });
137
+ addCreatedAtField(patientEntity, { description: 'When the patient record was created' });
138
+ addUpdatedAtField(patientEntity, { description: 'When the patient record was last updated' });
139
+ // Address Entity
140
+ const addressEntity = patientModel.addEntity({
141
+ info: {
142
+ name: 'address',
143
+ displayName: 'Address',
144
+ description: 'Patient address information',
145
+ },
146
+ });
147
+ addIdField(addressEntity, { displayName: 'Address ID', description: 'Unique identifier for the address' });
148
+ addressEntity.addProperty({
149
+ info: { name: 'type', displayName: 'Address Type', description: 'Type of address (home, work, billing)' },
150
+ type: 'string',
151
+ required: true,
152
+ schema: {
153
+ enum: ['home', 'work', 'billing', 'mailing'],
154
+ },
155
+ });
156
+ addressEntity.addProperty({
157
+ info: { name: 'line1', displayName: 'Address Line 1', description: 'Primary street address' },
158
+ type: 'string',
159
+ required: true,
160
+ });
161
+ addressEntity.addProperty({
162
+ info: { name: 'line2', displayName: 'Address Line 2', description: 'Secondary address information' },
163
+ type: 'string',
164
+ });
165
+ addressEntity.addProperty({
166
+ info: { name: 'city', displayName: 'City', description: 'City name' },
167
+ type: 'string',
168
+ required: true,
169
+ });
170
+ addressEntity.addProperty({
171
+ info: { name: 'state', displayName: 'State/Province', description: 'State or province' },
172
+ type: 'string',
173
+ required: true,
174
+ });
175
+ addressEntity.addProperty({
176
+ info: { name: 'postal_code', displayName: 'ZIP/Postal Code', description: 'ZIP or postal code' },
177
+ type: 'string',
178
+ required: true,
179
+ });
180
+ addressEntity.addProperty({
181
+ info: { name: 'country', displayName: 'Country', description: 'Country name' },
182
+ type: 'string',
183
+ required: true,
184
+ });
185
+ // Patient-Address Association (One-to-Many)
186
+ patientEntity.addAssociation({ key: addressEntity.key }, {
187
+ info: {
188
+ name: 'addresses',
189
+ displayName: 'Patient Addresses',
190
+ description: 'Addresses associated with the patient',
191
+ },
192
+ required: false,
193
+ multiple: true,
194
+ });
195
+ //
196
+ // 2. PROVIDER MANAGEMENT NAMESPACE
197
+ //
198
+ const providerManagement = domain.addNamespace({
199
+ info: {
200
+ name: 'ProviderManagement',
201
+ displayName: 'Provider Management',
202
+ description: 'Healthcare providers, staff, and facility management',
203
+ },
204
+ });
205
+ // Provider Model
206
+ const providerModel = providerManagement.addModel({
207
+ info: {
208
+ name: 'Providers',
209
+ displayName: 'Provider Management',
210
+ description: 'Healthcare providers and staff',
211
+ },
212
+ });
213
+ // Provider Entity
214
+ const providerEntity = providerModel.addEntity({
215
+ info: {
216
+ name: 'provider',
217
+ displayName: 'Healthcare Provider',
218
+ description: 'Healthcare provider or medical staff member',
219
+ },
220
+ });
221
+ addIdField(providerEntity, { displayName: 'Provider ID', description: 'Unique identifier for the provider' });
222
+ addFirstNameField(providerEntity, { description: 'Provider first name' });
223
+ addLastNameField(providerEntity, { description: 'Provider last name' });
224
+ providerEntity.addProperty({
225
+ info: { name: 'npi', displayName: 'NPI Number', description: 'National Provider Identifier' },
226
+ type: 'string',
227
+ required: true,
228
+ unique: true,
229
+ });
230
+ providerEntity.addProperty({
231
+ info: { name: 'license_number', displayName: 'License Number', description: 'Medical license number' },
232
+ type: 'string',
233
+ required: true,
234
+ });
235
+ addEmailField(providerEntity, { description: 'Provider email address' });
236
+ addPhoneField(providerEntity, { description: 'Provider phone number' });
237
+ addCustomStatusField(providerEntity, ['active', 'inactive', 'suspended'], {
238
+ displayName: 'Provider Status',
239
+ description: 'Current status of the provider',
240
+ });
241
+ providerEntity.addProperty({
242
+ info: { name: 'provider_type', displayName: 'Provider Type', description: 'Type of healthcare provider' },
243
+ type: 'string',
244
+ required: true,
245
+ schema: {
246
+ enum: ['doctor', 'nurse', 'specialist', 'therapist', 'technician'],
247
+ },
248
+ });
249
+ providerEntity.addProperty({
250
+ info: {
251
+ name: 'specialty',
252
+ displayName: 'Medical Specialty',
253
+ description: 'Medical specialty or area of expertise',
254
+ },
255
+ type: 'string',
256
+ required: false,
257
+ schema: {
258
+ enum: ['cardiology', 'dermatology', 'neurology', 'orthopedics', 'pediatrics', 'general'],
259
+ },
260
+ });
261
+ addCreatedAtField(providerEntity, { description: 'When the provider record was created' });
262
+ addUpdatedAtField(providerEntity, { description: 'When the provider record was last updated' });
263
+ // Facility Entity
264
+ const facilityEntity = providerModel.addEntity({
265
+ info: {
266
+ name: 'facility',
267
+ displayName: 'Healthcare Facility',
268
+ description: 'Hospital, clinic, or medical facility',
269
+ },
270
+ });
271
+ addIdField(facilityEntity, { displayName: 'Facility ID', description: 'Unique identifier for the facility' });
272
+ addNameField(facilityEntity, { displayName: 'Facility Name', description: 'Name of the healthcare facility' });
273
+ addDescriptionField(facilityEntity, { description: 'Description of the facility and services offered' });
274
+ facilityEntity.addProperty({
275
+ info: { name: 'facility_type', displayName: 'Facility Type', description: 'Type of healthcare facility' },
276
+ type: 'string',
277
+ required: true,
278
+ schema: {
279
+ enum: ['hospital', 'clinic', 'urgent_care', 'specialty_center', 'laboratory'],
280
+ },
281
+ });
282
+ addPhoneField(facilityEntity, { description: 'Facility phone number' });
283
+ facilityEntity.addProperty({
284
+ info: { name: 'address', displayName: 'Facility Address', description: 'Physical address of the facility' },
285
+ type: 'string',
286
+ required: true,
287
+ });
288
+ addCustomStatusField(facilityEntity, ['active', 'inactive', 'temporary_closed'], {
289
+ displayName: 'Facility Status',
290
+ description: 'Current status of the facility',
291
+ });
292
+ addCreatedAtField(facilityEntity, { description: 'When the facility record was created' });
293
+ // Provider-Facility Association (Many-to-Many)
294
+ providerEntity.addAssociation({ key: facilityEntity.key }, {
295
+ info: {
296
+ name: 'facilities',
297
+ displayName: 'Provider Facilities',
298
+ description: 'Facilities where this provider works',
299
+ },
300
+ required: false,
301
+ multiple: true,
302
+ });
303
+ //
304
+ // 3. APPOINTMENT SCHEDULING NAMESPACE
305
+ //
306
+ const appointmentScheduling = domain.addNamespace({
307
+ info: {
308
+ name: 'AppointmentScheduling',
309
+ displayName: 'Appointment Scheduling',
310
+ description: 'Appointment booking, scheduling, and availability management',
311
+ },
312
+ });
313
+ // Appointment Model
314
+ const appointmentModel = appointmentScheduling.addModel({
315
+ info: {
316
+ name: 'Appointments',
317
+ displayName: 'Appointment Management',
318
+ description: 'Patient appointments and scheduling',
319
+ },
320
+ });
321
+ // Appointment Entity
322
+ const appointmentEntity = appointmentModel.addEntity({
323
+ info: {
324
+ name: 'appointment',
325
+ displayName: 'Appointment',
326
+ description: 'Patient appointment with healthcare provider',
327
+ },
328
+ });
329
+ addIdField(appointmentEntity, { displayName: 'Appointment ID', description: 'Unique identifier for the appointment' });
330
+ appointmentEntity.addProperty({
331
+ info: { name: 'appointment_date', displayName: 'Appointment Date', description: 'Date of the appointment' },
332
+ type: 'date',
333
+ required: true,
334
+ });
335
+ appointmentEntity.addProperty({
336
+ info: { name: 'start_time', displayName: 'Start Time', description: 'Appointment start time' },
337
+ type: 'time',
338
+ required: true,
339
+ });
340
+ appointmentEntity.addProperty({
341
+ info: { name: 'end_time', displayName: 'End Time', description: 'Appointment end time' },
342
+ type: 'time',
343
+ required: true,
344
+ });
345
+ appointmentEntity.addProperty({
346
+ info: {
347
+ name: 'duration_minutes',
348
+ displayName: 'Duration (Minutes)',
349
+ description: 'Appointment duration in minutes',
350
+ },
351
+ type: 'number',
352
+ required: true,
353
+ schema: {
354
+ minimum: 15,
355
+ maximum: 480,
356
+ },
357
+ });
358
+ addCustomStatusField(appointmentEntity, ['scheduled', 'confirmed', 'in_progress', 'completed', 'cancelled', 'no_show'], {
359
+ displayName: 'Appointment Status',
360
+ description: 'Current status of the appointment',
361
+ });
362
+ appointmentEntity.addProperty({
363
+ info: { name: 'reason', displayName: 'Appointment Reason', description: 'Reason for the appointment' },
364
+ type: 'string',
365
+ });
366
+ appointmentEntity.addProperty({
367
+ info: { name: 'notes', displayName: 'Appointment Notes', description: 'Additional notes for the appointment' },
368
+ type: 'string',
369
+ });
370
+ addCreatedAtField(appointmentEntity, { description: 'When the appointment was created' });
371
+ addUpdatedAtField(appointmentEntity, { description: 'When the appointment was last updated' });
372
+ // Appointment-Patient Association (Many-to-One)
373
+ appointmentEntity.addAssociation({ key: patientEntity.key }, {
374
+ info: { name: 'patient', displayName: 'Patient', description: 'Patient for this appointment' },
375
+ required: true,
376
+ multiple: false,
377
+ });
378
+ // Appointment-Provider Association (Many-to-One)
379
+ appointmentEntity.addAssociation({ key: providerEntity.key }, {
380
+ info: { name: 'provider', displayName: 'Provider', description: 'Healthcare provider for this appointment' },
381
+ required: true,
382
+ multiple: false,
383
+ });
384
+ // Appointment-Facility Association (Many-to-One)
385
+ appointmentEntity.addAssociation({ key: facilityEntity.key }, {
386
+ info: { name: 'facility', displayName: 'Facility', description: 'Facility where appointment takes place' },
387
+ required: true,
388
+ multiple: false,
389
+ });
390
+ // Availability Model
391
+ const availabilityModel = appointmentScheduling.addModel({
392
+ info: {
393
+ name: 'Availability',
394
+ displayName: 'Provider Availability',
395
+ description: 'Provider availability and scheduling rules',
396
+ },
397
+ });
398
+ // Provider Availability Entity
399
+ const availabilityEntity = availabilityModel.addEntity({
400
+ info: {
401
+ name: 'provider_availability',
402
+ displayName: 'Provider Availability',
403
+ description: 'Provider availability schedule and rules',
404
+ },
405
+ });
406
+ addIdField(availabilityEntity, { displayName: 'Availability ID', description: 'Unique identifier for availability' });
407
+ availabilityEntity.addProperty({
408
+ info: { name: 'day_of_week', displayName: 'Day of Week', description: 'Day of the week for availability' },
409
+ type: 'string',
410
+ required: true,
411
+ schema: {
412
+ enum: ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'],
413
+ },
414
+ });
415
+ availabilityEntity.addProperty({
416
+ info: { name: 'start_time', displayName: 'Start Time', description: 'Start time for availability' },
417
+ type: 'time',
418
+ required: true,
419
+ });
420
+ availabilityEntity.addProperty({
421
+ info: { name: 'end_time', displayName: 'End Time', description: 'End time for availability' },
422
+ type: 'time',
423
+ required: true,
424
+ });
425
+ addBooleanField(availabilityEntity, 'is_available', 'true', {
426
+ displayName: 'Is Available',
427
+ description: 'Whether the provider is available during this time',
428
+ });
429
+ // Availability-Provider Association (Many-to-One)
430
+ availabilityEntity.addAssociation({ key: providerEntity.key }, {
431
+ info: { name: 'provider', displayName: 'Provider', description: 'Provider for this availability' },
432
+ required: true,
433
+ multiple: false,
434
+ });
435
+ //
436
+ // 4. MEDICAL RECORDS NAMESPACE
437
+ //
438
+ const medicalRecords = domain.addNamespace({
439
+ info: {
440
+ name: 'MedicalRecords',
441
+ displayName: 'Medical Records',
442
+ description: 'Medical records, diagnoses, treatments, and lab results',
443
+ },
444
+ });
445
+ // Medical Records Model
446
+ const medicalRecordsModel = medicalRecords.addModel({
447
+ info: {
448
+ name: 'MedicalRecords',
449
+ displayName: 'Medical Records Management',
450
+ description: 'Patient medical records and documentation',
451
+ },
452
+ });
453
+ // Diagnosis Entity
454
+ const diagnosisEntity = medicalRecordsModel.addEntity({
455
+ info: {
456
+ name: 'diagnosis',
457
+ displayName: 'Diagnosis',
458
+ description: 'Medical diagnosis for a patient',
459
+ },
460
+ });
461
+ addIdField(diagnosisEntity, { displayName: 'Diagnosis ID', description: 'Unique identifier for the diagnosis' });
462
+ diagnosisEntity.addProperty({
463
+ info: { name: 'icd_code', displayName: 'ICD Code', description: 'International Classification of Diseases code' },
464
+ type: 'string',
465
+ required: true,
466
+ });
467
+ diagnosisEntity.addProperty({
468
+ info: { name: 'diagnosis_name', displayName: 'Diagnosis Name', description: 'Name of the diagnosis' },
469
+ type: 'string',
470
+ required: true,
471
+ });
472
+ addDescriptionField(diagnosisEntity, { description: 'Detailed description of the diagnosis' });
473
+ diagnosisEntity.addProperty({
474
+ info: { name: 'diagnosis_date', displayName: 'Diagnosis Date', description: 'Date when diagnosis was made' },
475
+ type: 'date',
476
+ required: true,
477
+ });
478
+ addCustomStatusField(diagnosisEntity, ['active', 'resolved', 'chronic'], {
479
+ displayName: 'Diagnosis Status',
480
+ description: 'Current status of the diagnosis',
481
+ });
482
+ addCreatedAtField(diagnosisEntity, { description: 'When the diagnosis was created' });
483
+ // Diagnosis-Patient Association (Many-to-One)
484
+ diagnosisEntity.addAssociation({ key: patientEntity.key }, {
485
+ info: { name: 'patient', displayName: 'Patient', description: 'Patient with this diagnosis' },
486
+ required: true,
487
+ multiple: false,
488
+ });
489
+ // Diagnosis-Provider Association (Many-to-One)
490
+ diagnosisEntity.addAssociation({ key: providerEntity.key }, {
491
+ info: { name: 'provider', displayName: 'Provider', description: 'Provider who made the diagnosis' },
492
+ required: true,
493
+ multiple: false,
494
+ });
495
+ // Treatment Entity
496
+ const treatmentEntity = medicalRecordsModel.addEntity({
497
+ info: {
498
+ name: 'treatment',
499
+ displayName: 'Treatment',
500
+ description: 'Medical treatment or procedure',
501
+ },
502
+ });
503
+ addIdField(treatmentEntity, { displayName: 'Treatment ID', description: 'Unique identifier for the treatment' });
504
+ addNameField(treatmentEntity, { displayName: 'Treatment Name', description: 'Name of the treatment or procedure' });
505
+ addDescriptionField(treatmentEntity, { description: 'Detailed description of the treatment' });
506
+ treatmentEntity.addProperty({
507
+ info: { name: 'treatment_date', displayName: 'Treatment Date', description: 'Date when treatment was performed' },
508
+ type: 'date',
509
+ required: true,
510
+ });
511
+ addCustomStatusField(treatmentEntity, ['planned', 'in_progress', 'completed', 'cancelled'], {
512
+ displayName: 'Treatment Status',
513
+ description: 'Current status of the treatment',
514
+ });
515
+ addCreatedAtField(treatmentEntity, { description: 'When the treatment was created' });
516
+ // Treatment-Patient Association (Many-to-One)
517
+ treatmentEntity.addAssociation({ key: patientEntity.key }, {
518
+ info: { name: 'patient', displayName: 'Patient', description: 'Patient receiving the treatment' },
519
+ required: true,
520
+ multiple: false,
521
+ });
522
+ // Treatment-Provider Association (Many-to-One)
523
+ treatmentEntity.addAssociation({ key: providerEntity.key }, {
524
+ info: { name: 'provider', displayName: 'Provider', description: 'Provider performing the treatment' },
525
+ required: true,
526
+ multiple: false,
527
+ });
528
+ // Treatment-Diagnosis Association (Many-to-Many)
529
+ treatmentEntity.addAssociation({ key: diagnosisEntity.key }, {
530
+ info: { name: 'diagnoses', displayName: 'Related Diagnoses', description: 'Diagnoses related to this treatment' },
531
+ required: false,
532
+ multiple: true,
533
+ });
534
+ // Prescription Entity
535
+ const prescriptionEntity = medicalRecordsModel.addEntity({
536
+ info: {
537
+ name: 'prescription',
538
+ displayName: 'Prescription',
539
+ description: 'Medication prescription',
540
+ },
541
+ });
542
+ addIdField(prescriptionEntity, {
543
+ displayName: 'Prescription ID',
544
+ description: 'Unique identifier for the prescription',
545
+ });
546
+ prescriptionEntity.addProperty({
547
+ info: { name: 'medication_name', displayName: 'Medication Name', description: 'Name of the prescribed medication' },
548
+ type: 'string',
549
+ required: true,
550
+ });
551
+ prescriptionEntity.addProperty({
552
+ info: { name: 'dosage', displayName: 'Dosage', description: 'Prescribed dosage information' },
553
+ type: 'string',
554
+ required: true,
555
+ });
556
+ prescriptionEntity.addProperty({
557
+ info: { name: 'frequency', displayName: 'Frequency', description: 'How often to take the medication' },
558
+ type: 'string',
559
+ required: true,
560
+ });
561
+ prescriptionEntity.addProperty({
562
+ info: { name: 'duration_days', displayName: 'Duration (Days)', description: 'Duration of prescription in days' },
563
+ type: 'number',
564
+ required: true,
565
+ schema: {
566
+ minimum: 1,
567
+ },
568
+ });
569
+ prescriptionEntity.addProperty({
570
+ info: {
571
+ name: 'prescribed_date',
572
+ displayName: 'Prescribed Date',
573
+ description: 'Date when medication was prescribed',
574
+ },
575
+ type: 'date',
576
+ required: true,
577
+ });
578
+ addCustomStatusField(prescriptionEntity, ['active', 'completed', 'discontinued'], {
579
+ displayName: 'Prescription Status',
580
+ description: 'Current status of the prescription',
581
+ });
582
+ addCreatedAtField(prescriptionEntity, { description: 'When the prescription was created' });
583
+ // Prescription-Patient Association (Many-to-One)
584
+ prescriptionEntity.addAssociation({ key: patientEntity.key }, {
585
+ info: { name: 'patient', displayName: 'Patient', description: 'Patient prescribed the medication' },
586
+ required: true,
587
+ multiple: false,
588
+ });
589
+ // Prescription-Provider Association (Many-to-One)
590
+ prescriptionEntity.addAssociation({ key: providerEntity.key }, {
591
+ info: { name: 'provider', displayName: 'Provider', description: 'Provider who prescribed the medication' },
592
+ required: true,
593
+ multiple: false,
594
+ });
595
+ // Lab Result Entity
596
+ const labResultEntity = medicalRecordsModel.addEntity({
597
+ info: {
598
+ name: 'lab_result',
599
+ displayName: 'Lab Result',
600
+ description: 'Laboratory test results',
601
+ },
602
+ });
603
+ addIdField(labResultEntity, { displayName: 'Lab Result ID', description: 'Unique identifier for the lab result' });
604
+ addNameField(labResultEntity, { displayName: 'Test Name', description: 'Name of the laboratory test' });
605
+ labResultEntity.addProperty({
606
+ info: { name: 'test_date', displayName: 'Test Date', description: 'Date when the test was performed' },
607
+ type: 'date',
608
+ required: true,
609
+ });
610
+ labResultEntity.addProperty({
611
+ info: { name: 'result_value', displayName: 'Result Value', description: 'Numerical or text result value' },
612
+ type: 'string',
613
+ required: true,
614
+ });
615
+ labResultEntity.addProperty({
616
+ info: {
617
+ name: 'reference_range',
618
+ displayName: 'Reference Range',
619
+ description: 'Normal reference range for the test',
620
+ },
621
+ type: 'string',
622
+ });
623
+ addCustomStatusField(labResultEntity, ['normal', 'abnormal', 'critical', 'pending'], {
624
+ displayName: 'Result Status',
625
+ description: 'Status of the lab result',
626
+ });
627
+ addDescriptionField(labResultEntity, { description: 'Additional notes about the lab result' });
628
+ addCreatedAtField(labResultEntity, { description: 'When the lab result was created' });
629
+ // LabResult-Patient Association (Many-to-One)
630
+ labResultEntity.addAssociation({ key: patientEntity.key }, {
631
+ info: { name: 'patient', displayName: 'Patient', description: 'Patient for this lab result' },
632
+ required: true,
633
+ multiple: false,
634
+ });
635
+ // LabResult-Provider Association (Many-to-One)
636
+ labResultEntity.addAssociation({ key: providerEntity.key }, {
637
+ info: { name: 'provider', displayName: 'Provider', description: 'Provider who ordered the test' },
638
+ required: true,
639
+ multiple: false,
640
+ });
641
+ //
642
+ // 5. INSURANCE & BILLING NAMESPACE
643
+ //
644
+ const insuranceBilling = domain.addNamespace({
645
+ info: {
646
+ name: 'InsuranceBilling',
647
+ displayName: 'Insurance & Billing',
648
+ description: 'Insurance coverage, claims, and billing management',
649
+ },
650
+ });
651
+ // Insurance Model
652
+ const insuranceModel = insuranceBilling.addModel({
653
+ info: {
654
+ name: 'Insurance',
655
+ displayName: 'Insurance Management',
656
+ description: 'Insurance coverage and policy information',
657
+ },
658
+ });
659
+ // Insurance Policy Entity
660
+ const insurancePolicyEntity = insuranceModel.addEntity({
661
+ info: {
662
+ name: 'insurance_policy',
663
+ displayName: 'Insurance Policy',
664
+ description: 'Patient insurance policy information',
665
+ },
666
+ });
667
+ addIdField(insurancePolicyEntity, { displayName: 'Policy ID', description: 'Unique identifier for the policy' });
668
+ insurancePolicyEntity.addProperty({
669
+ info: { name: 'policy_number', displayName: 'Policy Number', description: 'Insurance policy number' },
670
+ type: 'string',
671
+ required: true,
672
+ unique: true,
673
+ });
674
+ addNameField(insurancePolicyEntity, {
675
+ displayName: 'Insurance Provider',
676
+ description: 'Name of the insurance provider',
677
+ });
678
+ addCustomStatusField(insurancePolicyEntity, ['active', 'inactive', 'expired', 'pending'], {
679
+ displayName: 'Policy Status',
680
+ description: 'Current status of the insurance policy',
681
+ });
682
+ insurancePolicyEntity.addProperty({
683
+ info: { name: 'effective_date', displayName: 'Effective Date', description: 'Date when policy becomes effective' },
684
+ type: 'date',
685
+ required: true,
686
+ });
687
+ insurancePolicyEntity.addProperty({
688
+ info: { name: 'expiration_date', displayName: 'Expiration Date', description: 'Date when policy expires' },
689
+ type: 'date',
690
+ required: true,
691
+ });
692
+ addCurrencyAmountField(insurancePolicyEntity, 'deductible', 'Deductible Amount', {
693
+ description: 'Annual deductible amount',
694
+ });
695
+ addCurrencyAmountField(insurancePolicyEntity, 'copay', 'Copay Amount', {
696
+ description: 'Copay amount for office visits',
697
+ });
698
+ addCreatedAtField(insurancePolicyEntity, { description: 'When the policy was created' });
699
+ // InsurancePolicy-Patient Association (Many-to-One)
700
+ insurancePolicyEntity.addAssociation({ key: patientEntity.key }, {
701
+ info: { name: 'patient', displayName: 'Patient', description: 'Patient covered by this policy' },
702
+ required: true,
703
+ multiple: false,
704
+ });
705
+ // Claim Entity
706
+ const claimEntity = insuranceModel.addEntity({
707
+ info: {
708
+ name: 'claim',
709
+ displayName: 'Insurance Claim',
710
+ description: 'Insurance claim for medical services',
711
+ },
712
+ });
713
+ addIdField(claimEntity, { displayName: 'Claim ID', description: 'Unique identifier for the claim' });
714
+ claimEntity.addProperty({
715
+ info: { name: 'claim_number', displayName: 'Claim Number', description: 'Insurance claim number' },
716
+ type: 'string',
717
+ required: true,
718
+ unique: true,
719
+ });
720
+ addCurrencyAmountField(claimEntity, 'billed_amount', 'Billed Amount', {
721
+ description: 'Amount billed to insurance',
722
+ });
723
+ addCurrencyAmountField(claimEntity, 'approved_amount', 'Approved Amount', {
724
+ description: 'Amount approved by insurance',
725
+ });
726
+ addCurrencyAmountField(claimEntity, 'patient_responsibility', 'Patient Responsibility', {
727
+ description: 'Amount patient is responsible for',
728
+ });
729
+ addCustomStatusField(claimEntity, ['submitted', 'processing', 'approved', 'denied', 'paid'], {
730
+ displayName: 'Claim Status',
731
+ description: 'Current status of the insurance claim',
732
+ });
733
+ claimEntity.addProperty({
734
+ info: { name: 'service_date', displayName: 'Service Date', description: 'Date when service was provided' },
735
+ type: 'date',
736
+ required: true,
737
+ });
738
+ addCreatedAtField(claimEntity, { description: 'When the claim was created' });
739
+ // Claim-Patient Association (Many-to-One)
740
+ claimEntity.addAssociation({ key: patientEntity.key }, {
741
+ info: { name: 'patient', displayName: 'Patient', description: 'Patient for this claim' },
742
+ required: true,
743
+ multiple: false,
744
+ });
745
+ // Claim-Provider Association (Many-to-One)
746
+ claimEntity.addAssociation({ key: providerEntity.key }, {
747
+ info: { name: 'provider', displayName: 'Provider', description: 'Provider who provided the service' },
748
+ required: true,
749
+ multiple: false,
750
+ });
751
+ // Claim-InsurancePolicy Association (Many-to-One)
752
+ claimEntity.addAssociation({ key: insurancePolicyEntity.key }, {
753
+ info: {
754
+ name: 'insurance_policy',
755
+ displayName: 'Insurance Policy',
756
+ description: 'Insurance policy for this claim',
757
+ },
758
+ required: true,
759
+ multiple: false,
760
+ });
761
+ // Billing Model
762
+ const billingModel = insuranceBilling.addModel({
763
+ info: {
764
+ name: 'Billing',
765
+ displayName: 'Billing Management',
766
+ description: 'Patient billing and payment processing',
767
+ },
768
+ });
769
+ // Invoice Entity
770
+ const invoiceEntity = billingModel.addEntity({
771
+ info: {
772
+ name: 'invoice',
773
+ displayName: 'Invoice',
774
+ description: 'Patient invoice for medical services',
775
+ },
776
+ });
777
+ addIdField(invoiceEntity, { displayName: 'Invoice ID', description: 'Unique identifier for the invoice' });
778
+ invoiceEntity.addProperty({
779
+ info: { name: 'invoice_number', displayName: 'Invoice Number', description: 'Human-readable invoice number' },
780
+ type: 'string',
781
+ required: true,
782
+ unique: true,
783
+ });
784
+ addCurrencyAmountField(invoiceEntity, 'total_amount', 'Total Amount', {
785
+ description: 'Total amount due on the invoice',
786
+ });
787
+ addCurrencyAmountField(invoiceEntity, 'paid_amount', 'Paid Amount', {
788
+ description: 'Amount already paid',
789
+ });
790
+ addCurrencyAmountField(invoiceEntity, 'balance_due', 'Balance Due', {
791
+ description: 'Remaining balance due',
792
+ });
793
+ addCustomStatusField(invoiceEntity, ['draft', 'sent', 'paid', 'overdue', 'cancelled'], {
794
+ displayName: 'Invoice Status',
795
+ description: 'Current status of the invoice',
796
+ });
797
+ invoiceEntity.addProperty({
798
+ info: { name: 'due_date', displayName: 'Due Date', description: 'Date when payment is due' },
799
+ type: 'date',
800
+ required: true,
801
+ });
802
+ addCreatedAtField(invoiceEntity, { description: 'When the invoice was created' });
803
+ // Invoice-Patient Association (Many-to-One)
804
+ invoiceEntity.addAssociation({ key: patientEntity.key }, {
805
+ info: { name: 'patient', displayName: 'Patient', description: 'Patient for this invoice' },
806
+ required: true,
807
+ multiple: false,
808
+ });
809
+ // Invoice-Provider Association (Many-to-One)
810
+ invoiceEntity.addAssociation({ key: providerEntity.key }, {
811
+ info: { name: 'provider', displayName: 'Provider', description: 'Provider who provided the services' },
812
+ required: true,
813
+ multiple: false,
814
+ });
815
+ // Payment Entity
816
+ const paymentEntity = billingModel.addEntity({
817
+ info: {
818
+ name: 'payment',
819
+ displayName: 'Payment',
820
+ description: 'Payment transaction for medical services',
821
+ },
822
+ });
823
+ addIdField(paymentEntity, { displayName: 'Payment ID', description: 'Unique identifier for the payment' });
824
+ addCurrencyAmountField(paymentEntity, 'amount', 'Payment Amount', {
825
+ description: 'Amount of the payment',
826
+ });
827
+ paymentEntity.addProperty({
828
+ info: { name: 'payment_method', displayName: 'Payment Method', description: 'Method used for payment' },
829
+ type: 'string',
830
+ required: true,
831
+ schema: {
832
+ enum: ['cash', 'check', 'credit_card', 'debit_card', 'insurance', 'bank_transfer'],
833
+ },
834
+ });
835
+ addCustomStatusField(paymentEntity, ['pending', 'completed', 'failed', 'refunded'], {
836
+ displayName: 'Payment Status',
837
+ description: 'Current status of the payment',
838
+ });
839
+ paymentEntity.addProperty({
840
+ info: { name: 'payment_date', displayName: 'Payment Date', description: 'Date when payment was made' },
841
+ type: 'date',
842
+ required: true,
843
+ });
844
+ addCreatedAtField(paymentEntity, { description: 'When the payment was created' });
845
+ // Payment-Patient Association (Many-to-One)
846
+ paymentEntity.addAssociation({ key: patientEntity.key }, {
847
+ info: { name: 'patient', displayName: 'Patient', description: 'Patient who made the payment' },
848
+ required: true,
849
+ multiple: false,
850
+ });
851
+ // Payment-Invoice Association (Many-to-One)
852
+ paymentEntity.addAssociation({ key: invoiceEntity.key }, {
853
+ info: { name: 'invoice', displayName: 'Invoice', description: 'Invoice this payment applies to' },
854
+ required: true,
855
+ multiple: false,
856
+ });
857
+ return domain;
858
+ }
859
+ //# sourceMappingURL=healthcare-domain.js.map