@appcorp/fusion-storybook 0.1.4

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 (131) hide show
  1. package/README.md +147 -0
  2. package/base-modules/admission/cache.d.ts +14 -0
  3. package/base-modules/admission/cache.js +31 -0
  4. package/base-modules/admission/constants.d.ts +32 -0
  5. package/base-modules/admission/constants.js +37 -0
  6. package/base-modules/admission/context.d.ts +369 -0
  7. package/base-modules/admission/context.js +755 -0
  8. package/base-modules/admission/filter.d.ts +1 -0
  9. package/base-modules/admission/filter.js +31 -0
  10. package/base-modules/admission/form.d.ts +1 -0
  11. package/base-modules/admission/form.js +86 -0
  12. package/base-modules/admission/more-actions.d.ts +1 -0
  13. package/base-modules/admission/more-actions.js +5 -0
  14. package/base-modules/admission/page.d.ts +16 -0
  15. package/base-modules/admission/page.js +128 -0
  16. package/base-modules/admission/validate.d.ts +38 -0
  17. package/base-modules/admission/validate.js +70 -0
  18. package/base-modules/admission/view.d.ts +1 -0
  19. package/base-modules/admission/view.js +40 -0
  20. package/base-modules/discount-code/cache.d.ts +27 -0
  21. package/base-modules/discount-code/cache.js +46 -0
  22. package/base-modules/discount-code/constants.d.ts +19 -0
  23. package/base-modules/discount-code/constants.js +26 -0
  24. package/base-modules/discount-code/context.d.ts +154 -0
  25. package/base-modules/discount-code/context.js +416 -0
  26. package/base-modules/discount-code/filter.d.ts +9 -0
  27. package/base-modules/discount-code/filter.js +14 -0
  28. package/base-modules/discount-code/form.d.ts +1 -0
  29. package/base-modules/discount-code/form.js +44 -0
  30. package/base-modules/discount-code/more-actions.d.ts +9 -0
  31. package/base-modules/discount-code/more-actions.js +13 -0
  32. package/base-modules/discount-code/page.d.ts +16 -0
  33. package/base-modules/discount-code/page.js +120 -0
  34. package/base-modules/discount-code/validate.d.ts +19 -0
  35. package/base-modules/discount-code/validate.js +38 -0
  36. package/base-modules/discount-code/view.d.ts +1 -0
  37. package/base-modules/discount-code/view.js +26 -0
  38. package/base-modules/family/cache.d.ts +14 -0
  39. package/base-modules/family/cache.js +31 -0
  40. package/base-modules/family/constants.d.ts +22 -0
  41. package/base-modules/family/constants.js +26 -0
  42. package/base-modules/family/context.d.ts +173 -0
  43. package/base-modules/family/context.js +441 -0
  44. package/base-modules/family/filter.d.ts +1 -0
  45. package/base-modules/family/filter.js +28 -0
  46. package/base-modules/family/form.d.ts +1 -0
  47. package/base-modules/family/form.js +12 -0
  48. package/base-modules/family/more-actions.d.ts +1 -0
  49. package/base-modules/family/more-actions.js +5 -0
  50. package/base-modules/family/page.d.ts +16 -0
  51. package/base-modules/family/page.js +120 -0
  52. package/base-modules/family/validate.d.ts +15 -0
  53. package/base-modules/family/validate.js +18 -0
  54. package/base-modules/family/view.d.ts +1 -0
  55. package/base-modules/family/view.js +18 -0
  56. package/base-modules/family-member/cache.d.ts +14 -0
  57. package/base-modules/family-member/cache.js +31 -0
  58. package/base-modules/family-member/constants.d.ts +22 -0
  59. package/base-modules/family-member/constants.js +26 -0
  60. package/base-modules/family-member/context.d.ts +215 -0
  61. package/base-modules/family-member/context.js +486 -0
  62. package/base-modules/family-member/filter.d.ts +1 -0
  63. package/base-modules/family-member/filter.js +28 -0
  64. package/base-modules/family-member/form.d.ts +1 -0
  65. package/base-modules/family-member/form.js +17 -0
  66. package/base-modules/family-member/more-actions.d.ts +1 -0
  67. package/base-modules/family-member/more-actions.js +5 -0
  68. package/base-modules/family-member/page.d.ts +16 -0
  69. package/base-modules/family-member/page.js +122 -0
  70. package/base-modules/family-member/validate.d.ts +24 -0
  71. package/base-modules/family-member/validate.js +27 -0
  72. package/base-modules/family-member/view.d.ts +1 -0
  73. package/base-modules/family-member/view.js +40 -0
  74. package/base-modules/student-profile/cache.d.ts +14 -0
  75. package/base-modules/student-profile/cache.js +31 -0
  76. package/base-modules/student-profile/constants.d.ts +105 -0
  77. package/base-modules/student-profile/constants.js +132 -0
  78. package/base-modules/student-profile/context.d.ts +290 -0
  79. package/base-modules/student-profile/context.js +583 -0
  80. package/base-modules/student-profile/filter.d.ts +1 -0
  81. package/base-modules/student-profile/filter.js +26 -0
  82. package/base-modules/student-profile/form.d.ts +1 -0
  83. package/base-modules/student-profile/form.js +19 -0
  84. package/base-modules/student-profile/more-actions.d.ts +1 -0
  85. package/base-modules/student-profile/more-actions.js +5 -0
  86. package/base-modules/student-profile/page.d.ts +9 -0
  87. package/base-modules/student-profile/page.js +86 -0
  88. package/base-modules/student-profile/validate.d.ts +23 -0
  89. package/base-modules/student-profile/validate.js +34 -0
  90. package/base-modules/student-profile/view.d.ts +1 -0
  91. package/base-modules/student-profile/view.js +29 -0
  92. package/base-modules/workspace/cache.d.ts +9 -0
  93. package/base-modules/workspace/cache.js +28 -0
  94. package/base-modules/workspace/constants.d.ts +10 -0
  95. package/base-modules/workspace/constants.js +18 -0
  96. package/base-modules/workspace/context.d.ts +187 -0
  97. package/base-modules/workspace/context.js +293 -0
  98. package/base-modules/workspace/drawer.d.ts +1 -0
  99. package/base-modules/workspace/drawer.js +24 -0
  100. package/base-modules/workspace/filter.d.ts +1 -0
  101. package/base-modules/workspace/filter.js +13 -0
  102. package/base-modules/workspace/form.d.ts +1 -0
  103. package/base-modules/workspace/form.js +40 -0
  104. package/base-modules/workspace/more-actions.d.ts +1 -0
  105. package/base-modules/workspace/more-actions.js +13 -0
  106. package/base-modules/workspace/page.d.ts +1 -0
  107. package/base-modules/workspace/page.js +31 -0
  108. package/base-modules/workspace/validate.d.ts +9 -0
  109. package/base-modules/workspace/validate.js +8 -0
  110. package/base-modules/workspace/view.d.ts +1 -0
  111. package/base-modules/workspace/view.js +52 -0
  112. package/components/rbac-no-access.d.ts +6 -0
  113. package/components/rbac-no-access.js +4 -0
  114. package/constants.d.ts +81 -0
  115. package/constants.js +81 -0
  116. package/lib/utils.d.ts +2 -0
  117. package/lib/utils.js +5 -0
  118. package/package.json +104 -0
  119. package/tsconfig.build.tsbuildinfo +1 -0
  120. package/type.d.ts +1141 -0
  121. package/type.js +427 -0
  122. package/utils/admission-pdf.d.ts +78 -0
  123. package/utils/admission-pdf.js +73 -0
  124. package/utils/clear-cache.d.ts +1 -0
  125. package/utils/clear-cache.js +8 -0
  126. package/utils/format-value.d.ts +1 -0
  127. package/utils/format-value.js +1 -0
  128. package/utils/pdf-generator.d.ts +41 -0
  129. package/utils/pdf-generator.js +107 -0
  130. package/utils/resolve-rbac-permissions.d.ts +11 -0
  131. package/utils/resolve-rbac-permissions.js +251 -0
