@blackcode_sa/metaestetics-api 1.6.24 → 1.6.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -355,265 +355,18 @@ interface CertificationRequirement {
355
355
  }
356
356
 
357
357
  /**
358
- * Types for the Medical Documentation Templating System
359
- */
360
- /**
361
- * Kolekcija u Firestore bazi gde se čuvaju dokumentacijske šablone
362
- */
363
- declare const DOCUMENTATION_TEMPLATES_COLLECTION = "documentation-templates";
364
- declare const FILLED_DOCUMENTS_COLLECTION = "filled-documents";
365
- declare const USER_FORMS_SUBCOLLECTION = "user-forms";
366
- declare const DOCTOR_FORMS_SUBCOLLECTION = "doctor-forms";
367
- /**
368
- * Enum for element types in documentation templates
369
- */
370
- declare enum DocumentElementType {
371
- HEADING = "heading",
372
- PARAGRAPH = "paragraph",
373
- LIST = "list",
374
- DYNAMIC_TEXT = "dynamic_text",
375
- BINARY_CHOICE = "binary_choice",
376
- MULTIPLE_CHOICE = "multiple_choice",
377
- SINGLE_CHOICE = "single_choice",
378
- RATING_SCALE = "rating_scale",
379
- TEXT_INPUT = "text_input",
380
- DATE_PICKER = "date_picker",
381
- SIGNATURE = "signature",
382
- DITIGAL_SIGNATURE = "digital_signature",
383
- FILE_UPLOAD = "file_upload"
384
- }
385
- /**
386
- * Enum for list types
387
- */
388
- declare enum ListType {
389
- ORDERED = "ordered",
390
- UNORDERED = "unordered"
391
- }
392
- /**
393
- * Enum for heading levels
394
- */
395
- declare enum HeadingLevel {
396
- H1 = "h1",
397
- H2 = "h2",
398
- H3 = "h3",
399
- H4 = "h4",
400
- H5 = "h5",
401
- H6 = "h6"
402
- }
403
- /**
404
- * Enum for dynamic variable placeholders
405
- */
406
- declare enum DynamicVariable {
407
- PATIENT_NAME = "$[PATIENT_NAME]",
408
- DOCTOR_NAME = "$[DOCTOR_NAME]",
409
- CLINIC_NAME = "$[CLINIC_NAME]",
410
- PATIENT_BIRTHDAY = "$[PATIENT_BIRTHDAY]",
411
- APPOINTMENT_DATE = "$[APPOINTMENT_DATE]",
412
- CURRENT_DATE = "$[CURRENT_DATE]",
413
- PROCEDURE_NAME = "$[PROCEDURE_NAME]",
414
- PROCEDURE_DESCRIPTION = "$[PROCEDURE_DESCRIPTION]",
415
- PROCEDURE_COST = "$[PROCEDURE_COST]",
416
- PROCEDURE_DURATION = "$[PROCEDURE_DURATION]",
417
- PROCEDURE_RISK = "$[PROCEDURE_RISK]"
418
- }
419
- /**
420
- * Base interface for all document elements
421
- */
422
- interface BaseDocumentElement {
423
- id: string;
424
- type: DocumentElementType;
425
- required?: boolean;
426
- }
427
- /**
428
- * Interface for heading element
429
- */
430
- interface HeadingElement extends BaseDocumentElement {
431
- type: DocumentElementType.HEADING;
432
- text: string;
433
- level: HeadingLevel;
434
- }
435
- /**
436
- * Interface for paragraph element
437
- */
438
- interface ParagraphElement extends BaseDocumentElement {
439
- type: DocumentElementType.PARAGRAPH;
440
- text: string;
441
- }
442
- /**
443
- * Interface for list element
444
- */
445
- interface ListElement extends BaseDocumentElement {
446
- type: DocumentElementType.LIST;
447
- items: string[];
448
- listType: ListType;
449
- }
450
- /**
451
- * Interface for dynamic text element
452
- */
453
- interface DynamicTextElement extends BaseDocumentElement {
454
- type: DocumentElementType.DYNAMIC_TEXT;
455
- text: string;
456
- }
457
- /**
458
- * Interface for binary choice element (Yes/No)
459
- */
460
- interface BinaryChoiceElement extends BaseDocumentElement {
461
- type: DocumentElementType.BINARY_CHOICE;
462
- question: string;
463
- defaultValue?: boolean;
464
- }
465
- /**
466
- * Interface for multiple choice element
467
- */
468
- interface MultipleChoiceElement extends BaseDocumentElement {
469
- type: DocumentElementType.MULTIPLE_CHOICE;
470
- question: string;
471
- options: string[];
472
- defaultValues?: string[];
473
- }
474
- /**
475
- * Interface for single choice element
476
- */
477
- interface SingleChoiceElement extends BaseDocumentElement {
478
- type: DocumentElementType.SINGLE_CHOICE;
479
- question: string;
480
- options: string[];
481
- defaultValue?: string;
482
- }
483
- /**
484
- * Interface for rating scale element
485
- */
486
- interface RatingScaleElement extends BaseDocumentElement {
487
- type: DocumentElementType.RATING_SCALE;
488
- question: string;
489
- min: number;
490
- max: number;
491
- labels?: {
492
- [key: number]: string;
493
- };
494
- defaultValue?: number;
495
- }
496
- /**
497
- * Interface for text input element
498
- */
499
- interface TextInputElement extends BaseDocumentElement {
500
- type: DocumentElementType.TEXT_INPUT;
501
- label: string;
502
- placeholder?: string;
503
- multiline?: boolean;
504
- defaultValue?: string;
505
- }
506
- /**
507
- * Interface for date picker element
508
- */
509
- interface DatePickerElement extends BaseDocumentElement {
510
- type: DocumentElementType.DATE_PICKER;
511
- label: string;
512
- defaultValue?: string;
513
- }
514
- /**
515
- * Interface for signature element
516
- */
517
- interface SignatureElement extends BaseDocumentElement {
518
- type: DocumentElementType.SIGNATURE;
519
- label: string;
520
- }
521
- /**
522
- * Interface for digital signature element
523
- */
524
- interface DigitalSignatureElement extends BaseDocumentElement {
525
- type: DocumentElementType.DITIGAL_SIGNATURE;
526
- label: string;
527
- }
528
- /**
529
- * Interface for file upload element
530
- */
531
- interface FileUploadElement extends BaseDocumentElement {
532
- type: DocumentElementType.FILE_UPLOAD;
533
- label: string;
534
- allowedFileTypes?: string[];
535
- maxFileSizeMB?: number;
536
- }
537
- /**
538
- * Union type for all document elements
539
- */
540
- type DocumentElement = HeadingElement | ParagraphElement | ListElement | DynamicTextElement | BinaryChoiceElement | MultipleChoiceElement | SingleChoiceElement | RatingScaleElement | TextInputElement | DatePickerElement | SignatureElement | FileUploadElement;
541
- /**
542
- * Interface for document template
543
- */
544
- interface DocumentTemplate {
545
- id: string;
546
- title: string;
547
- description?: string;
548
- createdAt: number;
549
- updatedAt: number;
550
- createdBy: string;
551
- elements: DocumentElement[];
552
- tags?: string[];
553
- isUserForm?: boolean;
554
- isRequired?: boolean;
555
- sortingOrder?: number;
556
- version: number;
557
- isActive: boolean;
558
- }
559
- /**
560
- * Interface for creating a new document template
561
- */
562
- interface CreateDocumentTemplateData {
563
- title: string;
564
- description?: string;
565
- elements: Omit<DocumentElement, "id">[];
566
- tags?: string[];
567
- isUserForm?: boolean;
568
- isRequired?: boolean;
569
- sortingOrder?: number;
570
- }
571
- /**
572
- * Interface for updating an existing document template
573
- */
574
- interface UpdateDocumentTemplateData {
575
- title?: string;
576
- description?: string;
577
- elements?: Omit<DocumentElement, "id">[];
578
- tags?: string[];
579
- isActive?: boolean;
580
- isUserForm?: boolean;
581
- isRequired?: boolean;
582
- sortingOrder?: number;
583
- }
584
- /**
585
- * Interface for a filled document (completed form)
358
+ * Reference to a documentation template with metadata
359
+ * @property templateId - ID of the documentation template
360
+ * @property isUserForm - Whether this template is filled by users
361
+ * @property isRequired - Whether this template is required
362
+ * @property sortingOrder - The display order of this template
586
363
  */
