@blackcode_sa/metaestetics-api 1.11.3 → 1.12.0

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 (48) hide show
  1. package/dist/admin/index.d.mts +329 -318
  2. package/dist/admin/index.d.ts +329 -318
  3. package/dist/backoffice/index.d.mts +1166 -430
  4. package/dist/backoffice/index.d.ts +1166 -430
  5. package/dist/backoffice/index.js +1128 -245
  6. package/dist/backoffice/index.mjs +1119 -209
  7. package/dist/index.d.mts +4428 -4035
  8. package/dist/index.d.ts +4428 -4035
  9. package/dist/index.js +1642 -665
  10. package/dist/index.mjs +1406 -401
  11. package/package.json +1 -1
  12. package/src/backoffice/expo-safe/index.ts +3 -0
  13. package/src/backoffice/services/README.md +40 -0
  14. package/src/backoffice/services/brand.service.ts +85 -6
  15. package/src/backoffice/services/category.service.ts +92 -10
  16. package/src/backoffice/services/constants.service.ts +308 -0
  17. package/src/backoffice/services/documentation-template.service.ts +56 -2
  18. package/src/backoffice/services/index.ts +1 -0
  19. package/src/backoffice/services/product.service.ts +126 -5
  20. package/src/backoffice/services/requirement.service.ts +13 -0
  21. package/src/backoffice/services/subcategory.service.ts +184 -13
  22. package/src/backoffice/services/technology.service.ts +344 -129
  23. package/src/backoffice/types/admin-constants.types.ts +69 -0
  24. package/src/backoffice/types/brand.types.ts +1 -0
  25. package/src/backoffice/types/index.ts +1 -0
  26. package/src/backoffice/types/product.types.ts +31 -4
  27. package/src/backoffice/types/static/contraindication.types.ts +1 -0
  28. package/src/backoffice/types/static/treatment-benefit.types.ts +1 -0
  29. package/src/backoffice/types/technology.types.ts +113 -4
  30. package/src/backoffice/validations/schemas.ts +35 -9
  31. package/src/services/appointment/appointment.service.ts +0 -5
  32. package/src/services/appointment/utils/appointment.utils.ts +124 -113
  33. package/src/services/base.service.ts +10 -3
  34. package/src/services/documentation-templates/documentation-template.service.ts +116 -0
  35. package/src/services/media/media.service.ts +2 -2
  36. package/src/services/procedure/procedure.service.ts +436 -234
  37. package/src/types/appointment/index.ts +2 -3
  38. package/src/types/clinic/index.ts +1 -6
  39. package/src/types/patient/medical-info.types.ts +3 -3
  40. package/src/types/procedure/index.ts +20 -17
  41. package/src/validations/clinic.schema.ts +1 -6
  42. package/src/validations/patient/medical-info.schema.ts +7 -2
  43. package/src/backoffice/services/__tests__/brand.service.test.ts +0 -196
  44. package/src/backoffice/services/__tests__/category.service.test.ts +0 -201
  45. package/src/backoffice/services/__tests__/product.service.test.ts +0 -358
  46. package/src/backoffice/services/__tests__/requirement.service.test.ts +0 -226
  47. package/src/backoffice/services/__tests__/subcategory.service.test.ts +0 -181
  48. package/src/backoffice/services/__tests__/technology.service.test.ts +0 -1097
@@ -1,5 +1,6 @@
1
+ import * as _firebase_firestore from '@firebase/firestore';
2
+ import { Firestore, DocumentData, Timestamp, QueryDocumentSnapshot } from 'firebase/firestore';
1
3
  import { Auth } from 'firebase/auth';
2
- import { Firestore, QueryDocumentSnapshot, Timestamp } from 'firebase/firestore';
3
4
  import { FirebaseApp } from 'firebase/app';
4
5
  import { FirebaseStorage } from 'firebase/storage';
5
6
  import { z } from 'zod';