package/type.d.ts ADDED
@@ -0,0 +1,1141 @@
1
+ /**
2
+ * TypeScript Types Generated from Prisma Schema
3
+ *
4
+ * This file contains TypeScript interfaces for all database models
5
+ * and enums following the naming conventions:
6
+ * - Models: TableName + BE (e.g., StudentBE)
7
+ * - Enums: SCREAMING_SNAKE_CASE (e.g., USER_ROLE for UserRole)
8
+ */
9
+ /**
10
+ * User roles across the multi-tenant system
11
+ */
12
+ export declare enum USER_ROLE {
13
+ SUPER_ADMIN = "SUPER_ADMIN",
14
+ SCHOOL_ADMIN = "SCHOOL_ADMIN",
15
+ TEACHER = "TEACHER",
16
+ STUDENT = "STUDENT",
17
+ PARENT = "PARENT",
18
+ STAFF = "STAFF"
19
+ }
20
+ /**
21
+ * Student enrollment status
22
+ */
23
+ export declare enum STUDENT_STATUS {
24
+ ACTIVE = "ACTIVE",
25
+ INACTIVE = "INACTIVE",
26
+ GRADUATED = "GRADUATED",
27
+ TRANSFERRED = "TRANSFERRED",
28
+ DROPPED = "DROPPED"
29
+ }
30
+ /**
31
+ * Family member roles within a household
32
+ */
33
+ export declare enum FAMILY_MEMBER_ROLE {
34
+ FATHER = "FATHER",
35
+ MOTHER = "MOTHER",
36
+ GUARDIAN = "GUARDIAN",
37
+ STUDENT = "STUDENT"
38
+ }
39
+ /**
40
+ * Gender options
41
+ */
42
+ export declare enum GENDER {
43
+ MALE = "MALE",
44
+ FEMALE = "FEMALE",
45
+ OTHER = "OTHER",
46
+ PREFER_NOT_TO_SAY = "PREFER_NOT_TO_SAY"
47
+ }
48
+ /**
49
+ * Day of the week for scheduling
50
+ */
51
+ export declare enum DAY_OF_WEEK {
52
+ MONDAY = "MONDAY",
53
+ TUESDAY = "TUESDAY",
54
+ WEDNESDAY = "WEDNESDAY",
55
+ THURSDAY = "THURSDAY",
56
+ FRIDAY = "FRIDAY",
57
+ SATURDAY = "SATURDAY",
58
+ SUNDAY = "SUNDAY"
59
+ }
60
+ /**
61
+ * Attendance status
62
+ */
63
+ export declare enum ATTENDANCE_STATUS {
64
+ PRESENT = "PRESENT",
65
+ ABSENT = "ABSENT",
66
+ LATE = "LATE",
67
+ EXCUSED = "EXCUSED",
68
+ HALF_DAY = "HALF_DAY"
69
+ }
70
+ /**
71
+ * Grade type for assessments
72
+ */
73
+ export declare enum GRADE_TYPE {
74
+ EXAM = "EXAM",
75
+ QUIZ = "QUIZ",
76
+ ASSIGNMENT = "ASSIGNMENT",
77
+ PARTICIPATION = "PARTICIPATION",
78
+ PRACTICAL = "PRACTICAL",
79
+ PROJECT = "PROJECT"
80
+ }
81
+ /**
82
+ * Fee type categories
83
+ */
84
+ export declare enum FEE_TYPE {
85
+ TUITION = "TUITION",
86
+ ADMISSION = "ADMISSION",
87
+ EXAM = "EXAM",
88
+ LIBRARY = "LIBRARY",
89
+ LABORATORY = "LABORATORY",
90
+ TRANSPORT = "TRANSPORT",
91
+ SPORTS = "SPORTS",
92
+ MISCELLANEOUS = "MISCELLANEOUS",
93
+ LATE = "LATE"
94
+ }
95
+ /**
96
+ * Discount type for fee reductions
97
+ */
98
+ export declare enum DISCOUNT_TYPE {
99
+ PERCENTAGE = "PERCENTAGE",
100
+ FIXED = "FIXED"
101
+ }
102
+ /**
103
+ * Payment status
104
+ */
105
+ export declare enum PAYMENT_STATUS {
106
+ PENDING = "PENDING",
107
+ PARTIAL = "PARTIAL",
108
+ PAID = "PAID",
109
+ OVERDUE = "OVERDUE",
110
+ CANCELLED = "CANCELLED",
111
+ REFUNDED = "REFUNDED"
112
+ }
113
+ /**
114
+ * Payment method
115
+ */
116
+ export declare enum PAYMENT_METHOD {
117
+ CASH = "CASH",
118
+ BANK_TRANSFER = "BANK_TRANSFER",
119
+ CREDIT_CARD = "CREDIT_CARD",
120
+ DEBIT_CARD = "DEBIT_CARD",
121
+ CHEQUE = "CHEQUE",
122
+ ONLINE = "ONLINE",
123
+ MOBILE_WALLET = "MOBILE_WALLET"
124
+ }
125
+ /**
126
+ * Expense category types
127
+ */
128
+ export declare enum EXPENSE_CATEGORY {
129
+ SALARY = "SALARY",
130
+ UTILITIES = "UTILITIES",
131
+ MAINTENANCE = "MAINTENANCE",
132
+ SUPPLIES = "SUPPLIES",
133
+ TRANSPORT = "TRANSPORT",
134
+ MARKETING = "MARKETING",
135
+ INSURANCE = "INSURANCE",
136
+ RENT = "RENT",
137
+ TECHNOLOGY = "TECHNOLOGY",
138
+ PROFESSIONAL = "PROFESSIONAL",
139
+ TRAINING = "TRAINING",
140
+ EVENTS = "EVENTS",
141
+ FOOD = "FOOD",
142
+ MISCELLANEOUS = "MISCELLANEOUS"
143
+ }
144
+ /**
145
+ * Expense payment status
146
+ */
147
+ export declare enum EXPENSE_STATUS {
148
+ PENDING = "PENDING",
149
+ APPROVED = "APPROVED",
150
+ PAID = "PAID",
151
+ REJECTED = "REJECTED",
152
+ CANCELLED = "CANCELLED"
153
+ }
154
+ /**
155
+ * Currency options (ISO 4217 codes)
156
+ */
157
+ export declare enum CURRENCY {
158
+ AED = "AED",
159
+ AFN = "AFN",
160
+ ALL = "ALL",
161
+ AMD = "AMD",
162
+ ANG = "ANG",
163
+ AOA = "AOA",
164
+ ARS = "ARS",
165
+ AUD = "AUD",
166
+ AWG = "AWG",
167
+ AZN = "AZN",
168
+ BAM = "BAM",
169
+ BBD = "BBD",
170
+ BDT = "BDT",
171
+ BGN = "BGN",
172
+ BHD = "BHD",
173
+ BIF = "BIF",
174
+ BMD = "BMD",
175
+ BND = "BND",
176
+ BOB = "BOB",
177
+ BRL = "BRL",
178
+ BSD = "BSD",
179
+ BTN = "BTN",
180
+ BWP = "BWP",
181
+ BYN = "BYN",
182
+ BZD = "BZD",
183
+ CAD = "CAD",
184
+ CDF = "CDF",
185
+ CHF = "CHF",
186
+ CLP = "CLP",
187
+ CNY = "CNY",
188
+ COP = "COP",
189
+ CRC = "CRC",
190
+ CVE = "CVE",
191
+ CZK = "CZK",
192
+ DJF = "DJF",
193
+ DKK = "DKK",
194
+ DOP = "DOP",
195
+ DZD = "DZD",
196
+ EGP = "EGP",
197
+ ERN = "ERN",
198
+ ETB = "ETB",
199
+ EUR = "EUR",
200
+ FJD = "FJD",
201
+ FKP = "FKP",
202
+ GBP = "GBP",
203
+ GEL = "GEL",
204
+ GHS = "GHS",
205
+ GIP = "GIP",
206
+ GMD = "GMD",
207
+ GNF = "GNF",
208
+ GTQ = "GTQ",
209
+ GYD = "GYD",
210
+ HKD = "HKD",
211
+ HNL = "HNL",
212
+ HTG = "HTG",
213
+ HUF = "HUF",
214
+ IDR = "IDR",
215
+ ILS = "ILS",
216
+ INR = "INR",
217
+ IQD = "IQD",
218
+ IRR = "IRR",
219
+ ISK = "ISK",
220
+ JMD = "JMD",
221
+ JOD = "JOD",
222
+ JPY = "JPY",
223
+ KES = "KES",
224
+ KGS = "KGS",
225
+ KHR = "KHR",
226
+ KMF = "KMF",
227
+ KPW = "KPW",
228
+ KRW = "KRW",
229
+ KWD = "KWD",
230
+ KYD = "KYD",
231
+ KZT = "KZT",
232
+ LAK = "LAK",
233
+ LBP = "LBP",
234
+ LKR = "LKR",
235
+ LSL = "LSL",
236
+ LYD = "LYD",
237
+ MAD = "MAD",
238
+ MDL = "MDL",
239
+ MGA = "MGA",
240
+ MKD = "MKD",
241
+ MMK = "MMK",
242
+ MNT = "MNT",
243
+ MOP = "MOP",
244
+ MRU = "MRU",
245
+ MUR = "MUR",
246
+ MWK = "MWK",
247
+ MXN = "MXN",
248
+ MYR = "MYR",
249
+ MZN = "MZN",
250
+ NAD = "NAD",
251
+ NGN = "NGN",
252
+ NIO = "NIO",
253
+ NOK = "NOK",
254
+ NPR = "NPR",
255
+ NZD = "NZD",
256
+ OMR = "OMR",
257
+ PAB = "PAB",
258
+ PEN = "PEN",
259
+ PGK = "PGK",
260
+ PHP = "PHP",
261
+ PKR = "PKR",
262
+ PLN = "PLN",
263
+ PYG = "PYG",
264
+ QAR = "QAR",
265
+ RON = "RON",
266
+ RSD = "RSD",
267
+ RUB = "RUB",
268
+ RWF = "RWF",
269
+ SAR = "SAR",
270
+ SBD = "SBD",
271
+ SCR = "SCR",
272
+ SDG = "SDG",
273
+ SEK = "SEK",
274
+ SGD = "SGD",
275
+ SHP = "SHP",
276
+ SLL = "SLL",
277
+ SOS = "SOS",
278
+ SRD = "SRD",
279
+ SYP = "SYP",
280
+ SZL = "SZL",
281
+ THB = "THB",
282
+ TJS = "TJS",
283
+ TMT = "TMT",
284
+ TND = "TND",
285
+ TOP = "TOP",
286
+ TRY = "TRY",
287
+ TTD = "TTD",
288
+ TWD = "TWD",
289
+ TZS = "TZS",
290
+ UAH = "UAH",
291
+ UGX = "UGX",
292
+ USD = "USD",
293
+ UYU = "UYU",
294
+ UZS = "UZS",
295
+ VES = "VES",
296
+ VND = "VND",
297
+ VUV = "VUV",
298
+ WST = "WST",
299
+ XAF = "XAF",
300
+ XCD = "XCD",
301
+ XOF = "XOF",
302
+ XPF = "XPF",
303
+ YER = "YER",
304
+ ZAR = "ZAR",
305
+ ZMW = "ZMW",
306
+ ZWL = "ZWL"
307
+ }
308
+ /**
309
+ * Access level for module-scoped permission grants
310
+ */
311
+ export declare enum ACCESS_LEVEL {
312
+ READ = "READ",
313
+ READ_WRITE = "READ_WRITE"
314
+ }
315
+ /**
316
+ * Plan types for subscription tiers
317
+ */
318
+ export declare enum PLAN_TYPE {
319
+ BASIC = "BASIC",
320
+ PRO = "PRO",
321
+ ENTERPRISE = "ENTERPRISE"
322
+ }
323
+ /**
324
+ * Billing interval used for charging (monthly or yearly)
325
+ */
326
+ export declare enum BILLING_INTERVAL {
327
+ MONTHLY = "MONTHLY",
328
+ YEARLY = "YEARLY"
329
+ }
330
+ /**
331
+ * Admission status for student applications
332
+ */
333
+ export declare enum ADMISSION_STATUS {
334
+ PENDING = "PENDING",
335
+ APPROVED = "APPROVED",
336
+ REJECTED = "REJECTED",
337
+ ENROLLED = "ENROLLED",
338
+ CANCELLED = "CANCELLED"
339
+ }
340
+ export interface AdmissionDetails {
341
+ classForAdmission: string;
342
+ previousSchool: string;
343
+ siblings: string;
344
+ }
345
+ export interface FatherDetails {
346
+ fatherCnic: string;
347
+ fatherFirstName: string;
348
+ fatherLastName: string;
349
+ fatherMobile: string;
350
+ fatherOccupation: string;
351
+ fatherOrganization: string;
352
+ }
353
+ export interface MotherDetails {
354
+ motherCnic: string;
355
+ motherFirstName: string;
356
+ motherLastName: string;
357
+ motherMobile: string;
358
+ }
359
+ export interface HomeDetails {
360
+ address: string;
361
+ city: string;
362
+ country: string;
363
+ postalCode: string;
364
+ state: string;
365
+ }
366
+ export interface StudentDetails {
367
+ bForm: string;
368
+ discountCode: string;
369
+ dob: string;
370
+ emergencyContact: string;
371
+ firstName: string;
372
+ gender: GENDER;
373
+ hafiz: boolean;
374
+ lastName: string;
375
+ orphan: boolean;
376
+ registrationCode: string;
377
+ }
378
+ export interface OfficeUse {
379
+ admissionNotes: string;
380
+ notes: string;
381
+ }
382
+ /**
383
+ * StudentAdmission stores raw application payloads as JSON blobs.
384
+ * This model mirrors the Prisma StudentAdmission model which keeps
385
+ * structured form data in Json columns so the application layer can
386
+ * process/transform it into domain entities on approval.
387
+ */
388
+ export interface AdmissionAIBE {
389
+ id: string;
390
+ admissionId: string;
391
+ schoolId: string;
392
+ score: number;
393
+ decision: string;
394
+ reasons: string[];
395
+ confidence: number;
396
+ processedAt: string;
397
+ createdAt: string;
398
+ updatedAt: string;
399
+ }
400
+ export interface AdmissionBE {
401
+ admissionDetails: AdmissionDetails | null;
402
+ createdAt: string;
403
+ enabled: boolean;
404
+ fatherDetails: FatherDetails | null;
405
+ homeDetails: HomeDetails | null;
406
+ id: string;
407
+ motherDetails: MotherDetails | null;
408
+ officeUse: OfficeUse | null;
409
+ schoolId: string;
410
+ status: ADMISSION_STATUS;
411
+ studentDetails: StudentDetails | null;
412
+ updatedAt: string;
413
+ school?: SchoolBE;
414
+ aiAnalysis?: AdmissionAIBE | null;
415
+ }
416
+ /**
417
+ * Subscription plan defining usage limits and features for workspaces
418
+ */
419
+ export interface PlanBE {
420
+ createdAt: string;
421
+ currency: CURRENCY;
422
+ enabled: boolean;
423
+ id: string;
424
+ maxClasses: number;
425
+ maxCourses: number;
426
+ maxFamilies: number;
427
+ maxStaffAccounts: number;
428
+ maxStudents: number;
429
+ maxTeachers: number;
430
+ name: string;
431
+ priceMonthly: number;
432
+ priceYearly: number;
433
+ storageLimitMB: number;
434
+ type: PLAN_TYPE;
435
+ updatedAt: string;
436
+ workspaces?: WorkspaceBE[];
437
+ }
438
+ /**
439
+ * Workspace represents a tenant in the multi-vendor system
440
+ * Each workspace has exactly ONE school (1:1 relationship)
441
+ */
442
+ export interface WorkspaceBE {
443
+ agreedCurrency: CURRENCY;
444
+ agreedPrice: number;
445
+ billingDate: number;
446
+ billingInterval: BILLING_INTERVAL;
447
+ classesCount: number;
448
+ coursesCount: number;
449
+ createdAt: string;
450
+ description: string | null;
451
+ dueDateLength: number;
452
+ enabled: boolean;
453
+ familiesCount: number;
454
+ id: string;
455
+ logo: string | null;
456
+ name: string;
457
+ planEndDate: Date | string | null;
458
+ planId: string | null;
459
+ planStartDate: Date | string | null;
460
+ secrets?: any | null;
461
+ staffAccountsCount: number;
462
+ storageUsedMB: number;
463
+ studentsCount: number;
464
+ subdomain: string;
465
+ teachersCount: number;
466
+ updatedAt: string;
467
+ customRoles?: RoleBE[];
468
+ plan?: PlanBE;
469
+ rolePermissions?: RolePermissionBE[];
470
+ school?: SchoolBE;
471
+ users?: WorkspaceUserBE[];
472
+ }
473
+ /**
474
+ * Join table managing user-workspace relationships and roles
475
+ * Allows users to belong to multiple workspaces with different roles
476
+ */
477
+ export interface WorkspaceUserBE {
478
+ createdAt: string;
479
+ enabled: boolean;
480
+ id: string;
481
+ roleId: string | null;
482
+ updatedAt: string;
483
+ userId: string;
484
+ workspaceId: string;
485
+ role?: RoleBE;
486
+ user?: UserBE;
487
+ workspace?: WorkspaceBE;
488
+ workspaceUserPermissions?: WorkspaceUserPermissionBE[];
489
+ }
490
+ /**
491
+ * Role defines a named set of default permissions.
492
+ * System roles (isSystem = true) are seeded once and map 1:1 with UserRole enum values.
493
+ * Workspace custom roles (isSystem = false, workspaceId set) are created by SCHOOL_ADMINs.
494
+ */
495
+ export interface RoleBE {
496
+ createdAt: string;
497
+ description: string | null;
498
+ id: string;
499
+ isSystem: boolean;
500
+ name: string;
501
+ updatedAt: string;
502
+ userRole: USER_ROLE | null;
503
+ workspaceId: string | null;
504
+ rolePermissions?: RolePermissionBE[];
505
+ workspace?: WorkspaceBE;
506
+ workspaceUsers?: WorkspaceBE[];
507
+ }
508
+ /**
509
+ * Permission describes a module-level capability and access level (e.g., "courses", READ/READ_WRITE).
510
+ */
511
+ export interface PermissionBE {
512
+ access: ACCESS_LEVEL;
513
+ createdAt: string;
514
+ description: string | null;
515
+ id: string;
516
+ module: string;
517
+ updatedAt: string;
518
+ rolePermissions?: RolePermissionBE[];
519
+ workspaceUserPermissions?: WorkspaceUserPermissionBE[];
520
+ }
521
+ /**
522
+ * RolePermission links a Permission to a Role, with an optional workspace scope.
523
+ * workspaceId IS NULL → global default grant for the role (seeded by system)
524
+ * workspaceId IS SET → workspace-level override set by SCHOOL_ADMIN for their workspace
525
+ * allowed = true → explicitly grant the permission
526
+ * allowed = false → explicitly deny/revoke the permission (overrides the global default)
527
+ */
528
+ export interface RolePermissionBE {
529
+ allowed: boolean;
530
+ createdAt: string;
531
+ id: string;
532
+ permissionId: string;
533
+ roleId: string;
534
+ updatedAt: string;
535
+ workspaceId: string | null;
536
+ permission?: PermissionBE;
537
+ role?: RoleBE;
538
+ workspace?: WorkspaceBE;
539
+ }
540
+ /**
541
+ * WorkspaceUserPermission is a per-user override for a given Permission within a workspace.
542
+ * allowed indicates explicit allow (true) or deny (false); overrides take precedence over role grants.
543
+ */
544
+ export interface WorkspaceUserPermissionBE {
545
+ allowed: boolean;
546
+ createdAt: string;
547
+ id: string;
548
+ permissionId: string;
549
+ updatedAt: string;
550
+ workspaceUserId: string;
551
+ permission?: PermissionBE;
552
+ workspaceUser?: WorkspaceUserBE;
553
+ }
554
+ /**
555
+ * Family represents a household sharing a single user account
556
+ * Contains parents and students using the same login credentials
557
+ */
558
+ export interface FamilyBE {
559
+ address: string | null;
560
+ city: string | null;
561
+ country: string | null;
562
+ createdAt: string;
563
+ enabled: boolean;
564
+ familyCode: string;
565
+ id: string;
566
+ postalCode: string | null;
567
+ schoolId: string;
568
+ state: string | null;
569
+ updatedAt: string;
570
+ members?: FamilyMemberBE[];
571
+ school?: SchoolBE;
572
+ studentFees?: StudentFeeBE[];
573
+ }
574
+ /**
575
+ * FamilyMember represents individuals within a family
576
+ * Multiple members (parents + students) share the family's user account
577
+ */
578
+ export interface FamilyMemberBE {
579
+ avatar: string | null;
580
+ bloodGroup: string | null;
581
+ createdAt: string;
582
+ dateOfBirth: Date | string | null;
583
+ email: string | null;
584
+ emergencyPhone: string | null;
585
+ enabled: boolean;
586
+ familyId: string;
587
+ firstName: string;
588
+ gender: GENDER;
589
+ id: string;
590
+ idNumber: string;
591
+ isPrimary: boolean;
592
+ lastName: string;
593
+ occupation: string | null;
594
+ organization: string | null;
595
+ phone: string | null;
596
+ relationship: string;
597
+ role: FAMILY_MEMBER_ROLE;
598
+ updatedAt: string;
599
+ family?: FamilyBE;
600
+ studentProfile?: StudentProfileBE;
601
+ }
602
+ /**
603
+ * StudentProfile extends FamilyMember with student-specific data
604
+ */
605
+ export interface StudentProfileBE {
606
+ computerNumber: number;
607
+ createdAt: string;
608
+ discountCode: string | null;
609
+ enabled: boolean;
610
+ familyMemberId: string;
611
+ hafiz: boolean;
612
+ id: string;
613
+ notes: string | null;
614
+ orphan: boolean;
615
+ previousSchool: string | null;
616
+ remarks: string | null;
617
+ status: STUDENT_STATUS;
618
+ studentCode: string;
619
+ updatedAt: string;
620
+ attendances?: AttendanceBE[];
621
+ enrollments?: EnrollmentBE[];
622
+ familyMember?: FamilyMemberBE;
623
+ grades?: GradeBE[];
624
+ studentFees?: StudentFeeBE[];
625
+ }
626
+ /**
627
+ * School represents an individual educational institution
628
+ * Has a 1:1 relationship with Workspace (each school is a separate tenant)
629
+ */
630
+ export interface SchoolBE {
631
+ address: string | null;
632
+ city: string | null;
633
+ code: string;
634
+ country: string | null;
635
+ createdAt: string;
636
+ currency: CURRENCY;
637
+ email: string | null;
638
+ enabled: boolean;
639
+ id: string;
640
+ logo: string | null;
641
+ name: string;
642
+ phone: string | null;
643
+ postalCode: string | null;
644
+ principalId: string | null;
645
+ state: string | null;
646
+ updatedAt: string;
647
+ website: string | null;
648
+ workspaceId: string;
649
+ attendances?: AttendanceBE[];
650
+ blogPosts?: BlogPostBE[];
651
+ classes?: ClassBE[];
652
+ courses?: CourseBE[];
653
+ expenses?: ExpenseBE[];
654
+ families?: FamilyBE[];
655
+ feeStructures?: FeeStructureBE[];
656
+ discountCodes?: DiscountCodeBE[];
657
+ grades?: GradeBE[];
658
+ schedules?: ScheduleBE[];
659
+ sections?: SectionBE[];
660
+ admissions?: AdmissionBE[];
661
+ studentFees?: StudentFeeBE[];
662
+ subjects?: SubjectBE[];
663
+ teachers?: TeacherBE[];
664
+ workspace?: WorkspaceBE;
665
+ }
666
+ /**
667
+ * Core user model synchronized with Supabase Auth
668
+ * Shared by entire family - parents and students use same login
669
+ */
670
+ export interface UserBE {
671
+ avatar: string | null;
672
+ createdAt: string;
673
+ email: string;
674
+ enabled: boolean;
675
+ id: string;
676
+ name: string | null;
677
+ phone: string | null;
678
+ updatedAt: string;
679
+ blogCommentClaps?: BlogCommentClapBE[];
680
+ blogComments?: BlogCommentBE[];
681
+ blogPostClaps?: BlogPostClapBE[];
682
+ blogPosts?: BlogPostBE[];
683
+ teacherProfile?: TeacherBE;
684
+ workspaces?: WorkspaceUserBE[];
685
+ }
686
+ /**
687
+ * Class represents grade levels (e.g., Grade 1, Grade 2, Grade 10)
688
+ */
689
+ export interface ClassBE {
690
+ code: string;
691
+ createdAt: string;
692
+ description: string | null;
693
+ enabled: boolean;
694
+ id: string;
695
+ name: string;
696
+ schoolId: string;
697
+ updatedAt: string;
698
+ school?: SchoolBE;
699
+ sections?: SectionBE[];
700
+ }
701
+ /**
702
+ * Section represents class divisions (e.g., Grade 1-A, Grade 1-B)
703
+ */
704
+ export interface SectionBE {
705
+ capacity: number | null;
706
+ classId: string;
707
+ createdAt: string;
708
+ enabled: boolean;
709
+ id: string;
710
+ name: string;
711
+ schoolId: string;
712
+ updatedAt: string;
713
+ class?: ClassBE;
714
+ courses?: CourseBE[];
715
+ enrollments?: EnrollmentBE[];
716
+ school?: SchoolBE;
717
+ }
718
+ /**
719
+ * Subject represents academic subjects (e.g., Mathematics, English, Science)
720
+ */
721
+ export interface SubjectBE {
722
+ code: string;
723
+ createdAt: string;
724
+ description: string | null;
725
+ enabled: boolean;
726
+ id: string;
727
+ name: string;
728
+ schoolId: string;
729
+ updatedAt: string;
730
+ courses?: CourseBE[];
731
+ school?: SchoolBE;
732
+ }
733
+ /**
734
+ * BlogPost metadata and content (MDX/Markdown stored in `content`).
735
+ */
736
+ export interface BlogPostBE {
737
+ authorId: string | null;
738
+ clapCount: number;
739
+ commentCount: number;
740
+ content: string;
741
+ createdAt: string;
742
+ enabled: boolean;
743
+ excerpt: string | null;
744
+ id: string;
745
+ publishedAt: Date | string | null;
746
+ schoolId: string | null;
747
+ slug: string;
748
+ title: string;
749
+ updatedAt: string;
750
+ author?: UserBE;
751
+ claps?: BlogPostClapBE[];
752
+ comments?: BlogCommentBE[];
753
+ school?: SchoolBE | null;
754
+ }
755
+ export interface BlogCommentBE {
756
+ authorId: string | null;
757
+ clapCount: number;
758
+ content: string;
759
+ createdAt: string;
760
+ enabled: boolean;
761
+ id: string;
762
+ parentId: string | null;
763
+ postId: string;
764
+ updatedAt: string;
765
+ author?: UserBE | null;
766
+ claps?: BlogCommentClapBE[];
767
+ parent?: BlogCommentBE | null;
768
+ post?: BlogPostBE;
769
+ replies?: BlogCommentBE[];
770
+ }
771
+ export interface BlogPostClapBE {
772
+ createdAt: string;
773
+ id: string;
774
+ postId: string;
775
+ sessionId: string | null;
776
+ userId: string | null;
777
+ post?: BlogPostBE;
778
+ user?: UserBE | null;
779
+ }
780
+ export interface BlogCommentClapBE {
781
+ commentId: string;
782
+ createdAt: string;
783
+ id: string;
784
+ sessionId: string | null;
785
+ userId: string | null;
786
+ comment?: BlogCommentBE;
787
+ user?: UserBE | null;
788
+ }
789
+ /**
790
+ * Course represents a subject taught in a specific section by a teacher
791
+ */
792
+ export interface CourseBE {
793
+ code: string;
794
+ createdAt: string;
795
+ enabled: boolean;
796
+ id: string;
797
+ schoolId: string;
798
+ sectionId: string;
799
+ subjectId: string;
800
+ teacherId: string;
801
+ updatedAt: Date;
802
+ enrollments?: EnrollmentBE[];
803
+ grades?: GradeBE[];
804
+ schedules?: ScheduleBE[];
805
+ school?: SchoolBE;
806
+ section?: SectionBE;
807
+ subject?: SubjectBE;
808
+ teacher?: TeacherBE;
809
+ }
810
+ /**
811
+ * Teacher represents teaching staff
812
+ */
813
+ export interface TeacherBE {
814
+ address: string | null;
815
+ avatar: string | null;
816
+ bio: string | null;
817
+ city: string | null;
818
+ country: string | null;
819
+ createdAt: string;
820
+ dateOfBirth: Date | string | null;
821
+ emergencyPhone: string | null;
822
+ enabled: boolean;
823
+ experience: number | null;
824
+ firstName: string;
825
+ gender: GENDER | null;
826
+ id: string;
827
+ joiningDate: Date | string;
828
+ lastName: string;
829
+ phone: string | null;
830
+ postalCode: string | null;
831
+ qualification: string | null;
832
+ schoolId: string;
833
+ specialization: string | null;
834
+ state: string | null;
835
+ teacherCode: string;
836
+ updatedAt: Date;
837
+ userId: string;
838
+ courses?: CourseBE[];
839
+ school?: SchoolBE;
840
+ user?: UserBE;
841
+ }
842
+ /**
843
+ * Enrollment represents student enrollment in courses
844
+ */
845
+ export interface EnrollmentBE {
846
+ courseId: string;
847
+ createdAt: string;
848
+ enabled: boolean;
849
+ enrollmentDate: Date | string;
850
+ id: string;
851
+ sectionId: string;
852
+ studentProfileId: string;
853
+ updatedAt: string;
854
+ course?: CourseBE;
855
+ grades?: GradeBE[];
856
+ section?: SectionBE;
857
+ studentProfile?: StudentProfileBE;
858
+ }
859
+ /**
860
+ * Attendance tracks daily student presence in courses
861
+ */
862
+ export interface AttendanceBE {
863
+ createdAt: string;
864
+ date: Date | string;
865
+ enabled: boolean;
866
+ id: string;
867
+ remarks: string | null;
868
+ schoolId: string;
869
+ status: ATTENDANCE_STATUS;
870
+ studentProfileId: string;
871
+ updatedAt: string;
872
+ school?: SchoolBE;
873
+ studentProfile?: StudentProfileBE;
874
+ }
875
+ /**
876
+ * Grade represents student assessment results
877
+ */
878
+ export interface GradeBE {
879
+ assessmentDate: Date | string;
880
+ courseId: string;
881
+ createdAt: Date;
882
+ enabled: boolean;
883
+ enrollmentId: string;
884
+ grade: string | null;
885
+ gradeType: GRADE_TYPE;
886
+ id: string;
887
+ marksObtained: number;
888
+ maxMarks: number;
889
+ percentage: number | null;
890
+ remarks: string | null;
891
+ schoolId: string;
892
+ studentProfileId: string;
893
+ title: string;
894
+ updatedAt: Date;
895
+ course?: CourseBE;
896
+ enrollment?: EnrollmentBE;
897
+ school?: SchoolBE;
898
+ studentProfile?: StudentProfileBE;
899
+ }
900
+ /**
901
+ * Schedule represents class timetable
902
+ */
903
+ export interface ScheduleBE {
904
+ courseId: string;
905
+ createdAt: string;
906
+ dayOfWeek: DAY_OF_WEEK;
907
+ enabled: boolean;
908
+ endTime: string;
909
+ id: string;
910
+ room: string | null;
911
+ schoolId: string;
912
+ startTime: string;
913
+ updatedAt: string;
914
+ course?: CourseBE;
915
+ school?: SchoolBE;
916
+ }
917
+ /**
918
+ * FeeStructure defines fee templates for different classes/categories
919
+ */
920
+ export interface FeeStructureBE {
921
+ amount: number;
922
+ createdAt: string;
923
+ description: string | null;
924
+ enabled: boolean;
925
+ feeType: FEE_TYPE;
926
+ frequency: string | null;
927
+ id: string;
928
+ name: string;
929
+ schoolId: string;
930
+ updatedAt: string;
931
+ school?: SchoolBE;
932
+ studentFees?: StudentFeeBE[];
933
+ }
934
+ /**
935
+ * DiscountCode represents discount codes available for fee reductions
936
+ */
937
+ export interface DiscountCodeBE {
938
+ code: string;
939
+ createdAt: string;
940
+ description: string | null;
941
+ discountType: DISCOUNT_TYPE;
942
+ discountValue: number;
943
+ enabled: boolean;
944
+ id: string;
945
+ schoolId: string;
946
+ updatedAt: string;
947
+ school?: SchoolBE;
948
+ studentFees?: StudentFeeBE[];
949
+ }
950
+ /**
951
+ * StudentFee represents fees assigned to individual students
952
+ */
953
+ export interface StudentFeeBE {
954
+ amount: number;
955
+ amountDue: number;
956
+ amountPaid: number;
957
+ createdAt: string;
958
+ discountAmount: number | null;
959
+ discountCodeId: string | null;
960
+ dueDate: Date | string;
961
+ enabled: boolean;
962
+ familyId: string;
963
+ feeStructureId: string;
964
+ id: string;
965
+ lastRemindedAt: Date | string | null;
966
+ nextFollowUpAt: Date | string | null;
967
+ reliabilityScore: number | null;
968
+ remarks: string | null;
969
+ riskLevel: FEE_RISK_LEVEL | null;
970
+ schoolId: string;
971
+ status: PAYMENT_STATUS;
972
+ studentProfileId: string;
973
+ updatedAt: string;
974
+ agentActivities?: FeeAgentActivityBE[];
975
+ conversations?: FeeConversationBE[];
976
+ discountCode?: DiscountCodeBE;
977
+ family?: FamilyBE;
978
+ feeStructure?: FeeStructureBE;
979
+ school?: SchoolBE;
980
+ studentProfile?: StudentProfileBE;
981
+ }
982
+ export declare enum FEE_RISK_LEVEL {
983
+ LOW = "LOW",
984
+ MEDIUM = "MEDIUM",
985
+ HIGH = "HIGH"
986
+ }
987
+ export declare enum FEE_AGENT_ACTION_TYPE {
988
+ ANALYSIS = "ANALYSIS",
989
+ MESSAGE = "MESSAGE",
990
+ FOLLOW_UP = "FOLLOW_UP",
991
+ RESPONSE = "RESPONSE"
992
+ }
993
+ export declare enum FEE_CONVERSATION_SENDER {
994
+ AGENT = "AGENT",
995
+ PARENT = "PARENT"
996
+ }
997
+ export declare enum FEE_CONVERSATION_INTENT {
998
+ PROMISE = "PROMISE",
999
+ PAID = "PAID",
1000
+ DISPUTE = "DISPUTE",
1001
+ UNKNOWN = "UNKNOWN"
1002
+ }
1003
+ export interface FeeAgentActivityBE {
1004
+ actionType: FEE_AGENT_ACTION_TYPE;
1005
+ createdAt: string;
1006
+ id: string;
1007
+ payload: Record<string, unknown>;
1008
+ schoolId: string;
1009
+ status: string;
1010
+ studentFeeId: string;
1011
+ updatedAt: string;
1012
+ }
1013
+ export interface FeeConversationBE {
1014
+ createdAt: string;
1015
+ id: string;
1016
+ intent: FEE_CONVERSATION_INTENT;
1017
+ message: string;
1018
+ metadata: Record<string, unknown> | null;
1019
+ schoolId: string;
1020
+ sender: FEE_CONVERSATION_SENDER;
1021
+ studentFeeId: string;
1022
+ studentId: string;
1023
+ updatedAt: string;
1024
+ }
1025
+ /**
1026
+ * Expense represents outgoing payments and school expenditure tracking
1027
+ */
1028
+ export interface ExpenseBE {
1029
+ amount: number;
1030
+ approvedBy: string | null;
1031
+ attachments: string[];
1032
+ category: EXPENSE_CATEGORY;
1033
+ createdAt: string;
1034
+ description: string | null;
1035
+ enabled: boolean;
1036
+ expenseDate: Date | string;
1037
+ id: string;
1038
+ invoiceNumber: string | null;
1039
+ paidBy: string | null;
1040
+ paymentDate: Date | string | null;
1041
+ paymentMethod: PAYMENT_METHOD | null;
1042
+ receiptNumber: string | null;
1043
+ remarks: string | null;
1044
+ schoolId: string;
1045
+ status: EXPENSE_STATUS;
1046
+ title: string;
1047
+ transactionId: string | null;
1048
+ updatedAt: string;
1049
+ vendorContact: string | null;
1050
+ vendorName: string | null;
1051
+ school?: SchoolBE;
1052
+ }
1053
+ /**
1054
+ * WhatsApp broadcast campaign status
1055
+ */
1056
+ export declare enum CAMPAIGN_STATUS {
1057
+ DRAFT = "DRAFT",
1058
+ RUNNING = "RUNNING",
1059
+ COMPLETED = "COMPLETED",
1060
+ FAILED = "FAILED",
1061
+ PAUSED = "PAUSED"
1062
+ }
1063
+ /**
1064
+ * Delivery status for an individual campaign contact
1065
+ */
1066
+ export declare enum CAMPAIGN_CONTACT_STATUS {
1067
+ PENDING = "PENDING",
1068
+ SENT = "SENT",
1069
+ FAILED = "FAILED",
1070
+ SKIPPED = "SKIPPED"
1071
+ }
1072
+ /**
1073
+ * Individual recipient within a broadcast campaign
1074
+ */
1075
+ export interface CampaignContactBE {
1076
+ campaignId: string;
1077
+ createdAt: string;
1078
+ errorMessage: string | null;
1079
+ id: string;
1080
+ name: string;
1081
+ phoneNumber: string;
1082
+ sentAt: string | null;
1083
+ status: CAMPAIGN_CONTACT_STATUS;
1084
+ updatedAt: string;
1085
+ }
1086
+ /**
1087
+ * WhatsApp broadcast campaign
1088
+ */
1089
+ export interface CampaignBE {
1090
+ createdAt: string;
1091
+ enabled: boolean;
1092
+ id: string;
1093
+ messageTemplate: string;
1094
+ name: string;
1095
+ schoolId: string;
1096
+ status: CAMPAIGN_STATUS;
1097
+ updatedAt: string;
1098
+ workerJobId: string | null;
1099
+ contacts?: CampaignContactBE[];
1100
+ _count?: {
1101
+ contacts: number;
1102
+ };
1103
+ school?: SchoolBE;
1104
+ }
1105
+ /**
1106
+ * Channel through which a referral invite was sent
1107
+ */
1108
+ export declare enum REFERRAL_CHANNEL {
1109
+ EMAIL = "EMAIL",
1110
+ WHATSAPP = "WHATSAPP",
1111
+ BOTH = "BOTH"
1112
+ }
1113
+ /**
1114
+ * Status of a school referral invite
1115
+ */
1116
+ export declare enum REFERRAL_STATUS {
1117
+ PENDING = "PENDING",
1118
+ SENT = "SENT",
1119
+ FAILED = "FAILED"
1120
+ }
1121
+ /**
1122
+ * A referral invite sent by a school user to encourage another school to join the platform
1123
+ */
1124
+ export interface ReferralBE {
1125
+ channel: REFERRAL_CHANNEL;
1126
+ createdAt: string;
1127
+ enabled: boolean;
1128
+ errorMessage: string | null;
1129
+ id: string;
1130
+ inviterUserId: string;
1131
+ personalNote: string | null;
1132
+ recipientEmail: string | null;
1133
+ recipientName: string | null;
1134
+ recipientPhone: string | null;
1135
+ schoolId: string;
1136
+ sentAt: string | null;
1137
+ status: REFERRAL_STATUS;
1138
+ updatedAt: string;
1139
+ workerJobId: string | null;
1140
+ school?: SchoolBE;
1141
+ }