587
- interface FilledDocument {
588
- id: string;
364
+ interface TechnologyDocumentationTemplate {
589
365
  templateId: string;
590
- templateVersion: number;
591
366
  isUserForm: boolean;
592
367
  isRequired: boolean;
593
- procedureId: string;
594
- appointmentId: string;
595
- patientId: string;
596
- practitionerId: string;
597
- clinicId: string;
598
- createdAt: number;
599
- updatedAt: number;
600
- values: {
601
- [elementId: string]: any;
602
- };
603
- status: FilledDocumentStatus;
604
- }
605
- /**
606
- * Enum for filled document status
607
- */
608
- declare enum FilledDocumentStatus {
609
- DRAFT = "draft",
610
- SKIPPED = "skipped",
611
- PENDING = "pending",
612
- COMPLETED = "completed",// When doctor or patient completes the form
613
- SIGNED = "signed",// Only used for user forms
614
- REJECTED = "rejected"
368
+ sortingOrder: number;
615
369
  }
616
-
617
370
  /**
618
371
  * Technology used in medical procedures
619
372
  * Technologies are now a top-level collection that reference their full path in the hierarchy
@@ -631,7 +384,7 @@ declare enum FilledDocumentStatus {
631
384
  * @property contraindications - List of conditions requiring special attention
632
385
  * @property benefits - List of expected benefits from the procedure
633
386
  * @property certificationRequirement - Required certification level and specialties
634
- * @property documentationTemplates - List of documentation templates required for this technology
387
+ * @property documentationTemplates - List of documentation template references
635
388
  * @property isActive - Whether the technology is active in the system
636
389
  * @property createdAt - Creation date
637
390
  * @property updatedAt - Last update date
@@ -652,7 +405,7 @@ interface Technology {
652
405
  contraindications: Contraindication[];
653
406
  benefits: TreatmentBenefit[];
654
407
  certificationRequirement: CertificationRequirement;
655
- documentationTemplates?: DocumentTemplate[];
408
+ documentationTemplates?: TechnologyDocumentationTemplate[];
656
409
  isActive: boolean;
657
410
  createdAt: Date;
658
411
  updatedAt: Date;
@@ -797,7 +550,7 @@ interface Procedure {
797
550
  /** Certification requirements for performing this procedure */
798
551
  certificationRequirement: CertificationRequirement;
799
552
  /** Documentation templates required for this procedure */
800
- documentationTemplates: DocumentTemplate[];
553
+ documentationTemplates: TechnologyDocumentationTemplate[];
801
554
  /** ID of the practitioner who performs this procedure */
802
555
  practitionerId: string;
803
556
  /** ID of the clinic branch where this procedure is performed */
@@ -1986,6 +1739,266 @@ interface PatientProfileInfo {
1986
1739
  gender: Gender;
1987
1740
  }
1988
1741
 
1742
+ /**
1743
+ * Types for the Medical Documentation Templating System
1744
+ */
1745
+ /**
1746
+ * Kolekcija u Firestore bazi gde se čuvaju dokumentacijske šablone
1747
+ */
1748
+ declare const DOCUMENTATION_TEMPLATES_COLLECTION = "documentation-templates";
1749
+ declare const FILLED_DOCUMENTS_COLLECTION = "filled-documents";
1750
+ declare const USER_FORMS_SUBCOLLECTION = "user-forms";
1751
+ declare const DOCTOR_FORMS_SUBCOLLECTION = "doctor-forms";
1752
+ /**
1753
+ * Enum for element types in documentation templates
1754
+ */
1755
+ declare enum DocumentElementType {
1756
+ HEADING = "heading",
1757
+ PARAGRAPH = "paragraph",
1758
+ LIST = "list",
1759
+ DYNAMIC_TEXT = "dynamic_text",
1760
+ BINARY_CHOICE = "binary_choice",
1761
+ MULTIPLE_CHOICE = "multiple_choice",
1762
+ SINGLE_CHOICE = "single_choice",
1763
+ RATING_SCALE = "rating_scale",
1764
+ TEXT_INPUT = "text_input",
1765
+ DATE_PICKER = "date_picker",
1766
+ SIGNATURE = "signature",
1767
+ DITIGAL_SIGNATURE = "digital_signature",
1768
+ FILE_UPLOAD = "file_upload"
1769
+ }
1770
+ /**
1771
+ * Enum for list types
1772
+ */
1773
+ declare enum ListType {
1774
+ ORDERED = "ordered",
1775
+ UNORDERED = "unordered"
1776
+ }
1777
+ /**
1778
+ * Enum for heading levels
1779
+ */
1780
+ declare enum HeadingLevel {
1781
+ H1 = "h1",
1782
+ H2 = "h2",
1783
+ H3 = "h3",
1784
+ H4 = "h4",
1785
+ H5 = "h5",
1786
+ H6 = "h6"
1787
+ }
1788
+ /**
1789
+ * Enum for dynamic variable placeholders
1790
+ */
1791
+ declare enum DynamicVariable {
1792
+ PATIENT_NAME = "$[PATIENT_NAME]",
1793
+ DOCTOR_NAME = "$[DOCTOR_NAME]",
1794
+ CLINIC_NAME = "$[CLINIC_NAME]",
1795
+ PATIENT_BIRTHDAY = "$[PATIENT_BIRTHDAY]",
1796
+ APPOINTMENT_DATE = "$[APPOINTMENT_DATE]",
1797
+ CURRENT_DATE = "$[CURRENT_DATE]",
1798
+ PROCEDURE_NAME = "$[PROCEDURE_NAME]",
1799
+ PROCEDURE_DESCRIPTION = "$[PROCEDURE_DESCRIPTION]",
1800
+ PROCEDURE_COST = "$[PROCEDURE_COST]",
1801
+ PROCEDURE_DURATION = "$[PROCEDURE_DURATION]",
1802
+ PROCEDURE_RISK = "$[PROCEDURE_RISK]"
1803
+ }
1804
+ /**
1805
+ * Base interface for all document elements
1806
+ */
1807
+ interface BaseDocumentElement {
1808
+ id: string;
1809
+ type: DocumentElementType;
1810
+ required?: boolean;
1811
+ }
1812
+ /**
1813
+ * Interface for heading element
1814
+ */
1815
+ interface HeadingElement extends BaseDocumentElement {
1816
+ type: DocumentElementType.HEADING;
1817
+ text: string;
1818
+ level: HeadingLevel;
1819
+ }
1820
+ /**
1821
+ * Interface for paragraph element
1822
+ */
1823
+ interface ParagraphElement extends BaseDocumentElement {
1824
+ type: DocumentElementType.PARAGRAPH;
1825
+ text: string;
1826
+ }
1827
+ /**
1828
+ * Interface for list element
1829
+ */
1830
+ interface ListElement extends BaseDocumentElement {
1831
+ type: DocumentElementType.LIST;
1832
+ items: string[];
1833
+ listType: ListType;
1834
+ }
1835
+ /**
1836
+ * Interface for dynamic text element
1837
+ */
1838
+ interface DynamicTextElement extends BaseDocumentElement {
1839
+ type: DocumentElementType.DYNAMIC_TEXT;
1840
+ text: string;
1841
+ }
1842
+ /**
1843
+ * Interface for binary choice element (Yes/No)
1844
+ */
1845
+ interface BinaryChoiceElement extends BaseDocumentElement {
1846
+ type: DocumentElementType.BINARY_CHOICE;
1847
+ question: string;
1848
+ defaultValue?: boolean;
1849
+ }
1850
+ /**
1851
+ * Interface for multiple choice element
1852
+ */
1853
+ interface MultipleChoiceElement extends BaseDocumentElement {
1854
+ type: DocumentElementType.MULTIPLE_CHOICE;
1855
+ question: string;
1856
+ options: string[];
1857
+ defaultValues?: string[];
1858
+ }
1859
+ /**
1860
+ * Interface for single choice element
1861
+ */
1862
+ interface SingleChoiceElement extends BaseDocumentElement {
1863
+ type: DocumentElementType.SINGLE_CHOICE;
1864
+ question: string;
1865
+ options: string[];
1866
+ defaultValue?: string;
1867
+ }
1868
+ /**
1869
+ * Interface for rating scale element
1870
+ */
1871
+ interface RatingScaleElement extends BaseDocumentElement {
1872
+ type: DocumentElementType.RATING_SCALE;
1873
+ question: string;
1874
+ min: number;
1875
+ max: number;
1876
+ labels?: {
1877
+ [key: number]: string;
1878
+ };
1879
+ defaultValue?: number;
1880
+ }
1881
+ /**
1882
+ * Interface for text input element
1883
+ */
1884
+ interface TextInputElement extends BaseDocumentElement {
1885
+ type: DocumentElementType.TEXT_INPUT;
1886
+ label: string;
1887
+ placeholder?: string;
1888
+ multiline?: boolean;
1889
+ defaultValue?: string;
1890
+ }
1891
+ /**
1892
+ * Interface for date picker element
1893
+ */
1894
+ interface DatePickerElement extends BaseDocumentElement {
1895
+ type: DocumentElementType.DATE_PICKER;
1896
+ label: string;
1897
+ defaultValue?: string;
1898
+ }
1899
+ /**
1900
+ * Interface for signature element
1901
+ */
1902
+ interface SignatureElement extends BaseDocumentElement {
1903
+ type: DocumentElementType.SIGNATURE;
1904
+ label: string;
1905
+ }
1906
+ /**
1907
+ * Interface for digital signature element
1908
+ */
1909
+ interface DigitalSignatureElement extends BaseDocumentElement {
1910
+ type: DocumentElementType.DITIGAL_SIGNATURE;
1911
+ label: string;
1912
+ }
1913
+ /**
1914
+ * Interface for file upload element
1915
+ */
1916
+ interface FileUploadElement extends BaseDocumentElement {
1917
+ type: DocumentElementType.FILE_UPLOAD;
1918
+ label: string;
1919
+ allowedFileTypes?: string[];
1920
+ maxFileSizeMB?: number;
1921
+ }
1922
+ /**
1923
+ * Union type for all document elements
1924
+ */
1925
+ type DocumentElement = HeadingElement | ParagraphElement | ListElement | DynamicTextElement | BinaryChoiceElement | MultipleChoiceElement | SingleChoiceElement | RatingScaleElement | TextInputElement | DatePickerElement | SignatureElement | FileUploadElement;
1926
+ /**
1927
+ * Interface for document template
1928
+ */
1929
+ interface DocumentTemplate {
1930
+ id: string;
1931
+ title: string;
1932
+ description?: string;
1933
+ createdAt: number;
1934
+ updatedAt: number;
1935
+ createdBy: string;
1936
+ elements: DocumentElement[];
1937
+ tags?: string[];
1938
+ isUserForm?: boolean;
1939
+ isRequired?: boolean;
1940
+ sortingOrder?: number;
1941
+ version: number;
1942
+ isActive: boolean;
1943
+ }
1944
+ /**
1945
+ * Interface for creating a new document template
1946
+ */
1947
+ interface CreateDocumentTemplateData {
1948
+ title: string;
1949
+ description?: string;
1950
+ elements: Omit<DocumentElement, "id">[];
1951
+ tags?: string[];
1952
+ isUserForm?: boolean;
1953
+ isRequired?: boolean;
1954
+ sortingOrder?: number;
1955
+ }
1956
+ /**
1957
+ * Interface for updating an existing document template
1958
+ */
1959
+ interface UpdateDocumentTemplateData {
1960
+ title?: string;
1961
+ description?: string;
1962
+ elements?: Omit<DocumentElement, "id">[];
1963
+ tags?: string[];
1964
+ isActive?: boolean;
1965
+ isUserForm?: boolean;
1966
+ isRequired?: boolean;
1967
+ sortingOrder?: number;
1968
+ }
1969
+ /**
1970
+ * Interface for a filled document (completed form)
1971
+ */
1972
+ interface FilledDocument {
1973
+ id: string;
1974
+ templateId: string;
1975
+ templateVersion: number;
1976
+ isUserForm: boolean;
1977
+ isRequired: boolean;
1978
+ procedureId: string;
1979
+ appointmentId: string;
1980
+ patientId: string;
1981
+ practitionerId: string;
1982
+ clinicId: string;
1983
+ createdAt: number;
1984
+ updatedAt: number;
1985
+ values: {
1986
+ [elementId: string]: any;
1987
+ };
1988
+ status: FilledDocumentStatus;
1989
+ }
1990
+ /**
1991
+ * Enum for filled document status
1992
+ */
1993
+ declare enum FilledDocumentStatus {
1994
+ DRAFT = "draft",
1995
+ SKIPPED = "skipped",
1996
+ PENDING = "pending",
1997
+ COMPLETED = "completed",// When doctor or patient completes the form
1998
+ SIGNED = "signed",// Only used for user forms
1999
+ REJECTED = "rejected"
2000
+ }
2001
+
1989
2002
  /**
1990
2003
  * Brend proizvoda ili opreme
1991
2004
  * Predstavlja proizvođača ili dobavljača proizvoda i opreme koja se koristi u procedurama
@@ -4103,7 +4116,7 @@ declare class TechnologyService extends BaseService {
4103
4116
  pre: Requirement[];
4104
4117
  post: Requirement[];
4105
4118
  };
4106
- documentationTemplates?: DocumentTemplate[] | undefined;
4119
+ documentationTemplates?: TechnologyDocumentationTemplate[] | undefined;
4107
4120
  benefits: TreatmentBenefit[];
4108
4121
  certificationRequirement: CertificationRequirement;
4109
4122
  id: string;
@@ -6491,6 +6504,7 @@ declare class FilledDocumentService extends BaseService {
6491
6504
  /**
6492
6505
  * Create a new filled document within an appointment's subcollection.
6493
6506
  * @param templateId - ID of the template to use.
6507
+ * @param templateVersion - Version of the template to use.
6494
6508
  * @param appointmentId - ID of the appointment this form belongs to.
6495
6509
  * @param procedureId - ID of the procedure associated with this form.
6496
6510
  * @param patientId - ID of the patient.
@@ -6500,7 +6514,7 @@ declare class FilledDocumentService extends BaseService {
6500
6514
  * @param initialStatus - Optional initial status for the form.
6501
6515
  * @returns The created filled document.
6502
6516
  */
6503
- createFilledDocumentForAppointment(templateId: string, appointmentId: string, procedureId: string, patientId: string, practitionerId: string, // Consider if this is always available or if a placeholder is needed
6517
+ createFilledDocumentForAppointment(templateId: string, templateVersion: number, appointmentId: string, procedureId: string, patientId: string, practitionerId: string, // Consider if this is always available or if a placeholder is needed
6504
6518
  clinicId: string, // Same consideration as practitionerId
6505
6519
  initialValues?: {
6506
6520
  [elementId: string]: any;
package/dist/index.js CHANGED
@@ -8430,25 +8430,30 @@ var DocumentationTemplateService = class extends BaseService {
8430
8430
  * @returns The template or null if not found
8431
8431
  */
8432
8432
  async getTemplateById(templateId, version) {
8433
- if (version !== void 0) {
8434
- try {
8435
- const versionTemplate = await this.getTemplateVersion(
8436
- templateId,
8437
- version
8438
- );
8439
- if (versionTemplate) {
8440
- return versionTemplate;
8441
- }
8442
- } catch (error) {
8443
- console.error(`Error getting template version ${version}:`, error);
8444
- }
8445
- }
8446
8433
  const docRef = (0, import_firestore25.doc)(this.collectionRef, templateId);
8447
8434
  const docSnap = await (0, import_firestore25.getDoc)(docRef);
8448
8435
  if (!docSnap.exists()) {
8449
8436
  return null;
8450
8437
  }
8451
- return docSnap.data();
8438
+ const currentTemplate = docSnap.data();
8439
+ if (version === void 0) {
8440
+ return currentTemplate;
8441
+ }
8442
+ if (currentTemplate.version === version) {
8443
+ return currentTemplate;
8444
+ }
8445
+ try {
8446
+ const versionTemplate = await this.getTemplateVersion(
8447
+ templateId,
8448
+ version
8449
+ );
8450
+ if (versionTemplate) {
8451
+ return versionTemplate;
8452
+ }
8453
+ } catch (error) {
8454
+ console.error(`Error getting template version ${version}:`, error);
8455
+ }
8456
+ return null;
8452
8457
  }
8453
8458
  /**
8454
8459
  * Update an existing document template
@@ -8670,6 +8675,7 @@ var FilledDocumentService = class extends BaseService {
8670
8675
  /**
8671
8676
  * Create a new filled document within an appointment's subcollection.
8672
8677
  * @param templateId - ID of the template to use.
8678
+ * @param templateVersion - Version of the template to use.
8673
8679
  * @param appointmentId - ID of the appointment this form belongs to.
8674
8680
  * @param procedureId - ID of the procedure associated with this form.
8675
8681
  * @param patientId - ID of the patient.
@@ -8679,8 +8685,11 @@ var FilledDocumentService = class extends BaseService {
8679
8685
  * @param initialStatus - Optional initial status for the form.
8680
8686
  * @returns The created filled document.
8681
8687
  */
8682
- async createFilledDocumentForAppointment(templateId, appointmentId, procedureId, patientId, practitionerId, clinicId, initialValues = {}, initialStatus = "draft" /* DRAFT */) {
8683
- const template = await this.templateService.getTemplateById(templateId);
8688
+ async createFilledDocumentForAppointment(templateId, templateVersion, appointmentId, procedureId, patientId, practitionerId, clinicId, initialValues = {}, initialStatus = "draft" /* DRAFT */) {
8689
+ const template = await this.templateService.getTemplateById(
8690
+ templateId,
8691
+ templateVersion
8692
+ );
8684
8693
  if (!template) {
8685
8694
  throw new Error(`Template with ID ${templateId} not found`);
8686
8695
  }