@@ -20,6 +21,7 @@ import { z } from 'zod';
20
21
  interface Brand {
21
22
  id?: string;
22
23
  name: string;
24
+ name_lowercase: string;
23
25
  manufacturer: string;
24
26
  createdAt: Date;
25
27
  updatedAt: Date;
@@ -37,7 +39,7 @@ declare class BaseService {
37
39
  protected auth: Auth;
38
40
  protected app: FirebaseApp;
39
41
  protected storage: FirebaseStorage;
40
- constructor(db: Firestore, auth: Auth, app: FirebaseApp);
42
+ constructor(db: Firestore, auth: Auth, app: FirebaseApp, storage?: FirebaseStorage);
41
43
  /**
42
44
  * Generiše jedinstveni ID za dokumente
43
45
  * Format: xxxxxxxxxxxx-timestamp
@@ -54,9 +56,10 @@ declare class BrandService extends BaseService {
54
56
  /**
55
57
  * Creates a new brand
56
58
  */
57
- create(brand: Omit<Brand, "id" | "createdAt" | "updatedAt">): Promise<{
59
+ create(brand: Omit<Brand, "id" | "createdAt" | "updatedAt" | "name_lowercase">): Promise<{
58
60
  createdAt: Date;
59
61
  updatedAt: Date;
62
+ name_lowercase: string;
60
63
  name: string;
61
64
  manufacturer: string;
62
65
  isActive: boolean;
@@ -65,13 +68,28 @@ declare class BrandService extends BaseService {
65
68
  id: string;
66
69
  }>;
67
70
  /**
68
- * Gets all active brands
71
+ * Gets a paginated list of active brands, optionally filtered by name.
72
+ * @param rowsPerPage - The number of brands to fetch.
73
+ * @param searchTerm - An optional string to filter brand names by (starts-with search).
74
+ * @param lastVisible - An optional document snapshot to use as a cursor for pagination.
69
75
  */
70
- getAll(): Promise<Brand[]>;
76
+ getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any): Promise<{
77
+ brands: Brand[];
78
+ lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
79
+ }>;
80
+ /**
81
+ * Gets the total count of active brands, optionally filtered by name.
82
+ * @param searchTerm - An optional string to filter brand names by (starts-with search).
83
+ */
84
+ getBrandsCount(searchTerm?: string): Promise<number>;
85
+ /**
86
+ * Gets all active brands for filter dropdowns (not paginated).
87
+ */
88
+ getAllForFilter(): Promise<Brand[]>;
71
89
  /**
72
90
  * Updates a brand
73
91
  */
74
- update(brandId: string, brand: Partial<Omit<Brand, "id" | "createdAt">>): Promise<Brand | null>;
92
+ update(brandId: string, brand: Partial<Omit<Brand, "id" | "createdAt" | "name_lowercase">>): Promise<Brand | null>;
75
93
  /**
76
94
  * Soft deletes a brand
77
95
  */
@@ -164,16 +182,43 @@ declare class CategoryService extends BaseService {
164
182
  id: string;
165
183
  }>;
166
184
  /**
167
- * Vraća sve aktivne kategorije
168
- * @returns Lista aktivnih kategorija
185
+ * Returns counts of categories for each family.
186
+ * @param active - Whether to count active or inactive categories.
187
+ * @returns A record mapping family to category count.
188
+ */
189
+ getCategoryCounts(active?: boolean): Promise<Record<string, number>>;
190
+ /**
191
+ * Vraća sve kategorije za potrebe filtera (bez paginacije)
192
+ * @returns Lista svih aktivnih kategorija
193
+ */
194
+ getAllForFilter(): Promise<Category[]>;
195
+ /**
196
+ * Vraća sve kategorije sa paginacijom
197
+ * @param options - Pagination and filter options
198
+ * @returns Lista kategorija i poslednji vidljiv dokument
169
199
  */
170
- getAll(): Promise<Category[]>;
200
+ getAll(options?: {
201
+ active?: boolean;
202
+ limit?: number;
203
+ lastVisible?: DocumentData;
204
+ }): Promise<{
205
+ categories: Category[];
206
+ lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
207
+ }>;
171
208
  /**
172
- * Vraća sve aktivne kategorije za određenu familiju procedura
209
+ * Vraća sve aktivne kategorije za određenu familiju procedura sa paginacijom
173
210
  * @param family - Familija procedura (aesthetics/surgery)
211
+ * @param options - Pagination options
174
212
  * @returns Lista kategorija koje pripadaju traženoj familiji
175
213
  */
176
- getAllByFamily(family: ProcedureFamily): Promise<Category[]>;
214
+ getAllByFamily(family: ProcedureFamily, options?: {
215
+ active?: boolean;
216
+ limit?: number;
217
+ lastVisible?: DocumentData;
218
+ }): Promise<{
219
+ categories: Category[];
220
+ lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
221
+ }>;
177
222
  /**
178
223
  * Ažurira postojeću kategoriju
179
224
  * @param id - ID kategorije koja se ažurira
@@ -186,6 +231,11 @@ declare class CategoryService extends BaseService {
186
231
  * @param id - ID kategorije koja se briše
187
232
  */
188
233
  delete(id: string): Promise<void>;
234
+ /**
235
+ * Reactivates a category by setting its isActive flag to true.
236
+ * @param id - The ID of the category to reactivate.
237
+ */
238
+ reactivate(id: string): Promise<void>;
189
239
  /**
190
240
  * Vraća kategoriju po ID-u
191
241
  * @param id - ID tražene kategorije
@@ -194,6 +244,83 @@ declare class CategoryService extends BaseService {
194
244
  getById(id: string): Promise<Category | null>;
195
245
  }
196
246
 
247
+ /**
248
+ * Condensed practitioner review information
249
+ * @description Used for aggregated data attached to practitioner documents
250
+ */
251
+ interface PractitionerReviewInfo {
252
+ totalReviews: number;
253
+ averageRating: number;
254
+ knowledgeAndExpertise: number;
255
+ communicationSkills: number;
256
+ bedSideManner: number;
257
+ thoroughness: number;
258
+ trustworthiness: number;
259
+ recommendationPercentage: number;
260
+ }
261
+
262
+ /**
263
+ * @file Defines types for dynamically managed administrative constants,
264
+ * such as treatment benefits and contraindications. These are stored in
265
+ * the 'admin-constants' collection in Firestore.
266
+ */
267
+ /**
268
+ * Represents a single dynamic treatment benefit.
269
+ * These are positive effects or results a patient can expect from a treatment.
270
+ */
271
+ interface TreatmentBenefitDynamic {
272
+ /**
273
+ * A unique identifier for the benefit, typically in snake_case.
274
+ * @example "wrinkle_reduction"
275
+ */
276
+ id: string;
277
+ /**
278
+ * A human-readable name for the treatment benefit.
279
+ * @example "Wrinkle Reduction"
280
+ */
281
+ name: string;
282
+ /**
283
+ * A detailed description of the benefit.
284
+ */
285
+ description?: string;
286
+ }
287
+ /**
288
+ * Defines the structure of the document storing all treatment benefits
289
+ * in the 'admin-constants' collection.
290
+ * The document ID for this type should be 'treatment-benefits'.
291
+ */
292
+ interface TreatmentBenefitsDocument {
293
+ benefits: TreatmentBenefitDynamic[];
294
+ }
295
+ /**
296
+ * Represents a single dynamic contraindication.
297
+ * These are conditions or factors that can affect a procedure and require special attention.
298
+ */
299
+ interface ContraindicationDynamic {
300
+ /**
301
+ * A unique identifier for the contraindication, typically in snake_case.
302
+ * @example "sensitive_skin"
303
+ */
304
+ id: string;
305
+ /**
306
+ * A human-readable name for the contraindication.
307
+ * @example "Sensitive Skin"
308
+ */
309
+ name: string;
310
+ /**
311
+ * A detailed description of the contraindication.
312
+ */
313
+ description?: string;
314
+ }
315
+ /**
316
+ * Defines the structure of the document storing all contraindications
317
+ * in the 'admin-constants' collection.
318
+ * The document ID for this type should be 'contraindications'.
319
+ */
320
+ interface ContraindicationsDocument {
321
+ contraindications: ContraindicationDynamic[];
322
+ }
323
+
197
324
  /**
198
325
  * Types for the Medical Documentation Templating System
199
326
  */
@@ -413,91 +540,6 @@ interface UpdateDocumentTemplateData {
413
540
  sortingOrder?: number;
414
541
  }
415
542
 
416
- /**
417
- * Service for managing documentation templates in the backoffice
418
- */
419
- declare class DocumentationTemplateServiceBackoffice {
420
- private apiService;
421
- /**
422
- * Constructor for DocumentationTemplateService
423
- * @param db - Firestore instance
424
- * @param auth - Firebase Auth instance
425
- * @param app - Firebase App instance
426
- */
427
- constructor(db: Firestore, auth: Auth, app: FirebaseApp);
428
- /**
429
- * Create a new document template
430
- * @param data - Template data
431
- * @param userId - ID of the user creating the template
432
- * @returns The created template
433
- */
434
- createTemplate(data: CreateDocumentTemplateData, userId: string): Promise<DocumentTemplate>;
435
- /**
436
- * Get a document template by ID
437
- * @param templateId - ID of the template to retrieve
438
- * @param version - Optional version number to retrieve (defaults to latest version)
439
- * @returns The template or null if not found
440
- */
441
- getTemplateById(templateId: string, version?: number): Promise<DocumentTemplate | null>;
442
- /**
443
- * Update an existing document template
444
- * @param templateId - ID of the template to update
445
- * @param data - Updated template data
446
- * @returns The updated template
447
- */
448
- updateTemplate(templateId: string, data: UpdateDocumentTemplateData): Promise<DocumentTemplate>;
449
- /**
450
- * Delete a document template
451
- * @param templateId - ID of the template to delete
452
- */
453
- deleteTemplate(templateId: string): Promise<void>;
454
- /**
455
- * Get all active templates
456
- * @param pageSize - Number of templates to retrieve
457
- * @param lastDoc - Last document from previous page for pagination
458
- * @returns Array of templates and the last document for pagination
459
- */
460
- getActiveTemplates(pageSize?: number, lastDoc?: QueryDocumentSnapshot<DocumentTemplate>): Promise<{
461
- templates: DocumentTemplate[];
462
- lastDoc: QueryDocumentSnapshot<DocumentTemplate> | null;
463
- }>;
464
- /**
465
- * Get templates by tags
466
- * @param tags - Tags to filter by
467
- * @param pageSize - Number of templates to retrieve
468
- * @param lastDoc - Last document from previous page for pagination
469
- * @returns Array of templates and the last document for pagination
470
- */
471
- getTemplatesByTags(tags: string[], pageSize?: number, lastDoc?: QueryDocumentSnapshot<DocumentTemplate>): Promise<{
472
- templates: DocumentTemplate[];
473
- lastDoc: QueryDocumentSnapshot<DocumentTemplate> | null;
474
- }>;
475
- /**
476
- * Get templates created by a specific user
477
- * @param userId - ID of the user who created the templates
478
- * @param pageSize - Number of templates to retrieve
479
- * @param lastDoc - Last document from previous page for pagination
480
- * @returns Array of templates and the last document for pagination
481
- */
482
- getTemplatesByCreator(userId: string, pageSize?: number, lastDoc?: QueryDocumentSnapshot<DocumentTemplate>): Promise<{
483
- templates: DocumentTemplate[];
484
- lastDoc: QueryDocumentSnapshot<DocumentTemplate> | null;
485
- }>;
486
- /**
487
- * Get a specific version of a template
488
- * @param templateId - ID of the template
489
- * @param versionNumber - Version number to retrieve
490
- * @returns The template version or null if not found
491
- */
492
- getTemplateVersion(templateId: string, versionNumber: number): Promise<DocumentTemplate | null>;
493
- /**
494
- * Get all versions of a template
495
- * @param templateId - ID of the template
496
- * @returns Array of template versions
497
- */
498
- getTemplateVersions(templateId: string): Promise<DocumentTemplate[]>;
499
- }
500
-
501
543
  /**
502
544
  * Product used in procedures
503
545
  * Can be consumables, equipment, or any other product needed for performing procedures
@@ -524,6 +566,8 @@ interface Product {
524
566
  brandName: string;
525
567
  technologyId: string;
526
568
  technologyName: string;
569
+ categoryId: string;
570
+ subcategoryId: string;
527
571
  createdAt: Date;
528
572
  updatedAt: Date;
529
573
  isActive: boolean;
@@ -533,7 +577,7 @@ interface Product {
533
577
  dosage?: string;
534
578
  composition?: string;
535
579
  indications?: string[];
536
- contraindications?: string[];
580
+ contraindications?: ContraindicationDynamic[];
537
581
  }
538
582
  /**
539
583
  * Collection in Firestore database where products are stored
@@ -551,10 +595,34 @@ interface IProductService {
551
595
  */
552
596
  create(technologyId: string, brandId: string, product: Omit<Product, "id" | "createdAt" | "updatedAt" | "brandId" | "technologyId">): Promise<Product>;
553
597
  /**
554
- * Gets all products for a technology
555
- * @param technologyId - ID of the technology
598
+ * Gets a paginated list of all products, with optional filters.
599
+ */
600
+ getAll(options: {
601
+ rowsPerPage: number;
602
+ lastVisible?: any;
603
+ categoryId?: string;
604
+ subcategoryId?: string;
605
+ technologyId?: string;
606
+ }): Promise<{
607
+ products: Product[];
608
+ lastVisible: any;
609
+ }>;
610
+ /**
611
+ * Gets the total count of active products, with optional filters.
612
+ */
613
+ getProductsCount(options: {
614
+ categoryId?: string;
615
+ subcategoryId?: string;
616
+ technologyId?: string;
617
+ }): Promise<number>;
618
+ /**
619
+ * Gets counts of active products grouped by category, subcategory, and technology.
556
620
  */
557
- getAllByTechnology(technologyId: string): Promise<Product[]>;
621
+ getProductCounts(): Promise<{
622
+ byCategory: Record<string, number>;
623
+ bySubcategory: Record<string, number>;
624
+ byTechnology: Record<string, number>;
625
+ }>;
558
626
  /**
559
627
  * Gets all products for a brand
560
628
  * @param brandId - ID of the brand
@@ -581,39 +649,6 @@ interface IProductService {
581
649
  getById(technologyId: string, productId: string): Promise<Product | null>;
582
650
  }
583
651
 
584
- declare class ProductService extends BaseService implements IProductService {
585
- /**
586
- * Gets reference to products collection under a technology
587
- * @param technologyId - ID of the technology
588
- * @returns Firestore collection reference
589
- */
590
- private getProductsRef;
591
- /**
592
- * Creates a new product under technology
593
- */
594
- create(technologyId: string, brandId: string, product: Omit<Product, "id" | "createdAt" | "updatedAt" | "brandId" | "technologyId">): Promise<Product>;
595
- /**
596
- * Gets all products for a technology
597
- */
598
- getAllByTechnology(technologyId: string): Promise<Product[]>;
599
- /**
600
- * Gets all products for a brand by filtering through all technologies
601
- */
602
- getAllByBrand(brandId: string): Promise<Product[]>;
603
- /**
604
- * Updates a product
605
- */
606
- update(technologyId: string, productId: string, product: Partial<Omit<Product, "id" | "createdAt" | "brandId" | "technologyId">>): Promise<Product | null>;
607
- /**
608
- * Soft deletes a product
609
- */
610
- delete(technologyId: string, productId: string): Promise<void>;
611
- /**
612
- * Gets a product by ID
613
- */
614
- getById(technologyId: string, productId: string): Promise<Product | null>;
615
- }
616
-
617
652
  /**
618
653
  * Jedinica mere za vremenski period
619
654
  */
@@ -674,90 +709,17 @@ interface Requirement {
674
709
  declare const REQUIREMENTS_COLLECTION = "backoffice_requirements";
675
710
 
676
711
  /**
677
- * Servis za upravljanje globalnim zahtevima.
678
- * Zahtevi se mogu kreirati globalno i zatim povezati sa različitim tehnologijama.
679
- * Ovo omogućava ponovno korišćenje istih zahteva za različite tehnologije.
680
- *
681
- * @example
682
- * const requirementService = new RequirementService();
712
+ * Podkategorija procedura
713
+ * Podkategorije su drugi nivo hijerarhije i pripadaju određenoj kategoriji
714
+ * One grupišu slične tehnologije u okviru kategorije
683
715
  *
684
- * // Kreiranje globalnog zahteva
685
- * const requirement = await requirementService.create({
686
- * type: "pre",
687
- * name: "Stay Hydrated",
688
- * description: "Drink plenty of water",
689
- * timeframe: {
690
- * duration: 2,
691
- * unit: "hours",
692
- * notifyAt: [2, 1]
693
- * },
694
- * importance: "high"
695
- * });
696
- */
697
- declare class RequirementService extends BaseService {
698
- /**
699
- * Referenca na Firestore kolekciju zahteva
700
- */
701
- private get requirementsRef();
702
- /**
703
- * Kreira novi globalni zahtev
704
- * @param requirement - Podaci za novi zahtev
705
- * @returns Kreirani zahtev sa generisanim ID-em
706
- */
707
- create(requirement: Omit<Requirement, "id" | "createdAt" | "updatedAt">): Promise<{
708
- createdAt: Date;
709
- updatedAt: Date;
710
- name: string;
711
- isActive: boolean;
712
- description: string;
713
- type: RequirementType;
714
- timeframe: TimeFrame;
715
- importance: RequirementImportance;
716
- id: string;
717
- }>;
718
- /**
719
- * Vraća sve aktivne zahteve
720
- * @returns Lista aktivnih zahteva
721
- */
722
- getAll(): Promise<Requirement[]>;
723
- /**
724
- * Vraća sve aktivne zahteve određenog tipa
725
- * @param type - Tip zahteva (pre/post)
726
- * @returns Lista zahteva određenog tipa
727
- */
728
- getAllByType(type: RequirementType): Promise<Requirement[]>;
729
- /**
730
- * Ažurira postojeći zahtev
731
- * @param id - ID zahteva koji se ažurira
732
- * @param requirement - Novi podaci za zahtev
733
- * @returns Ažurirani zahtev
734
- */
735
- update(id: string, requirement: Partial<Omit<Requirement, "id" | "createdAt">>): Promise<Requirement | null>;
736
- /**
737
- * Soft delete zahteva (postavlja isActive na false)
738
- * @param id - ID zahteva koji se briše
739
- */
740
- delete(id: string): Promise<void>;
741
- /**
742
- * Vraća zahtev po ID-u
743
- * @param id - ID traženog zahteva
744
- * @returns Zahtev ili null ako ne postoji
745
- */
746
- getById(id: string): Promise<Requirement | null>;
747
- }
748
-
749
- /**
750
- * Podkategorija procedura
751
- * Podkategorije su drugi nivo hijerarhije i pripadaju određenoj kategoriji
752
- * One grupišu slične tehnologije u okviru kategorije
753
- *
754
- * @property id - Jedinstveni identifikator podkategorije
755
- * @property name - Naziv podkategorije
756
- * @property description - Detaljan opis podkategorije i njene namene
757
- * @property categoryId - ID kategorije kojoj podkategorija pripada
758
- * @property isActive - Da li je podkategorija aktivna u sistemu
759
- * @property createdAt - Datum kreiranja
760
- * @property updatedAt - Datum poslednjeg ažuriranja
716
+ * @property id - Jedinstveni identifikator podkategorije
717
+ * @property name - Naziv podkategorije
718
+ * @property description - Detaljan opis podkategorije i njene namene
719
+ * @property categoryId - ID kategorije kojoj podkategorija pripada
720
+ * @property isActive - Da li je podkategorija aktivna u sistemu
721
+ * @property createdAt - Datum kreiranja
722
+ * @property updatedAt - Datum poslednjeg ažuriranja
761
723
  */
762
724
  interface Subcategory {
763
725
  /** Jedinstveni identifikator podkategorije (automatski generisan od strane Firestore) */
@@ -780,69 +742,6 @@ interface Subcategory {
780
742
  */
781
743
  declare const SUBCATEGORIES_COLLECTION = "subcategories";
782
744
 
783
- /**
784
- * Servis za upravljanje podkategorijama procedura.
785
- * Podkategorije su drugi nivo organizacije i pripadaju određenoj kategoriji.
786
- *
787
- * @example
788
- * const subcategoryService = new SubcategoryService();
789
- *
790
- * // Kreiranje nove podkategorije
791
- * const subcategory = await subcategoryService.create(categoryId, {
792
- * name: "Anti-Wrinkle",
793
- * description: "Treatments targeting facial wrinkles"
794
- * });
795
- */
796
- declare class SubcategoryService extends BaseService {
797
- /**
798
- * Vraća referencu na Firestore kolekciju podkategorija za određenu kategoriju
799
- * @param categoryId - ID roditeljske kategorije
800
- */
801
- private getSubcategoriesRef;
802
- /**
803
- * Kreira novu podkategoriju u okviru kategorije
804
- * @param categoryId - ID kategorije kojoj će pripadati nova podkategorija
805
- * @param subcategory - Podaci za novu podkategoriju
806
- * @returns Kreirana podkategorija sa generisanim ID-em
807
- */
808
- create(categoryId: string, subcategory: Omit<Subcategory, "id" | "createdAt" | "updatedAt">): Promise<{
809
- createdAt: Date;
810
- updatedAt: Date;
811
- name: string;
812
- isActive: boolean;
813
- description?: string | undefined;
814
- categoryId: string;
815
- id: string;
816
- }>;
817
- /**
818
- * Vraća sve aktivne podkategorije za određenu kategoriju
819
- * @param categoryId - ID kategorije čije podkategorije tražimo
820
- * @returns Lista aktivnih podkategorija
821
- */
822
- getAllByCategoryId(categoryId: string): Promise<Subcategory[]>;
823
- /**
824
- * Ažurira postojeću podkategoriju
825
- * @param categoryId - ID kategorije kojoj pripada podkategorija
826
- * @param subcategoryId - ID podkategorije koja se ažurira
827
- * @param subcategory - Novi podaci za podkategoriju
828
- * @returns Ažurirana podkategorija
829
- */
830
- update(categoryId: string, subcategoryId: string, subcategory: Partial<Omit<Subcategory, "id" | "createdAt" | "categoryId">>): Promise<Subcategory | null>;
831
- /**
832
- * Soft delete podkategorije (postavlja isActive na false)
833
- * @param categoryId - ID kategorije kojoj pripada podkategorija
834
- * @param subcategoryId - ID podkategorije koja se briše
835
- */
836
- delete(categoryId: string, subcategoryId: string): Promise<void>;
837
- /**
838
- * Vraća podkategoriju po ID-u
839
- * @param categoryId - ID kategorije kojoj pripada podkategorija
840
- * @param subcategoryId - ID tražene podkategorije
841
- * @returns Podkategorija ili null ako ne postoji
842
- */
843
- getById(categoryId: string, subcategoryId: string): Promise<Subcategory | null>;
844
- }
845
-
846
745
  /**
847
746
  * Blokirajući uslovi koji mogu sprečiti proceduru
848
747
  * Ovi uslovi predstavljaju apsolutne kontraindikacije koje onemogućavaju izvođenje procedure
@@ -865,47 +764,6 @@ declare enum BlockingCondition {
865
764
  EPILEPSY = "epilepsy"
866
765
  }
867
766
 
868
- /**
869
- * Kontraindikacije koje mogu uticati na proceduru
870
- * Ovi uslovi predstavljaju relativne kontraindikacije koje zahtevaju posebnu pažnju
871
- */
872
- declare enum Contraindication {
873
- SENSITIVE_SKIN = "sensitive_skin",
874
- RECENT_TANNING = "recent_tanning",
875
- RECENT_BOTOX = "recent_botox",
876
- RECENT_FILLERS = "recent_fillers",
877
- SKIN_ALLERGIES = "skin_allergies",
878
- MEDICATIONS = "medications",
879
- RECENT_CHEMICAL_PEEL = "recent_chemical_peel",
880
- RECENT_LASER = "recent_laser",
881
- SKIN_INFLAMMATION = "skin_inflammation",
882
- OPEN_WOUNDS = "open_wounds",
883
- HERPES_SIMPLEX = "herpes_simplex",
884
- COLD_SORES = "cold_sores"
885
- }
886
-
887
- /**
888
- * Benefiti koji se mogu očekivati od procedure
889
- * Lista mogućih pozitivnih efekata i rezultata tretmana
890
- */
891
- declare enum TreatmentBenefit {
892
- WRINKLE_REDUCTION = "wrinkle_reduction",
893
- SKIN_TIGHTENING = "skin_tightening",
894
- COLLAGEN_PRODUCTION = "collagen_production",
895
- ACNE_REDUCTION = "acne_reduction",
896
- SCAR_REDUCTION = "scar_reduction",
897
- PIGMENTATION_IMPROVEMENT = "pigmentation_improvement",
898
- HAIR_REMOVAL = "hair_removal",
899
- MUSCLE_TONING = "muscle_toning",
900
- FAT_REDUCTION = "fat_reduction",
901
- CELLULITE_REDUCTION = "cellulite_reduction",
902
- SKIN_REJUVENATION = "skin_rejuvenation",
903
- PORE_REDUCTION = "pore_reduction",
904
- TEXTURE_IMPROVEMENT = "texture_improvement",
905
- HYDRATION_BOOST = "hydration_boost",
906
- CIRCULATION_IMPROVEMENT = "circulation_improvement"
907
- }
908
-
909
767
  /**
910
768
  * Nivoi sertifikacije medicinskog osoblja, poređani od najnižeg do najvišeg
911
769
  */
@@ -999,8 +857,8 @@ interface Technology {
999
857
  post: Requirement[];
1000
858
  };
1001
859
  blockingConditions: BlockingCondition[];
1002
- contraindications: Contraindication[];
1003
- benefits: TreatmentBenefit[];
860
+ contraindications: ContraindicationDynamic[];
861
+ benefits: TreatmentBenefitDynamic[];
1004
862
  certificationRequirement: CertificationRequirement;
1005
863
  documentationTemplates?: TechnologyDocumentationTemplate[];
1006
864
  isActive: boolean;
@@ -1011,20 +869,87 @@ interface Technology {
1011
869
  * Collection in Firestore database where technologies are stored
1012
870
  */
1013
871
  declare const TECHNOLOGIES_COLLECTION = "technologies";
872
+ /**
873
+ * Interface for the TechnologyService class
874
+ */
875
+ interface ITechnologyService {
876
+ create(technology: Omit<Technology, "id" | "createdAt" | "updatedAt">): Promise<Technology>;
877
+ getTechnologyCounts(active?: boolean): Promise<Record<string, number>>;
878
+ getTechnologyCountsByCategory(active?: boolean): Promise<Record<string, number>>;
879
+ getAll(options?: {
880
+ active?: boolean;
881
+ limit?: number;
882
+ lastVisible?: any;
883
+ }): Promise<{
884
+ technologies: Technology[];
885
+ lastVisible: any;
886
+ }>;
887
+ getAllByCategoryId(categoryId: string, options?: {
888
+ active?: boolean;
889
+ limit?: number;
890
+ lastVisible?: any;
891
+ }): Promise<{
892
+ technologies: Technology[];
893
+ lastVisible: any;
894
+ }>;
895
+ getAllBySubcategoryId(subcategoryId: string, options?: {
896
+ active?: boolean;
897
+ limit?: number;
898
+ lastVisible?: any;
899
+ }): Promise<{
900
+ technologies: Technology[];
901
+ lastVisible: any;
902
+ }>;
903
+ update(id: string, technology: Partial<Omit<Technology, "id" | "createdAt">>): Promise<Technology | null>;
904
+ delete(id: string): Promise<void>;
905
+ reactivate(id: string): Promise<void>;
906
+ getById(id: string): Promise<Technology | null>;
907
+ addRequirement(technologyId: string, requirement: Requirement): Promise<Technology | null>;
908
+ removeRequirement(technologyId: string, requirement: Requirement): Promise<Technology | null>;
909
+ getRequirements(technologyId: string, type?: "pre" | "post"): Promise<Requirement[]>;
910
+ updateRequirement(technologyId: string, oldRequirement: Requirement, newRequirement: Requirement): Promise<Technology | null>;
911
+ addBlockingCondition(technologyId: string, condition: BlockingCondition): Promise<Technology | null>;
912
+ removeBlockingCondition(technologyId: string, condition: BlockingCondition): Promise<Technology | null>;
913
+ addContraindication(technologyId: string, contraindication: ContraindicationDynamic): Promise<Technology | null>;
914
+ removeContraindication(technologyId: string, contraindication: ContraindicationDynamic): Promise<Technology | null>;
915
+ updateContraindication(technologyId: string, contraindication: ContraindicationDynamic): Promise<Technology | null>;
916
+ addBenefit(technologyId: string, benefit: TreatmentBenefitDynamic): Promise<Technology | null>;
917
+ removeBenefit(technologyId: string, benefit: TreatmentBenefitDynamic): Promise<Technology | null>;
918
+ updateBenefit(technologyId: string, benefit: TreatmentBenefitDynamic): Promise<Technology | null>;
919
+ getBlockingConditions(technologyId: string): Promise<BlockingCondition[]>;
920
+ getContraindications(technologyId: string): Promise<ContraindicationDynamic[]>;
921
+ getBenefits(technologyId: string): Promise<TreatmentBenefitDynamic[]>;
922
+ updateCertificationRequirement(technologyId: string, certificationRequirement: CertificationRequirement): Promise<Technology | null>;
923
+ getCertificationRequirement(technologyId: string): Promise<CertificationRequirement | null>;
924
+ validateCertification(requiredCertification: CertificationRequirement, practitionerCertification: any): boolean;
925
+ getAllowedTechnologies(practitioner: any): Promise<{
926
+ technologies: Technology[];
927
+ families: ProcedureFamily[];
928
+ categories: string[];
929
+ subcategories: string[];
930
+ }>;
931
+ getAllForFilterBySubcategoryId(categoryId: string, subcategoryId: string): Promise<Technology[]>;
932
+ getAllForFilter(): Promise<Technology[]>;
933
+ }
1014
934
 
1015
935
  /**
1016
- * Condensed practitioner review information
1017
- * @description Used for aggregated data attached to practitioner documents
936
+ * @deprecated
937
+ * Kontraindikacije koje mogu uticati na proceduru
938
+ * Ovi uslovi predstavljaju relativne kontraindikacije koje zahtevaju posebnu pažnju
1018
939
  */
1019
- interface PractitionerReviewInfo {
1020
- totalReviews: number;
1021
- averageRating: number;
1022
- knowledgeAndExpertise: number;
1023
- communicationSkills: number;
1024
- bedSideManner: number;
1025
- thoroughness: number;
1026
- trustworthiness: number;
1027
- recommendationPercentage: number;
940
+ declare enum Contraindication {
941
+ SENSITIVE_SKIN = "sensitive_skin",
942
+ RECENT_TANNING = "recent_tanning",
943
+ RECENT_BOTOX = "recent_botox",
944
+ RECENT_FILLERS = "recent_fillers",
945
+ SKIN_ALLERGIES = "skin_allergies",
946
+ MEDICATIONS = "medications",
947
+ RECENT_CHEMICAL_PEEL = "recent_chemical_peel",
948
+ RECENT_LASER = "recent_laser",
949
+ SKIN_INFLAMMATION = "skin_inflammation",
950
+ OPEN_WOUNDS = "open_wounds",
951
+ HERPES_SIMPLEX = "herpes_simplex",
952
+ COLD_SORES = "cold_sores"
1028
953
  }
1029
954
 
1030
955
  declare enum PricingMeasure {
@@ -1043,6 +968,29 @@ declare enum Currency {
1043
968
  AUD = "AUD"
1044
969
  }
1045
970
 
971
+ /**
972
+ * @deprecated
973
+ * Benefiti koji se mogu očekivati od procedure
974
+ * Lista mogućih pozitivnih efekata i rezultata tretmana
975
+ */
976
+ declare enum TreatmentBenefit {
977
+ WRINKLE_REDUCTION = "wrinkle_reduction",
978
+ SKIN_TIGHTENING = "skin_tightening",
979
+ COLLAGEN_PRODUCTION = "collagen_production",
980
+ ACNE_REDUCTION = "acne_reduction",
981
+ SCAR_REDUCTION = "scar_reduction",
982
+ PIGMENTATION_IMPROVEMENT = "pigmentation_improvement",
983
+ HAIR_REMOVAL = "hair_removal",
984
+ MUSCLE_TONING = "muscle_toning",
985
+ FAT_REDUCTION = "fat_reduction",
986
+ CELLULITE_REDUCTION = "cellulite_reduction",
987
+ SKIN_REJUVENATION = "skin_rejuvenation",
988
+ PORE_REDUCTION = "pore_reduction",
989
+ TEXTURE_IMPROVEMENT = "texture_improvement",
990
+ HYDRATION_BOOST = "hydration_boost",
991
+ CIRCULATION_IMPROVEMENT = "circulation_improvement"
992
+ }
993
+
1046
994
  /**
1047
995
  * Type that allows a field to be either a URL string or a File object
1048
996
  */
@@ -1096,18 +1044,6 @@ interface ClinicLocation {
1096
1044
  tz?: string | null;
1097
1045
  }
1098
1046
 
1099
- /**
1100
- * Interface for clinic profile information
1101
- */
1102
- interface ClinicInfo {
1103
- id: string;
1104
- featuredPhoto: string;
1105
- name: string;
1106
- description?: string | null;
1107
- location: ClinicLocation;
1108
- contactInfo: ClinicContactInfo;
1109
- }
1110
-
1111
1047
  /**
1112
1048
  * Osnovne informacije o zdravstvenom radniku
1113
1049
  */
@@ -1205,38 +1141,520 @@ interface Practitioner {
1205
1141
  }
1206
1142
 
1207
1143
  /**
1208
- * Servis za upravljanje tehnologijama i njihovim zahtevima.
1209
- * Tehnologije su sada top-level kolekcija koja referencira svoju putanju u hijerarhiji
1210
- * kroz family, categoryId i subcategoryId.
1211
- *
1212
- * @example
1213
- * const technologyService = new TechnologyService();
1214
- *
1215
- * // Kreiranje nove tehnologije
1216
- * const technology = await technologyService.create({
1217
- * name: "Botulinum Toxin",
1218
- * description: "Neurotoxin injections for wrinkle reduction",
1219
- * family: ProcedureFamily.AESTHETICS,
1220
- * categoryId: "category123",
1221
- * subcategoryId: "subcategory456"
1222
- * });
1223
- *
1224
- * // Dodavanje zahteva
1225
- * await technologyService.addRequirement(technology.id, {
1226
- * type: "pre",
1227
- * name: "Stay Hydrated",
1228
- * description: "Drink plenty of water"
1229
- * });
1144
+ * Interface for clinic profile information
1145
+ */
1146
+ interface ClinicInfo {
1147
+ id: string;
1148
+ featuredPhoto: string;
1149
+ name: string;
1150
+ description?: string | null;
1151
+ location: ClinicLocation;
1152
+ contactInfo: ClinicContactInfo;
1153
+ }
1154
+
1155
+ /**
1156
+ * Service for managing documentation templates
1157
+ */
1158
+ declare class DocumentationTemplateService extends BaseService {
1159
+ private readonly collectionRef;
1160
+ constructor(...args: ConstructorParameters<typeof BaseService>);
1161
+ /**
1162
+ * Create a new document template
1163
+ * @param data - Template data
1164
+ * @param userId - ID of the user creating the template
1165
+ * @returns The created template
1166
+ */
1167
+ createTemplate(data: CreateDocumentTemplateData, userId: string): Promise<DocumentTemplate>;
1168
+ /**
1169
+ * Get a document template by ID
1170
+ * @param templateId - ID of the template to retrieve
1171
+ * @param version - Optional version number to retrieve (defaults to latest version)
1172
+ * @returns The template or null if not found
1173
+ */
1174
+ getTemplateById(templateId: string, version?: number): Promise<DocumentTemplate | null>;
1175
+ /**
1176
+ * Update an existing document template
1177
+ * @param templateId - ID of the template to update
1178
+ * @param data - Updated template data
1179
+ * @returns The updated template
1180
+ */
1181
+ updateTemplate(templateId: string, data: UpdateDocumentTemplateData): Promise<DocumentTemplate>;
1182
+ /**
1183
+ * Get a specific version of a template
1184
+ * @param templateId - ID of the template
1185
+ * @param versionNumber - Version number to retrieve
1186
+ * @returns The template version or null if not found
1187
+ */
1188
+ getTemplateVersion(templateId: string, versionNumber: number): Promise<DocumentTemplate | null>;
1189
+ /**
1190
+ * Get all versions of a template
1191
+ * @param templateId - ID of the template
1192
+ * @returns Array of template versions
1193
+ */
1194
+ getTemplateOldVersions(templateId: string): Promise<DocumentTemplate[]>;
1195
+ /**
1196
+ * Delete a document template
1197
+ * @param templateId - ID of the template to delete
1198
+ */
1199
+ deleteTemplate(templateId: string): Promise<void>;
1200
+ /**
1201
+ * Get all active templates
1202
+ * @param pageSize - Number of templates to retrieve
1203
+ * @param lastDoc - Last document from previous page for pagination
1204
+ * @returns Array of templates and the last document for pagination
1205
+ */
1206
+ getActiveTemplates(pageSize?: number, lastDoc?: QueryDocumentSnapshot<DocumentTemplate>): Promise<{
1207
+ templates: DocumentTemplate[];
1208
+ lastDoc: QueryDocumentSnapshot<DocumentTemplate> | null;
1209
+ }>;
1210
+ /**
1211
+ * Get all active templates with optional filters and pagination.
1212
+ * @param options - Options for filtering and pagination.
1213
+ * @returns A promise that resolves to the templates and the last visible document.
1214
+ */
1215
+ getTemplates(options: {
1216
+ pageSize?: number;
1217
+ lastDoc?: QueryDocumentSnapshot<DocumentTemplate>;
1218
+ isUserForm?: boolean;
1219
+ isRequired?: boolean;
1220
+ sortingOrder?: number;
1221
+ }): Promise<{
1222
+ templates: DocumentTemplate[];
1223
+ lastDoc: QueryDocumentSnapshot<DocumentTemplate> | null;
1224
+ }>;
1225
+ /**
1226
+ * Get the total count of active templates with optional filters.
1227
+ * @param options - Options for filtering.
1228
+ * @returns A promise that resolves to the total count of templates.
1229
+ */
1230
+ getTemplatesCount(options: {
1231
+ isUserForm?: boolean;
1232
+ isRequired?: boolean;
1233
+ sortingOrder?: number;
1234
+ search?: string;
1235
+ }): Promise<number>;
1236
+ /**
1237
+ * Get all active templates without pagination for filtering purposes.
1238
+ * @returns A promise that resolves to an array of all active templates.
1239
+ */
1240
+ getAllActiveTemplates(): Promise<DocumentTemplate[]>;
1241
+ /**
1242
+ * Get templates by tags
1243
+ * @param tags - Tags to filter by
1244
+ * @param pageSize - Number of templates to retrieve
1245
+ * @param lastDoc - Last document from previous page for pagination
1246
+ * @returns Array of templates and the last document for pagination
1247
+ */
1248
+ getTemplatesByTags(tags: string[], pageSize?: number, lastDoc?: QueryDocumentSnapshot<DocumentTemplate>): Promise<{
1249
+ templates: DocumentTemplate[];
1250
+ lastDoc: QueryDocumentSnapshot<DocumentTemplate> | null;
1251
+ }>;
1252
+ /**
1253
+ * Get templates created by a specific user
1254
+ * @param userId - ID of the user who created the templates
1255
+ * @param pageSize - Number of templates to retrieve
1256
+ * @param lastDoc - Last document from previous page for pagination
1257
+ * @returns Array of templates and the last document for pagination
1258
+ */
1259
+ getTemplatesByCreator(userId: string, pageSize?: number, lastDoc?: QueryDocumentSnapshot<DocumentTemplate>): Promise<{
1260
+ templates: DocumentTemplate[];
1261
+ lastDoc: QueryDocumentSnapshot<DocumentTemplate> | null;
1262
+ }>;
1263
+ /**
1264
+ * Get all templates for selection with optional filtering
1265
+ * @param options - Filtering options
1266
+ * @returns Array of templates
1267
+ */
1268
+ getAllTemplatesForSelection(options?: {
1269
+ isUserForm?: boolean;
1270
+ isRequired?: boolean;
1271
+ }): Promise<DocumentTemplate[]>;
1272
+ }
1273
+
1274
+ /**
1275
+ * Service for managing documentation templates in the backoffice
1276
+ */
1277
+ declare class DocumentationTemplateServiceBackoffice {
1278
+ private apiService;
1279
+ /**
1280
+ * Constructor for DocumentationTemplateService
1281
+ * @param db - Firestore instance
1282
+ * @param auth - Firebase Auth instance
1283
+ * @param app - Firebase App instance
1284
+ */
1285
+ constructor(...args: ConstructorParameters<typeof DocumentationTemplateService>);
1286
+ /**
1287
+ * Create a new document template
1288
+ * @param data - Template data
1289
+ * @param userId - ID of the user creating the template
1290
+ * @returns The created template
1291
+ */
1292
+ createTemplate(data: CreateDocumentTemplateData, userId: string): Promise<DocumentTemplate>;
1293
+ /**
1294
+ * Get a document template by ID
1295
+ * @param templateId - ID of the template to retrieve
1296
+ * @param version - Optional version number to retrieve (defaults to latest version)
1297
+ * @returns The template or null if not found
1298
+ */
1299
+ getTemplateById(templateId: string, version?: number): Promise<DocumentTemplate | null>;
1300
+ /**
1301
+ * Update an existing document template
1302
+ * @param templateId - ID of the template to update
1303
+ * @param data - Updated template data
1304
+ * @returns The updated template
1305
+ */
1306
+ updateTemplate(templateId: string, data: UpdateDocumentTemplateData): Promise<DocumentTemplate>;
1307
+ /**
1308
+ * Delete a document template
1309
+ * @param templateId - ID of the template to delete
1310
+ */
1311
+ deleteTemplate(templateId: string): Promise<void>;
1312
+ /**
1313
+ * Get all active templates
1314
+ * @param pageSize - Number of templates to retrieve
1315
+ * @param lastDoc - Last document from previous page for pagination
1316
+ * @returns Array of templates and the last document for pagination
1317
+ */
1318
+ getActiveTemplates(pageSize?: number, lastDoc?: QueryDocumentSnapshot<DocumentTemplate>): Promise<{
1319
+ templates: DocumentTemplate[];
1320
+ lastDoc: QueryDocumentSnapshot<DocumentTemplate> | null;
1321
+ }>;
1322
+ /**
1323
+ * Get all active templates with optional filters and pagination.
1324
+ * @param options - Options for filtering and pagination.
1325
+ * @returns A promise that resolves to the templates and the last visible document.
1326
+ */
1327
+ getTemplates(options: {
1328
+ pageSize?: number;
1329
+ lastDoc?: QueryDocumentSnapshot<DocumentTemplate>;
1330
+ isUserForm?: boolean;
1331
+ isRequired?: boolean;
1332
+ sortingOrder?: number;
1333
+ }): Promise<{
1334
+ templates: DocumentTemplate[];
1335
+ lastDoc: QueryDocumentSnapshot<DocumentTemplate> | null;
1336
+ }>;
1337
+ /**
1338
+ * Get the total count of active templates with optional filters.
1339
+ * @param options - Options for filtering.
1340
+ * @returns A promise that resolves to the total count of templates.
1341
+ */
1342
+ getTemplatesCount(options: {
1343
+ isUserForm?: boolean;
1344
+ isRequired?: boolean;
1345
+ sortingOrder?: number;
1346
+ search?: string;
1347
+ }): Promise<number>;
1348
+ /**
1349
+ * Get all active templates without pagination for filtering purposes.
1350
+ * @returns A promise that resolves to an array of all active templates.
1351
+ */
1352
+ getAllActiveTemplates(): Promise<DocumentTemplate[]>;
1353
+ /**
1354
+ * Searches for active templates by title.
1355
+ * @param title - The title to search for.
1356
+ * @returns A list of templates that match the search criteria.
1357
+ */
1358
+ search(title: string): Promise<DocumentTemplate[]>;
1359
+ /**
1360
+ * Get templates by tags
1361
+ * @param tags - Tags to filter by
1362
+ * @param pageSize - Number of templates to retrieve
1363
+ * @param lastDoc - Last document from previous page for pagination
1364
+ * @returns Array of templates and the last document for pagination
1365
+ */
1366
+ getTemplatesByTags(tags: string[], pageSize?: number, lastDoc?: QueryDocumentSnapshot<DocumentTemplate>): Promise<{
1367
+ templates: DocumentTemplate[];
1368
+ lastDoc: QueryDocumentSnapshot<DocumentTemplate> | null;
1369
+ }>;
1370
+ /**
1371
+ * Get templates created by a specific user
1372
+ * @param userId - ID of the user who created the templates
1373
+ * @param pageSize - Number of templates to retrieve
1374
+ * @param lastDoc - Last document from previous page for pagination
1375
+ * @returns Array of templates and the last document for pagination
1376
+ */
1377
+ getTemplatesByCreator(userId: string, pageSize?: number, lastDoc?: QueryDocumentSnapshot<DocumentTemplate>): Promise<{
1378
+ templates: DocumentTemplate[];
1379
+ lastDoc: QueryDocumentSnapshot<DocumentTemplate> | null;
1380
+ }>;
1381
+ /**
1382
+ * Get a specific version of a template
1383
+ * @param templateId - ID of the template
1384
+ * @param versionNumber - Version number to retrieve
1385
+ * @returns The template version or null if not found
1386
+ */
1387
+ getTemplateVersion(templateId: string, versionNumber: number): Promise<DocumentTemplate | null>;
1388
+ /**
1389
+ * Get all versions of a template
1390
+ * @param templateId - ID of the template
1391
+ * @returns Array of template versions
1392
+ */
1393
+ getTemplateVersions(templateId: string): Promise<DocumentTemplate[]>;
1394
+ }
1395
+
1396
+ declare class ProductService extends BaseService implements IProductService {
1397
+ /**
1398
+ * Gets reference to products collection under a technology
1399
+ * @param technologyId - ID of the technology
1400
+ * @returns Firestore collection reference
1401
+ */
1402
+ private getProductsRef;
1403
+ /**
1404
+ * Creates a new product under technology
1405
+ */
1406
+ create(technologyId: string, brandId: string, product: Omit<Product, "id" | "createdAt" | "updatedAt" | "brandId" | "technologyId">): Promise<Product>;
1407
+ /**
1408
+ * Gets a paginated list of all products, with optional filters.
1409
+ * This uses a collectionGroup query to search across all technologies.
1410
+ */
1411
+ getAll(options: {
1412
+ rowsPerPage: number;
1413
+ lastVisible?: any;
1414
+ categoryId?: string;
1415
+ subcategoryId?: string;
1416
+ technologyId?: string;
1417
+ }): Promise<{
1418
+ products: Product[];
1419
+ lastVisible: any;
1420
+ }>;
1421
+ /**
1422
+ * Gets the total count of active products, with optional filters.
1423
+ */
1424
+ getProductsCount(options: {
1425
+ categoryId?: string;
1426
+ subcategoryId?: string;
1427
+ technologyId?: string;
1428
+ }): Promise<number>;
1429
+ /**
1430
+ * Gets counts of active products grouped by category, subcategory, and technology.
1431
+ * This uses a single collectionGroup query for efficiency.
1432
+ */
1433
+ getProductCounts(): Promise<{
1434
+ byCategory: Record<string, number>;
1435
+ bySubcategory: Record<string, number>;
1436
+ byTechnology: Record<string, number>;
1437
+ }>;
1438
+ /**
1439
+ * Gets all products for a brand by filtering through all technologies
1440
+ */
1441
+ getAllByBrand(brandId: string): Promise<Product[]>;
1442
+ /**
1443
+ * Updates a product
1444
+ */
1445
+ update(technologyId: string, productId: string, product: Partial<Omit<Product, "id" | "createdAt" | "brandId" | "technologyId">>): Promise<Product | null>;
1446
+ /**
1447
+ * Soft deletes a product
1448
+ */
1449
+ delete(technologyId: string, productId: string): Promise<void>;
1450
+ /**
1451
+ * Gets a product by ID
1452
+ */
1453
+ getById(technologyId: string, productId: string): Promise<Product | null>;
1454
+ }
1455
+
1456
+ /**
1457
+ * Servis za upravljanje globalnim zahtevima.
1458
+ * Zahtevi se mogu kreirati globalno i zatim povezati sa različitim tehnologijama.
1459
+ * Ovo omogućava ponovno korišćenje istih zahteva za različite tehnologije.
1460
+ *
1461
+ * @example
1462
+ * const requirementService = new RequirementService();
1463
+ *
1464
+ * // Kreiranje globalnog zahteva
1465
+ * const requirement = await requirementService.create({
1466
+ * type: "pre",
1467
+ * name: "Stay Hydrated",
1468
+ * description: "Drink plenty of water",
1469
+ * timeframe: {
1470
+ * duration: 2,
1471
+ * unit: "hours",
1472
+ * notifyAt: [2, 1]
1473
+ * },
1474
+ * importance: "high"
1475
+ * });
1476
+ */
1477
+ declare class RequirementService extends BaseService {
1478
+ /**
1479
+ * Referenca na Firestore kolekciju zahteva
1480
+ */
1481
+ private get requirementsRef();
1482
+ /**
1483
+ * Kreira novi globalni zahtev
1484
+ * @param requirement - Podaci za novi zahtev
1485
+ * @returns Kreirani zahtev sa generisanim ID-em
1486
+ */
1487
+ create(requirement: Omit<Requirement, "id" | "createdAt" | "updatedAt">): Promise<{
1488
+ createdAt: Date;
1489
+ updatedAt: Date;
1490
+ name: string;
1491
+ isActive: boolean;
1492
+ description: string;
1493
+ type: RequirementType;
1494
+ timeframe: TimeFrame;
1495
+ importance: RequirementImportance;
1496
+ id: string;
1497
+ }>;
1498
+ /**
1499
+ * Vraća sve aktivne zahteve
1500
+ * @returns Lista aktivnih zahteva
1501
+ */
1502
+ getAll(): Promise<Requirement[]>;
1503
+ /**
1504
+ * Vraća sve aktivne zahteve određenog tipa
1505
+ * @param type - Tip zahteva (pre/post)
1506
+ * @returns Lista zahteva određenog tipa
1507
+ */
1508
+ getAllByType(type: RequirementType): Promise<Requirement[]>;
1509
+ /**
1510
+ * Searches for requirements by name.
1511
+ * @param name - The name to search for.
1512
+ * @param type - The type of requirement (pre/post).
1513
+ * @returns A list of requirements that match the search criteria.
1514
+ */
1515
+ search(name: string, type: RequirementType): Promise<Requirement[]>;
1516
+ /**
1517
+ * Ažurira postojeći zahtev
1518
+ * @param id - ID zahteva koji se ažurira
1519
+ * @param requirement - Novi podaci za zahtev
1520
+ * @returns Ažurirani zahtev
1521
+ */
1522
+ update(id: string, requirement: Partial<Omit<Requirement, "id" | "createdAt">>): Promise<Requirement | null>;
1523
+ /**
1524
+ * Soft delete zahteva (postavlja isActive na false)
1525
+ * @param id - ID zahteva koji se briše
1526
+ */
1527
+ delete(id: string): Promise<void>;
1528
+ /**
1529
+ * Vraća zahtev po ID-u
1530
+ * @param id - ID traženog zahteva
1531
+ * @returns Zahtev ili null ako ne postoji
1532
+ */
1533
+ getById(id: string): Promise<Requirement | null>;
1534
+ }
1535
+
1536
+ /**
1537
+ * Servis za upravljanje podkategorijama procedura.
1538
+ * Podkategorije su drugi nivo organizacije i pripadaju određenoj kategoriji.
1539
+ *
1540
+ * @example
1541
+ * const subcategoryService = new SubcategoryService();
1542
+ *
1543
+ * // Kreiranje nove podkategorije
1544
+ * const subcategory = await subcategoryService.create(categoryId, {
1545
+ * name: "Anti-Wrinkle",
1546
+ * description: "Treatments targeting facial wrinkles"
1547
+ * });
1548
+ */
1549
+ declare class SubcategoryService extends BaseService {
1550
+ /**
1551
+ * Vraća referencu na Firestore kolekciju podkategorija za određenu kategoriju
1552
+ * @param categoryId - ID roditeljske kategorije
1553
+ */
1554
+ private getSubcategoriesRef;
1555
+ /**
1556
+ * Kreira novu podkategoriju u okviru kategorije
1557
+ * @param categoryId - ID kategorije kojoj će pripadati nova podkategorija
1558
+ * @param subcategory - Podaci za novu podkategoriju
1559
+ * @returns Kreirana podkategorija sa generisanim ID-em
1560
+ */
1561
+ create(categoryId: string, subcategory: Omit<Subcategory, "id" | "createdAt" | "updatedAt">): Promise<{
1562
+ createdAt: Date;
1563
+ updatedAt: Date;
1564
+ name: string;
1565
+ isActive: boolean;
1566
+ description?: string | undefined;
1567
+ categoryId: string;
1568
+ id: string;
1569
+ }>;
1570
+ /**
1571
+ * Returns counts of subcategories for all categories.
1572
+ * @param active - Whether to count active or inactive subcategories.
1573
+ * @returns A record mapping category ID to subcategory count.
1574
+ */
1575
+ getSubcategoryCounts(active?: boolean): Promise<Record<string, number>>;
1576
+ /**
1577
+ * Vraća sve aktivne podkategorije za određenu kategoriju sa paginacijom
1578
+ * @param categoryId - ID kategorije čije podkategorije tražimo
1579
+ * @param options - Pagination options
1580
+ * @returns Lista aktivnih podkategorija i poslednji vidljiv dokument
1581
+ */
1582
+ getAllByCategoryId(categoryId: string, options?: {
1583
+ active?: boolean;
1584
+ limit?: number;
1585
+ lastVisible?: DocumentData;
1586
+ }): Promise<{
1587
+ subcategories: Subcategory[];
1588
+ lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
1589
+ }>;
1590
+ /**
1591
+ * Vraća sve podkategorije sa paginacijom koristeći collection group query.
1592
+ * NOTE: This query requires a composite index in Firestore on the 'subcategories' collection group.
1593
+ * The index should be on 'isActive' (ascending) and 'name' (ascending).
1594
+ * Firestore will provide a link to create this index in the console error if it's missing.
1595
+ * @param options - Pagination options
1596
+ * @returns Lista podkategorija i poslednji vidljiv dokument
1597
+ */
1598
+ getAll(options?: {
1599
+ active?: boolean;
1600
+ limit?: number;
1601
+ lastVisible?: DocumentData;
1602
+ }): Promise<{
1603
+ subcategories: Subcategory[];
1604
+ lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
1605
+ }>;
1606
+ /**
1607
+ * Vraća sve subkategorije za određenu kategoriju za potrebe filtera (bez paginacije)
1608
+ * @param categoryId - ID kategorije čije subkategorije tražimo
1609
+ * @returns Lista svih aktivnih subkategorija
1610
+ */
1611
+ getAllForFilterByCategoryId(categoryId: string): Promise<Subcategory[]>;
1612
+ /**
1613
+ * Vraća sve subkategorije za potrebe filtera (bez paginacije)
1614
+ * @returns Lista svih aktivnih subkategorija
1615
+ */
1616
+ getAllForFilter(): Promise<Subcategory[]>;
1617
+ /**
1618
+ * Ažurira postojeću podkategoriju
1619
+ * @param categoryId - ID kategorije kojoj pripada podkategorija
1620
+ * @param subcategoryId - ID podkategorije koja se ažurira
1621
+ * @param subcategory - Novi podaci za podkategoriju
1622
+ * @returns Ažurirana podkategorija
1623
+ */
1624
+ update(categoryId: string, subcategoryId: string, subcategory: Partial<Omit<Subcategory, "id" | "createdAt">>): Promise<Subcategory | null>;
1625
+ /**
1626
+ * Soft delete podkategorije (postavlja isActive na false)
1627
+ * @param categoryId - ID kategorije kojoj pripada podkategorija
1628
+ * @param subcategoryId - ID podkategorije koja se briše
1629
+ */
1630
+ delete(categoryId: string, subcategoryId: string): Promise<void>;
1631
+ /**
1632
+ * Reactivates a subcategory by setting its isActive flag to true.
1633
+ * @param categoryId - The ID of the category to which the subcategory belongs.
1634
+ * @param subcategoryId - The ID of the subcategory to reactivate.
1635
+ */
1636
+ reactivate(categoryId: string, subcategoryId: string): Promise<void>;
1637
+ /**
1638
+ * Vraća podkategoriju po ID-u
1639
+ * @param categoryId - ID kategorije kojoj pripada podkategorija
1640
+ * @param subcategoryId - ID tražene podkategorije
1641
+ * @returns Podkategorija ili null ako ne postoji
1642
+ */
1643
+ getById(categoryId: string, subcategoryId: string): Promise<Subcategory | null>;
1644
+ }
1645
+
1646
+ /**
1647
+ * Service for managing technologies.
1230
1648
  */
1231
1649
  declare class TechnologyService extends BaseService {
1232
1650
  /**
1233
- * Vraća referencu na Firestore kolekciju tehnologija
1651
+ * Reference to the Firestore collection of technologies.
1234
1652
  */
1235
- private getTechnologiesRef;
1653
+ private get technologiesRef();
1236
1654
  /**
1237
- * Kreira novu tehnologiju
1238
- * @param technology - Podaci za novu tehnologiju
1239
- * @returns Kreirana tehnologija sa generisanim ID-em
1655
+ * Creates a new technology.
1656
+ * @param technology - Data for the new technology.
1657
+ * @returns The created technology with its generated ID.
1240
1658
  */
1241
1659
  create(technology: Omit<Technology, "id" | "createdAt" | "updatedAt">): Promise<{
1242
1660
  createdAt: Date;
@@ -1245,61 +1663,96 @@ declare class TechnologyService extends BaseService {
1245
1663
  isActive: boolean;
1246
1664
  description: string;
1247
1665
  family: ProcedureFamily;
1248
- technicalDetails?: string | undefined;
1249
- contraindications: Contraindication[];
1250
- blockingConditions: BlockingCondition[];
1251
1666
  categoryId: string;
1252
1667
  subcategoryId: string;
1668
+ technicalDetails?: string | undefined;
1669
+ contraindications: ContraindicationDynamic[];
1253
1670
  requirements: {
1254
1671
  pre: Requirement[];
1255
1672
  post: Requirement[];
1256
1673
  };
1257
- benefits: TreatmentBenefit[];
1674
+ blockingConditions: BlockingCondition[];
1675
+ benefits: TreatmentBenefitDynamic[];
1258
1676
  certificationRequirement: CertificationRequirement;
1259
1677
  documentationTemplates?: TechnologyDocumentationTemplate[] | undefined;
1260
1678
  id: string;
1261
1679
  }>;
1262
1680
  /**
1263
- * Vraća sve aktivne tehnologije
1264
- * @returns Lista aktivnih tehnologija
1681
+ * Returns counts of technologies for each subcategory.
1682
+ * @param active - Whether to count active or inactive technologies.
1683
+ * @returns A record mapping subcategory ID to technology count.
1265
1684
  */
1266
- getAll(): Promise<Technology[]>;
1685
+ getTechnologyCounts(active?: boolean): Promise<Record<string, number>>;
1267
1686
  /**
1268
- * Vraća sve aktivne tehnologije za određenu familiju
1269
- * @param family - Familija procedura
1270
- * @returns Lista aktivnih tehnologija
1687
+ * Returns counts of technologies for each category.
1688
+ * @param active - Whether to count active or inactive technologies.
1689
+ * @returns A record mapping category ID to technology count.
1271
1690
  */
1272
- getAllByFamily(family: ProcedureFamily): Promise<Technology[]>;
1691
+ getTechnologyCountsByCategory(active?: boolean): Promise<Record<string, number>>;
1273
1692
  /**
1274
- * Vraća sve aktivne tehnologije za određenu kategoriju
1275
- * @param categoryId - ID kategorije
1276
- * @returns Lista aktivnih tehnologija
1693
+ * Returns all technologies with pagination.
1694
+ * @param options - Pagination and filter options.
1695
+ * @returns A list of technologies and the last visible document.
1277
1696
  */
1278
- getAllByCategoryId(categoryId: string): Promise<Technology[]>;
1697
+ getAll(options?: {
1698
+ active?: boolean;
1699
+ limit?: number;
1700
+ lastVisible?: DocumentData;
1701
+ }): Promise<{
1702
+ technologies: Technology[];
1703
+ lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
1704
+ }>;
1279
1705
  /**
1280
- * Vraća sve aktivne tehnologije za određenu podkategoriju
1281
- * @param subcategoryId - ID podkategorije
1282
- * @returns Lista aktivnih tehnologija
1706
+ * Returns all technologies for a specific category with pagination.
1707
+ * @param categoryId - The ID of the category.
1708
+ * @param options - Pagination options.
1709
+ * @returns A list of technologies for the specified category.
1283
1710
  */
1284
- getAllBySubcategoryId(subcategoryId: string): Promise<Technology[]>;
1711
+ getAllByCategoryId(categoryId: string, options?: {
1712
+ active?: boolean;
1713
+ limit?: number;
1714
+ lastVisible?: DocumentData;
1715
+ }): Promise<{
1716
+ technologies: Technology[];
1717
+ lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
1718
+ }>;
1285
1719
  /**
1286
- * Ažurira postojeću tehnologiju
1287
- * @param technologyId - ID tehnologije
1288
- * @param technology - Novi podaci za tehnologiju
1289
- * @returns Ažurirana tehnologija
1720
+ * Returns all technologies for a specific subcategory with pagination.
1721
+ * @param subcategoryId - The ID of the subcategory.
1722
+ * @param options - Pagination options.
1723
+ * @returns A list of technologies for the specified subcategory.
1724
+ */
1725
+ getAllBySubcategoryId(subcategoryId: string, options?: {
1726
+ active?: boolean;
1727
+ limit?: number;
1728
+ lastVisible?: DocumentData;
1729
+ }): Promise<{
1730
+ technologies: Technology[];
1731
+ lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
1732
+ }>;
1733
+ /**
1734
+ * Updates an existing technology.
1735
+ * @param id - The ID of the technology to update.
1736
+ * @param technology - New data for the technology.
1737
+ * @returns The updated technology.
1738
+ */
1739
+ update(id: string, technology: Partial<Omit<Technology, "id" | "createdAt">>): Promise<Technology | null>;
1740
+ /**
1741
+ * Soft deletes a technology.
1742
+ * @param id - The ID of the technology to delete.
1290
1743
  */
1291
- update(technologyId: string, technology: Partial<Omit<Technology, "id" | "createdAt" | "family" | "categoryId" | "subcategoryId">>): Promise<Technology | null>;
1744
+ delete(id: string): Promise<void>;
1292
1745
  /**
1293
- * Soft delete tehnologije (postavlja isActive na false)
1294
- * @param technologyId - ID tehnologije koja se briše
1746
+ * Reactivates a technology.
1747
+ * @param id - The ID of the technology to reactivate.
1295
1748
  */
1296
- delete(technologyId: string): Promise<void>;
1749
+ reactivate(id: string): Promise<void>;
1297
1750
  /**
1298
- * Vraća tehnologiju po ID-u
1299
- * @param technologyId - ID tražene tehnologije
1300
- * @returns Tehnologija ili null ako ne postoji
1751
+ * Returns a technology by its ID.
1752
+ * @param id - The ID of the requested technology.
1753
+ * @returns The technology or null if it doesn't exist.
1301
1754
  */
1302
- getById(technologyId: string): Promise<Technology | null>;
1755
+ getById(id: string): Promise<Technology | null>;
1303
1756
  /**
1304
1757
  * Dodaje novi zahtev tehnologiji
1305
1758
  * @param technologyId - ID tehnologije
@@ -1349,28 +1802,44 @@ declare class TechnologyService extends BaseService {
1349
1802
  * @param contraindication - Kontraindikacija koja se dodaje
1350
1803
  * @returns Ažurirana tehnologija
1351
1804
  */
1352
- addContraindication(technologyId: string, contraindication: Contraindication): Promise<Technology | null>;
1805
+ addContraindication(technologyId: string, contraindication: ContraindicationDynamic): Promise<Technology | null>;
1353
1806
  /**
1354
1807
  * Uklanja kontraindikaciju iz tehnologije
1355
1808
  * @param technologyId - ID tehnologije
1356
1809
  * @param contraindication - Kontraindikacija koja se uklanja
1357
1810
  * @returns Ažurirana tehnologija
1358
1811
  */
1359
- removeContraindication(technologyId: string, contraindication: Contraindication): Promise<Technology | null>;
1812
+ removeContraindication(technologyId: string, contraindication: ContraindicationDynamic): Promise<Technology | null>;
1813
+ /**
1814
+ * Updates an existing contraindication in a technology's list.
1815
+ * If the contraindication does not exist, it will not be added.
1816
+ * @param technologyId - ID of the technology
1817
+ * @param contraindication - The updated contraindication object
1818
+ * @returns The updated technology
1819
+ */
1820
+ updateContraindication(technologyId: string, contraindication: ContraindicationDynamic): Promise<Technology | null>;
1360
1821
  /**
1361
1822
  * Dodaje benefit tehnologiji
1362
1823
  * @param technologyId - ID tehnologije
1363
1824
  * @param benefit - Benefit koji se dodaje
1364
1825
  * @returns Ažurirana tehnologija
1365
1826
  */
1366
- addBenefit(technologyId: string, benefit: TreatmentBenefit): Promise<Technology | null>;
1827
+ addBenefit(technologyId: string, benefit: TreatmentBenefitDynamic): Promise<Technology | null>;
1367
1828
  /**
1368
1829
  * Uklanja benefit iz tehnologije
1369
1830
  * @param technologyId - ID tehnologije
1370
1831
  * @param benefit - Benefit koji se uklanja
1371
1832
  * @returns Ažurirana tehnologija
1372
1833
  */
1373
- removeBenefit(technologyId: string, benefit: TreatmentBenefit): Promise<Technology | null>;
1834
+ removeBenefit(technologyId: string, benefit: TreatmentBenefitDynamic): Promise<Technology | null>;
1835
+ /**
1836
+ * Updates an existing benefit in a technology's list.
1837
+ * If the benefit does not exist, it will not be added.
1838
+ * @param technologyId - ID of the technology
1839
+ * @param benefit - The updated benefit object
1840
+ * @returns The updated technology
1841
+ */
1842
+ updateBenefit(technologyId: string, benefit: TreatmentBenefitDynamic): Promise<Technology | null>;
1374
1843
  /**
1375
1844
  * Vraća sve blokirajuće uslove za tehnologiju
1376
1845
  * @param technologyId - ID tehnologije
@@ -1382,13 +1851,13 @@ declare class TechnologyService extends BaseService {
1382
1851
  * @param technologyId - ID tehnologije
1383
1852
  * @returns Lista kontraindikacija
1384
1853
  */
1385
- getContraindications(technologyId: string): Promise<Contraindication[]>;
1854
+ getContraindications(technologyId: string): Promise<ContraindicationDynamic[]>;
1386
1855
  /**
1387
1856
  * Vraća sve benefite za tehnologiju
1388
1857
  * @param technologyId - ID tehnologije
1389
1858
  * @returns Lista benefita
1390
1859
  */
1391
- getBenefits(technologyId: string): Promise<TreatmentBenefit[]>;
1860
+ getBenefits(technologyId: string): Promise<TreatmentBenefitDynamic[]>;
1392
1861
  /**
1393
1862
  * Ažurira zahteve sertifikacije za tehnologiju
1394
1863
  * @param technologyId - ID tehnologije
@@ -1451,6 +1920,135 @@ declare class TechnologyService extends BaseService {
1451
1920
  categories: string[];
1452
1921
  subcategories: string[];
1453
1922
  }>;
1923
+ /**
1924
+ * Gets all active technologies for a subcategory for filter dropdowns.
1925
+ * @param categoryId - The ID of the parent category.
1926
+ * @param subcategoryId - The ID of the subcategory.
1927
+ */
1928
+ getAllForFilterBySubcategoryId(categoryId: string, subcategoryId: string): Promise<Technology[]>;
1929
+ /**
1930
+ * Gets all active technologies for filter dropdowns.
1931
+ */
1932
+ getAllForFilter(): Promise<Technology[]>;
1933
+ }
1934
+
1935
+ /**
1936
+ * @class ConstantsService
1937
+ * @description Service for managing administrative constants, such as treatment benefits and contraindications.
1938
+ * These constants are stored in a single Firestore collection 'admin-constants',
1939
+ * with each type of constant in its own document ('treatment-benefits', 'contraindications').
1940
+ * The constants themselves are stored in an array within these documents.
1941
+ * @extends {BaseService}
1942
+ */
1943
+ declare class ConstantsService extends BaseService {
1944
+ /**
1945
+ * @description Gets the reference to the document holding treatment benefits.
1946
+ * @private
1947
+ * @type {DocumentReference}
1948
+ */
1949
+ private get treatmentBenefitsDocRef();
1950
+ /**
1951
+ * @description Gets the reference to the document holding contraindications.
1952
+ * @private
1953
+ * @type {DocumentReference}
1954
+ */
1955
+ private get contraindicationsDocRef();
1956
+ /**
1957
+ * @description Retrieves all treatment benefits without pagination.
1958
+ * @returns {Promise<TreatmentBenefitDynamic[]>} An array of all treatment benefits.
1959
+ */
1960
+ getAllBenefitsForFilter(): Promise<TreatmentBenefitDynamic[]>;
1961
+ /**
1962
+ * @description Retrieves a paginated list of treatment benefits.
1963
+ * @param {{ page: number; limit: number }} options - Pagination options.
1964
+ * @returns {Promise<{ benefits: TreatmentBenefitDynamic[]; total: number }>} A paginated list of benefits and the total count.
1965
+ */
1966
+ getAllBenefits(options: {
1967
+ page: number;
1968
+ limit: number;
1969
+ }): Promise<{
1970
+ benefits: TreatmentBenefitDynamic[];
1971
+ total: number;
1972
+ }>;
1973
+ /**
1974
+ * @description Adds a new treatment benefit.
1975
+ * @param {Omit<TreatmentBenefitDynamic, "id">} benefit - The treatment benefit to add, without an ID.
1976
+ * @returns {Promise<TreatmentBenefitDynamic>} The newly created treatment benefit with its generated ID.
1977
+ */
1978
+ addTreatmentBenefit(benefit: Omit<TreatmentBenefitDynamic, "id">): Promise<TreatmentBenefitDynamic>;
1979
+ /**
1980
+ * @description Retrieves a single treatment benefit by its ID.
1981
+ * @param {string} benefitId - The ID of the treatment benefit to retrieve.
1982
+ * @returns {Promise<TreatmentBenefitDynamic | undefined>} The found treatment benefit or undefined.
1983
+ */
1984
+ getBenefitById(benefitId: string): Promise<TreatmentBenefitDynamic | undefined>;
1985
+ /**
1986
+ * @description Searches for treatment benefits by name (case-insensitive).
1987
+ * @param {string} searchTerm - The term to search for in the benefit names.
1988
+ * @returns {Promise<TreatmentBenefitDynamic[]>} An array of matching treatment benefits.
1989
+ */
1990
+ searchBenefitsByName(searchTerm: string): Promise<TreatmentBenefitDynamic[]>;
1991
+ /**
1992
+ * @description Updates an existing treatment benefit.
1993
+ * @param {TreatmentBenefitDynamic} benefit - The treatment benefit with updated data. Its ID must match an existing benefit.
1994
+ * @returns {Promise<TreatmentBenefitDynamic>} The updated treatment benefit.
1995
+ * @throws {Error} If the treatment benefit is not found.
1996
+ */
1997
+ updateTreatmentBenefit(benefit: TreatmentBenefitDynamic): Promise<TreatmentBenefitDynamic>;
1998
+ /**
1999
+ * @description Deletes a treatment benefit by its ID.
2000
+ * @param {string} benefitId - The ID of the treatment benefit to delete.
2001
+ * @returns {Promise<void>}
2002
+ */
2003
+ deleteTreatmentBenefit(benefitId: string): Promise<void>;
2004
+ /**
2005
+ * @description Retrieves all contraindications without pagination.
2006
+ * @returns {Promise<ContraindicationDynamic[]>} An array of all contraindications.
2007
+ */
2008
+ getAllContraindicationsForFilter(): Promise<ContraindicationDynamic[]>;
2009
+ /**
2010
+ * @description Retrieves a paginated list of contraindications.
2011
+ * @param {{ page: number; limit: number }} options - Pagination options.
2012
+ * @returns {Promise<{ contraindications: ContraindicationDynamic[]; total: number }>} A paginated list and the total count.
2013
+ */
2014
+ getAllContraindications(options: {
2015
+ page: number;
2016
+ limit: number;
2017
+ }): Promise<{
2018
+ contraindications: ContraindicationDynamic[];
2019
+ total: number;
2020
+ }>;
2021
+ /**
2022
+ * @description Adds a new contraindication.
2023
+ * @param {Omit<ContraindicationDynamic, "id">} contraindication - The contraindication to add, without an ID.
2024
+ * @returns {Promise<ContraindicationDynamic>} The newly created contraindication with its generated ID.
2025
+ */
2026
+ addContraindication(contraindication: Omit<ContraindicationDynamic, "id">): Promise<ContraindicationDynamic>;
2027
+ /**
2028
+ * @description Retrieves a single contraindication by its ID.
2029
+ * @param {string} contraindicationId - The ID of the contraindication to retrieve.
2030
+ * @returns {Promise<ContraindicationDynamic | undefined>} The found contraindication or undefined.
2031
+ */
2032
+ getContraindicationById(contraindicationId: string): Promise<ContraindicationDynamic | undefined>;
2033
+ /**
2034
+ * @description Searches for contraindications by name (case-insensitive).
2035
+ * @param {string} searchTerm - The term to search for in the contraindication names.
2036
+ * @returns {Promise<ContraindicationDynamic[]>} An array of matching contraindications.
2037
+ */
2038
+ searchContraindicationsByName(searchTerm: string): Promise<ContraindicationDynamic[]>;
2039
+ /**
2040
+ * @description Updates an existing contraindication.
2041
+ * @param {ContraindicationDynamic} contraindication - The contraindication with updated data. Its ID must match an existing one.
2042
+ * @returns {Promise<ContraindicationDynamic>} The updated contraindication.
2043
+ * @throws {Error} If the contraindication is not found.
2044
+ */
2045
+ updateContraindication(contraindication: ContraindicationDynamic): Promise<ContraindicationDynamic>;
2046
+ /**
2047
+ * @description Deletes a contraindication by its ID.
2048
+ * @param {string} contraindicationId - The ID of the contraindication to delete.
2049
+ * @returns {Promise<void>}
2050
+ */
2051
+ deleteContraindication(contraindicationId: string): Promise<void>;
1454
2052
  }
1455
2053
 
1456
2054
  declare const documentElementSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
@@ -3209,12 +3807,70 @@ declare const documentTemplateSchema: z.ZodObject<{
3209
3807
  sortingOrder?: number | undefined;
3210
3808
  }>;
3211
3809
 
3810
+ /**
3811
+ * Zod validation schema for a single dynamic contraindication.
3812
+ * @see ContraindicationDynamic in admin-constants.types.ts
3813
+ */
3814
+ declare const contraindicationDynamicSchema: z.ZodObject<{
3815
+ id: z.ZodString;
3816
+ name: z.ZodString;
3817
+ description: z.ZodOptional<z.ZodString>;
3818
+ }, "strip", z.ZodTypeAny, {
3819
+ id: string;
3820
+ name: string;
3821
+ description?: string | undefined;
3822
+ }, {
3823
+ id: string;
3824
+ name: string;
3825
+ description?: string | undefined;
3826
+ }>;
3827
+ /**
3828
+ * Zod validation schema for a single dynamic treatment benefit.
3829
+ * @see TreatmentBenefitDynamic in admin-constants.types.ts
3830
+ */
3831
+ declare const treatmentBenefitDynamicSchema: z.ZodObject<{
3832
+ id: z.ZodString;
3833
+ name: z.ZodString;
3834
+ description: z.ZodOptional<z.ZodString>;
3835
+ }, "strip", z.ZodTypeAny, {
3836
+ id: string;
3837
+ name: string;
3838
+ description?: string | undefined;
3839
+ }, {
3840
+ id: string;
3841
+ name: string;
3842
+ description?: string | undefined;
3843
+ }>;
3212
3844
  /**
3213
3845
  * Base validation schemas for enums
3214
3846
  */
3215
3847
  declare const blockingConditionSchemaBackoffice: z.ZodNativeEnum<typeof BlockingCondition>;
3216
- declare const contraindicationSchemaBackoffice: z.ZodNativeEnum<typeof Contraindication>;
3217
- declare const treatmentBenefitSchemaBackoffice: z.ZodNativeEnum<typeof TreatmentBenefit>;
3848
+ declare const contraindicationSchemaBackoffice: z.ZodObject<{
3849
+ id: z.ZodString;
3850
+ name: z.ZodString;
3851
+ description: z.ZodOptional<z.ZodString>;
3852
+ }, "strip", z.ZodTypeAny, {
3853
+ id: string;
3854
+ name: string;
3855
+ description?: string | undefined;
3856
+ }, {
3857
+ id: string;
3858
+ name: string;
3859
+ description?: string | undefined;
3860
+ }>;
3861
+ declare const treatmentBenefitSchemaBackoffice: z.ZodObject<{
3862
+ id: z.ZodString;
3863
+ name: z.ZodString;
3864
+ description: z.ZodOptional<z.ZodString>;
3865
+ }, "strip", z.ZodTypeAny, {
3866
+ id: string;
3867
+ name: string;
3868
+ description?: string | undefined;
3869
+ }, {
3870
+ id: string;
3871
+ name: string;
3872
+ description?: string | undefined;
3873
+ }>;
3218
3874
  declare const procedureFamilySchemaBackoffice: z.ZodNativeEnum<typeof ProcedureFamily>;
3219
3875
  declare const timeUnitSchemaBackoffice: z.ZodNativeEnum<typeof TimeUnit>;
3220
3876
  declare const requirementTypeSchema: z.ZodNativeEnum<typeof RequirementType>;
@@ -3580,7 +4236,19 @@ declare const technologySchema: z.ZodObject<{
3580
4236
  }[];
3581
4237
  }>>;
3582
4238
  blockingConditions: z.ZodArray<z.ZodNativeEnum<typeof BlockingCondition>, "many">;
3583
- contraindications: z.ZodArray<z.ZodNativeEnum<typeof Contraindication>, "many">;
4239
+ contraindications: z.ZodArray<z.ZodObject<{
4240
+ id: z.ZodString;
4241
+ name: z.ZodString;
4242
+ description: z.ZodOptional<z.ZodString>;
4243
+ }, "strip", z.ZodTypeAny, {
4244
+ id: string;
4245
+ name: string;
4246
+ description?: string | undefined;
4247
+ }, {
4248
+ id: string;
4249
+ name: string;
4250
+ description?: string | undefined;
4251
+ }>, "many">;
3584
4252
  documentationTemplates: z.ZodArray<z.ZodObject<{
3585
4253
  id: z.ZodString;
3586
4254
  title: z.ZodString;
@@ -4047,7 +4715,19 @@ declare const technologySchema: z.ZodObject<{
4047
4715
  isRequired?: boolean | undefined;
4048
4716
  sortingOrder?: number | undefined;
4049
4717
  }>, "many">;
4050
- benefits: z.ZodArray<z.ZodNativeEnum<typeof TreatmentBenefit>, "many">;
4718
+ benefits: z.ZodArray<z.ZodObject<{
4719
+ id: z.ZodString;
4720
+ name: z.ZodString;
4721
+ description: z.ZodOptional<z.ZodString>;
4722
+ }, "strip", z.ZodTypeAny, {
4723
+ id: string;
4724
+ name: string;
4725
+ description?: string | undefined;
4726
+ }, {
4727
+ id: string;
4728
+ name: string;
4729
+ description?: string | undefined;
4730
+ }>, "many">;
4051
4731
  certificationRequirement: z.ZodObject<{
4052
4732
  minimumLevel: z.ZodNativeEnum<typeof CertificationLevel>;
4053
4733
  requiredSpecialties: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof CertificationSpecialty>, "many">>;
@@ -4063,10 +4743,13 @@ declare const technologySchema: z.ZodObject<{
4063
4743
  name: string;
4064
4744
  isActive: boolean;
4065
4745
  family: ProcedureFamily;
4066
- contraindications: Contraindication[];
4067
- blockingConditions: BlockingCondition[];
4068
4746
  categoryId: string;
4069
4747
  subcategoryId: string;
4748
+ contraindications: {
4749
+ id: string;
4750
+ name: string;
4751
+ description?: string | undefined;
4752
+ }[];
4070
4753
  requirements: {
4071
4754
  pre: {
4072
4755
  name: string;
@@ -4093,7 +4776,12 @@ declare const technologySchema: z.ZodObject<{
4093
4776
  importance: "low" | "medium" | "high";
4094
4777
  }[];
4095
4778
  };
4096
- benefits: TreatmentBenefit[];
4779
+ blockingConditions: BlockingCondition[];
4780
+ benefits: {
4781
+ id: string;
4782
+ name: string;
4783
+ description?: string | undefined;
4784
+ }[];
4097
4785
  certificationRequirement: {
4098
4786
  minimumLevel: CertificationLevel;
4099
4787
  requiredSpecialties?: CertificationSpecialty[] | undefined;
@@ -4200,11 +4888,19 @@ declare const technologySchema: z.ZodObject<{
4200
4888
  }, {
4201
4889
  name: string;
4202
4890
  family: ProcedureFamily;
4203
- contraindications: Contraindication[];
4204
- blockingConditions: BlockingCondition[];
4205
4891
  categoryId: string;
4206
4892
  subcategoryId: string;
4207
- benefits: TreatmentBenefit[];
4893
+ contraindications: {
4894
+ id: string;
4895
+ name: string;
4896
+ description?: string | undefined;
4897
+ }[];
4898
+ blockingConditions: BlockingCondition[];
4899
+ benefits: {
4900
+ id: string;
4901
+ name: string;
4902
+ description?: string | undefined;
4903
+ }[];
4208
4904
  certificationRequirement: {
4209
4905
  minimumLevel: CertificationLevel;
4210
4906
  requiredSpecialties?: CertificationSpecialty[] | undefined;
@@ -4553,7 +5249,19 @@ declare const technologyUpdateSchema: z.ZodObject<{
4553
5249
  }[];
4554
5250
  }>>>;
4555
5251
  blockingConditions: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof BlockingCondition>, "many">>;
4556
- contraindications: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof Contraindication>, "many">>;
5252
+ contraindications: z.ZodOptional<z.ZodArray<z.ZodObject<{
5253
+ id: z.ZodString;
5254
+ name: z.ZodString;
5255
+ description: z.ZodOptional<z.ZodString>;
5256
+ }, "strip", z.ZodTypeAny, {
5257
+ id: string;
5258
+ name: string;
5259
+ description?: string | undefined;
5260
+ }, {
5261
+ id: string;
5262
+ name: string;
5263
+ description?: string | undefined;
5264
+ }>, "many">>;
4557
5265
  documentationTemplates: z.ZodOptional<z.ZodArray<z.ZodObject<{
4558
5266
  id: z.ZodString;
4559
5267
  title: z.ZodString;
@@ -5020,7 +5728,19 @@ declare const technologyUpdateSchema: z.ZodObject<{
5020
5728
  isRequired?: boolean | undefined;
5021
5729
  sortingOrder?: number | undefined;
5022
5730
  }>, "many">>;
5023
- benefits: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof TreatmentBenefit>, "many">>;
5731
+ benefits: z.ZodOptional<z.ZodArray<z.ZodObject<{
5732
+ id: z.ZodString;
5733
+ name: z.ZodString;
5734
+ description: z.ZodOptional<z.ZodString>;
5735
+ }, "strip", z.ZodTypeAny, {
5736
+ id: string;
5737
+ name: string;
5738
+ description?: string | undefined;
5739
+ }, {
5740
+ id: string;
5741
+ name: string;
5742
+ description?: string | undefined;
5743
+ }>, "many">>;
5024
5744
  certificationRequirement: z.ZodOptional<z.ZodObject<{
5025
5745
  minimumLevel: z.ZodNativeEnum<typeof CertificationLevel>;
5026
5746
  requiredSpecialties: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof CertificationSpecialty>, "many">>;
@@ -5037,11 +5757,14 @@ declare const technologyUpdateSchema: z.ZodObject<{
5037
5757
  isActive?: boolean | undefined;
5038
5758
  description?: string | undefined;
5039
5759
  family?: ProcedureFamily | undefined;
5040
- technicalDetails?: string | undefined;
5041
- contraindications?: Contraindication[] | undefined;
5042
- blockingConditions?: BlockingCondition[] | undefined;
5043
5760
  categoryId?: string | undefined;
5044
5761
  subcategoryId?: string | undefined;
5762
+ technicalDetails?: string | undefined;
5763
+ contraindications?: {
5764
+ id: string;
5765
+ name: string;
5766
+ description?: string | undefined;
5767
+ }[] | undefined;
5045
5768
  requirements?: {
5046
5769
  pre: {
5047
5770
  name: string;
@@ -5068,7 +5791,12 @@ declare const technologyUpdateSchema: z.ZodObject<{
5068
5791
  importance: "low" | "medium" | "high";
5069
5792
  }[];
5070
5793
  } | undefined;
5071
- benefits?: TreatmentBenefit[] | undefined;
5794
+ blockingConditions?: BlockingCondition[] | undefined;
5795
+ benefits?: {
5796
+ id: string;
5797
+ name: string;
5798
+ description?: string | undefined;
5799
+ }[] | undefined;
5072
5800
  certificationRequirement?: {
5073
5801
  minimumLevel: CertificationLevel;
5074
5802
  requiredSpecialties?: CertificationSpecialty[] | undefined;
@@ -5175,11 +5903,14 @@ declare const technologyUpdateSchema: z.ZodObject<{
5175
5903
  isActive?: boolean | undefined;
5176
5904
  description?: string | undefined;
5177
5905
  family?: ProcedureFamily | undefined;
5178
- technicalDetails?: string | undefined;
5179
- contraindications?: Contraindication[] | undefined;
5180
- blockingConditions?: BlockingCondition[] | undefined;
5181
5906
  categoryId?: string | undefined;
5182
5907
  subcategoryId?: string | undefined;
5908
+ technicalDetails?: string | undefined;
5909
+ contraindications?: {
5910
+ id: string;
5911
+ name: string;
5912
+ description?: string | undefined;
5913
+ }[] | undefined;
5183
5914
  requirements?: {
5184
5915
  pre: {
5185
5916
  name: string;
@@ -5206,7 +5937,12 @@ declare const technologyUpdateSchema: z.ZodObject<{
5206
5937
  isActive?: boolean | undefined;
5207
5938
  }[];
5208
5939
  } | undefined;
5209
- benefits?: TreatmentBenefit[] | undefined;
5940
+ blockingConditions?: BlockingCondition[] | undefined;
5941
+ benefits?: {
5942
+ id: string;
5943
+ name: string;
5944
+ description?: string | undefined;
5945
+ }[] | undefined;
5210
5946
  certificationRequirement?: {
5211
5947
  minimumLevel: CertificationLevel;
5212
5948
  requiredSpecialties?: CertificationSpecialty[] | undefined;
@@ -5446,4 +6182,4 @@ declare class InvalidTreatmentBenefitError extends TreatmentBenefitError {
5446
6182
  constructor(benefit: string);
5447
6183
  }
5448
6184
 
5449
- export { BRANDS_COLLECTION, BackofficeError, BlockingCondition, BlockingConditionError, type Brand, BrandService, CATEGORIES_COLLECTION, type Category, CategoryError, CategoryNotFoundError, CategoryService, CertificationLevel, type CertificationRequirement, CertificationSpecialty, CircularReferenceError, Contraindication, ContraindicationError, type CreateDocumentTemplateData, Currency, DEFAULT_CERTIFICATION_REQUIREMENT, DOCUMENTATION_TEMPLATES_COLLECTION, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateServiceBackoffice, DynamicVariable, FILLED_DOCUMENTS_COLLECTION, HeadingLevel, type IProductService, InvalidBlockingConditionError, InvalidCategoryDataError, InvalidContraindicationError, InvalidHierarchyError, InvalidRequirementDataError, InvalidSubcategoryDataError, InvalidTechnologyDataError, InvalidTimeframeError, InvalidTreatmentBenefitError, ListType, PRODUCTS_COLLECTION, PricingMeasure, ProcedureFamily, type Product, ProductService, REQUIREMENTS_COLLECTION, RelationshipError, type Requirement, RequirementError, type RequirementImportance, RequirementNotFoundError, RequirementService, RequirementType, SUBCATEGORIES_COLLECTION, type Subcategory, SubcategoryError, SubcategoryNotFoundError, SubcategoryService, TECHNOLOGIES_COLLECTION, type Technology, type TechnologyDocumentationTemplate, TechnologyError, TechnologyNotFoundError, type TechnologyRequirements, TechnologyService, type TimeFrame, TimeUnit, TreatmentBenefit, TreatmentBenefitError, type UpdateDocumentTemplateData, blockingConditionSchemaBackoffice, categorySchema, categoryUpdateSchema, certificationLevelSchema, certificationRequirementSchema, certificationSpecialtySchema, contraindicationSchemaBackoffice, createDocumentTemplateSchema, documentElementSchema, documentElementWithoutIdSchema, documentTemplateSchema, procedureFamilySchemaBackoffice, requirementSchema, requirementTypeSchema, requirementUpdateSchema, subcategorySchema, subcategoryUpdateSchema, technologyRequirementsSchema, technologySchema, technologyUpdateSchema, timeUnitSchemaBackoffice, timeframeSchema, treatmentBenefitSchemaBackoffice, updateDocumentTemplateSchema };
6185
+ export { BRANDS_COLLECTION, BackofficeError, BlockingCondition, BlockingConditionError, type Brand, BrandService, CATEGORIES_COLLECTION, type Category, CategoryError, CategoryNotFoundError, CategoryService, CertificationLevel, type CertificationRequirement, CertificationSpecialty, CircularReferenceError, ConstantsService, Contraindication, type ContraindicationDynamic, ContraindicationError, type ContraindicationsDocument, type CreateDocumentTemplateData, Currency, DEFAULT_CERTIFICATION_REQUIREMENT, DOCUMENTATION_TEMPLATES_COLLECTION, type DocumentElement, DocumentElementType, type DocumentTemplate, DocumentationTemplateServiceBackoffice, DynamicVariable, FILLED_DOCUMENTS_COLLECTION, HeadingLevel, type IProductService, type ITechnologyService, InvalidBlockingConditionError, InvalidCategoryDataError, InvalidContraindicationError, InvalidHierarchyError, InvalidRequirementDataError, InvalidSubcategoryDataError, InvalidTechnologyDataError, InvalidTimeframeError, InvalidTreatmentBenefitError, ListType, PRODUCTS_COLLECTION, PricingMeasure, ProcedureFamily, type Product, ProductService, REQUIREMENTS_COLLECTION, RelationshipError, type Requirement, RequirementError, type RequirementImportance, RequirementNotFoundError, RequirementService, RequirementType, SUBCATEGORIES_COLLECTION, type Subcategory, SubcategoryError, SubcategoryNotFoundError, SubcategoryService, TECHNOLOGIES_COLLECTION, type Technology, type TechnologyDocumentationTemplate, TechnologyError, TechnologyNotFoundError, type TechnologyRequirements, TechnologyService, type TimeFrame, TimeUnit, TreatmentBenefit, type TreatmentBenefitDynamic, TreatmentBenefitError, type TreatmentBenefitsDocument, type UpdateDocumentTemplateData, blockingConditionSchemaBackoffice, categorySchema, categoryUpdateSchema, certificationLevelSchema, certificationRequirementSchema, certificationSpecialtySchema, contraindicationDynamicSchema, contraindicationSchemaBackoffice, createDocumentTemplateSchema, documentElementSchema, documentElementWithoutIdSchema, documentTemplateSchema, procedureFamilySchemaBackoffice, requirementSchema, requirementTypeSchema, requirementUpdateSchema, subcategorySchema, subcategoryUpdateSchema, technologyRequirementsSchema, technologySchema, technologyUpdateSchema, timeUnitSchemaBackoffice, timeframeSchema, treatmentBenefitDynamicSchema, treatmentBenefitSchemaBackoffice, updateDocumentTemplateSchema };