@blackcode_sa/metaestetics-api 1.7.26 → 1.7.28

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.mjs CHANGED
@@ -1296,7 +1296,7 @@ var MediaService = class extends BaseService {
1296
1296
  try {
1297
1297
  const querySnapshot = await getDocs(finalQuery);
1298
1298
  const mediaList = querySnapshot.docs.map(
1299
- (doc35) => doc35.data()
1299
+ (doc36) => doc36.data()
1300
1300
  );
1301
1301
  console.log(`[MediaService] Found ${mediaList.length} media items.`);
1302
1302
  return mediaList;
@@ -1977,8 +1977,8 @@ var getPatientsByPractitionerUtil = async (db, practitionerId, options) => {
1977
1977
  }
1978
1978
  const patientsSnapshot = await getDocs3(q);
1979
1979
  const patients = [];
1980
- patientsSnapshot.forEach((doc35) => {
1981
- patients.push(doc35.data());
1980
+ patientsSnapshot.forEach((doc36) => {
1981
+ patients.push(doc36.data());
1982
1982
  });
1983
1983
  console.log(
1984
1984
  `[getPatientsByPractitionerUtil] Found ${patients.length} patients for practitioner ID: ${practitionerId}`
@@ -2208,9 +2208,9 @@ var updateAllergyUtil = async (db, patientId, data, userRef) => {
2208
2208
  });
2209
2209
  };
2210
2210
  var removeAllergyUtil = async (db, patientId, allergyIndex, userRef) => {
2211
- const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2212
- if (!doc35.exists()) throw new Error("Medical info not found");
2213
- const medicalInfo = doc35.data();
2211
+ const doc36 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2212
+ if (!doc36.exists()) throw new Error("Medical info not found");
2213
+ const medicalInfo = doc36.data();
2214
2214
  if (allergyIndex >= medicalInfo.allergies.length) {
2215
2215
  throw new Error("Invalid allergy index");
2216
2216
  }
@@ -2235,9 +2235,9 @@ var addBlockingConditionUtil = async (db, patientId, data, userRef) => {
2235
2235
  var updateBlockingConditionUtil = async (db, patientId, data, userRef) => {
2236
2236
  const validatedData = updateBlockingConditionSchema.parse(data);
2237
2237
  const { conditionIndex, ...updateData } = validatedData;
2238
- const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2239
- if (!doc35.exists()) throw new Error("Medical info not found");
2240
- const medicalInfo = doc35.data();
2238
+ const doc36 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2239
+ if (!doc36.exists()) throw new Error("Medical info not found");
2240
+ const medicalInfo = doc36.data();
2241
2241
  if (conditionIndex >= medicalInfo.blockingConditions.length) {
2242
2242
  throw new Error("Invalid blocking condition index");
2243
2243
  }
@@ -2253,9 +2253,9 @@ var updateBlockingConditionUtil = async (db, patientId, data, userRef) => {
2253
2253
  });
2254
2254
  };
2255
2255
  var removeBlockingConditionUtil = async (db, patientId, conditionIndex, userRef) => {
2256
- const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2257
- if (!doc35.exists()) throw new Error("Medical info not found");
2258
- const medicalInfo = doc35.data();
2256
+ const doc36 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2257
+ if (!doc36.exists()) throw new Error("Medical info not found");
2258
+ const medicalInfo = doc36.data();
2259
2259
  if (conditionIndex >= medicalInfo.blockingConditions.length) {
2260
2260
  throw new Error("Invalid blocking condition index");
2261
2261
  }
@@ -2280,9 +2280,9 @@ var addContraindicationUtil = async (db, patientId, data, userRef) => {
2280
2280
  var updateContraindicationUtil = async (db, patientId, data, userRef) => {
2281
2281
  const validatedData = updateContraindicationSchema.parse(data);
2282
2282
  const { contraindicationIndex, ...updateData } = validatedData;
2283
- const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2284
- if (!doc35.exists()) throw new Error("Medical info not found");
2285
- const medicalInfo = doc35.data();
2283
+ const doc36 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2284
+ if (!doc36.exists()) throw new Error("Medical info not found");
2285
+ const medicalInfo = doc36.data();
2286
2286
  if (contraindicationIndex >= medicalInfo.contraindications.length) {
2287
2287
  throw new Error("Invalid contraindication index");
2288
2288
  }
@@ -2298,9 +2298,9 @@ var updateContraindicationUtil = async (db, patientId, data, userRef) => {
2298
2298
  });
2299
2299
  };
2300
2300
  var removeContraindicationUtil = async (db, patientId, contraindicationIndex, userRef) => {
2301
- const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2302
- if (!doc35.exists()) throw new Error("Medical info not found");
2303
- const medicalInfo = doc35.data();
2301
+ const doc36 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2302
+ if (!doc36.exists()) throw new Error("Medical info not found");
2303
+ const medicalInfo = doc36.data();
2304
2304
  if (contraindicationIndex >= medicalInfo.contraindications.length) {
2305
2305
  throw new Error("Invalid contraindication index");
2306
2306
  }
@@ -2325,9 +2325,9 @@ var addMedicationUtil = async (db, patientId, data, userRef) => {
2325
2325
  var updateMedicationUtil = async (db, patientId, data, userRef) => {
2326
2326
  const validatedData = updateMedicationSchema.parse(data);
2327
2327
  const { medicationIndex, ...updateData } = validatedData;
2328
- const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2329
- if (!doc35.exists()) throw new Error("Medical info not found");
2330
- const medicalInfo = doc35.data();
2328
+ const doc36 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2329
+ if (!doc36.exists()) throw new Error("Medical info not found");
2330
+ const medicalInfo = doc36.data();
2331
2331
  if (medicationIndex >= medicalInfo.currentMedications.length) {
2332
2332
  throw new Error("Invalid medication index");
2333
2333
  }
@@ -2343,9 +2343,9 @@ var updateMedicationUtil = async (db, patientId, data, userRef) => {
2343
2343
  });
2344
2344
  };
2345
2345
  var removeMedicationUtil = async (db, patientId, medicationIndex, userRef) => {
2346
- const doc35 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2347
- if (!doc35.exists()) throw new Error("Medical info not found");
2348
- const medicalInfo = doc35.data();
2346
+ const doc36 = await getDoc5(getMedicalInfoDocRef(db, patientId));
2347
+ if (!doc36.exists()) throw new Error("Medical info not found");
2348
+ const medicalInfo = doc36.data();
2349
2349
  if (medicationIndex >= medicalInfo.currentMedications.length) {
2350
2350
  throw new Error("Invalid medication index");
2351
2351
  }
@@ -2624,7 +2624,7 @@ var searchPatientsUtil = async (db, params, requester) => {
2624
2624
  const finalQuery = query4(patientsCollectionRef, ...constraints);
2625
2625
  const querySnapshot = await getDocs4(finalQuery);
2626
2626
  const patients = querySnapshot.docs.map(
2627
- (doc35) => doc35.data()
2627
+ (doc36) => doc36.data()
2628
2628
  );
2629
2629
  console.log(
2630
2630
  `[searchPatientsUtil] Found ${patients.length} patients matching criteria.`
@@ -2656,8 +2656,8 @@ var getAllPatientsUtil = async (db, options) => {
2656
2656
  }
2657
2657
  const patientsSnapshot = await getDocs4(q);
2658
2658
  const patients = [];
2659
- patientsSnapshot.forEach((doc35) => {
2660
- patients.push(doc35.data());
2659
+ patientsSnapshot.forEach((doc36) => {
2660
+ patients.push(doc36.data());
2661
2661
  });
2662
2662
  console.log(`[getAllPatientsUtil] Found ${patients.length} patients`);
2663
2663
  return patients;
@@ -2890,8 +2890,8 @@ var getPatientsByClinicUtil = async (db, clinicId, options) => {
2890
2890
  }
2891
2891
  const patientsSnapshot = await getDocs5(q);
2892
2892
  const patients = [];
2893
- patientsSnapshot.forEach((doc35) => {
2894
- patients.push(doc35.data());
2893
+ patientsSnapshot.forEach((doc36) => {
2894
+ patients.push(doc36.data());
2895
2895
  });
2896
2896
  console.log(
2897
2897
  `[getPatientsByClinicUtil] Found ${patients.length} patients for clinic ID: ${clinicId}`
@@ -4171,7 +4171,7 @@ async function getClinicAdminsByGroup(db, clinicGroupId) {
4171
4171
  where6("clinicGroupId", "==", clinicGroupId)
4172
4172
  );
4173
4173
  const querySnapshot = await getDocs6(q);
4174
- return querySnapshot.docs.map((doc35) => doc35.data());
4174
+ return querySnapshot.docs.map((doc36) => doc36.data());
4175
4175
  }
4176
4176
  async function updateClinicAdmin(db, adminId, data) {
4177
4177
  const admin = await getClinicAdmin(db, adminId);
@@ -4547,6 +4547,7 @@ var practitionerSchema = z14.object({
4547
4547
  clinicWorkingHours: z14.array(practitionerClinicWorkingHoursSchema),
4548
4548
  clinicsInfo: z14.array(clinicInfoSchema),
4549
4549
  procedures: z14.array(z14.string()),
4550
+ freeConsultations: z14.record(z14.string(), z14.string()).optional().nullable(),
4550
4551
  proceduresInfo: z14.array(procedureSummaryInfoSchema),
4551
4552
  reviewInfo: practitionerReviewInfoSchema,
4552
4553
  isActive: z14.boolean(),
@@ -4562,6 +4563,7 @@ var createPractitionerSchema = z14.object({
4562
4563
  clinics: z14.array(z14.string()).optional(),
4563
4564
  clinicWorkingHours: z14.array(practitionerClinicWorkingHoursSchema).optional(),
4564
4565
  clinicsInfo: z14.array(clinicInfoSchema).optional(),
4566
+ freeConsultations: z14.record(z14.string(), z14.string()).optional().nullable(),
4565
4567
  proceduresInfo: z14.array(procedureSummaryInfoSchema).optional(),
4566
4568
  isActive: z14.boolean(),
4567
4569
  isVerified: z14.boolean(),
@@ -4573,6 +4575,7 @@ var createDraftPractitionerSchema = z14.object({
4573
4575
  clinics: z14.array(z14.string()).optional(),
4574
4576
  clinicWorkingHours: z14.array(practitionerClinicWorkingHoursSchema).optional(),
4575
4577
  clinicsInfo: z14.array(clinicInfoSchema).optional(),
4578
+ freeConsultations: z14.record(z14.string(), z14.string()).optional().nullable(),
4576
4579
  proceduresInfo: z14.array(procedureSummaryInfoSchema).optional(),
4577
4580
  isActive: z14.boolean().optional().default(false),
4578
4581
  isVerified: z14.boolean().optional().default(false)
@@ -4617,9 +4620,10 @@ var practitionerSignupSchema = z14.object({
4617
4620
  import { z as z15 } from "zod";
4618
4621
  import { distanceBetween } from "geofire-common";
4619
4622
  var PractitionerService = class extends BaseService {
4620
- constructor(db, auth, app, clinicService) {
4623
+ constructor(db, auth, app, clinicService, procedureService) {
4621
4624
  super(db, auth, app);
4622
4625
  this.clinicService = clinicService;
4626
+ this.procedureService = procedureService;
4623
4627
  this.mediaService = new MediaService(db, auth, app);
4624
4628
  }
4625
4629
  getClinicService() {
@@ -4628,9 +4632,18 @@ var PractitionerService = class extends BaseService {
4628
4632
  }
4629
4633
  return this.clinicService;
4630
4634
  }
4635
+ getProcedureService() {
4636
+ if (!this.procedureService) {
4637
+ throw new Error("Procedure service not initialized!");
4638
+ }
4639
+ return this.procedureService;
4640
+ }
4631
4641
  setClinicService(clinicService) {
4632
4642
  this.clinicService = clinicService;
4633
4643
  }
4644
+ setProcedureService(procedureService) {
4645
+ this.procedureService = procedureService;
4646
+ }
4634
4647
  /**
4635
4648
  * Handles profile photo upload for practitioners
4636
4649
  * @param profilePhoto - MediaResource (File, Blob, or URL string)
@@ -4925,7 +4938,7 @@ var PractitionerService = class extends BaseService {
4925
4938
  where7("expiresAt", ">", Timestamp10.now())
4926
4939
  );
4927
4940
  const querySnapshot = await getDocs7(q);
4928
- return querySnapshot.docs.map((doc35) => doc35.data());
4941
+ return querySnapshot.docs.map((doc36) => doc36.data());
4929
4942
  }
4930
4943
  /**
4931
4944
  * Gets a token by its string value and validates it
@@ -5035,7 +5048,7 @@ var PractitionerService = class extends BaseService {
5035
5048
  where7("status", "==", "active" /* ACTIVE */)
5036
5049
  );
5037
5050
  const querySnapshot = await getDocs7(q);
5038
- return querySnapshot.docs.map((doc35) => doc35.data());
5051
+ return querySnapshot.docs.map((doc36) => doc36.data());
5039
5052
  }
5040
5053
  /**
5041
5054
  * Dohvata sve zdravstvene radnike za određenu kliniku
@@ -5047,7 +5060,7 @@ var PractitionerService = class extends BaseService {
5047
5060
  where7("isActive", "==", true)
5048
5061
  );
5049
5062
  const querySnapshot = await getDocs7(q);
5050
- return querySnapshot.docs.map((doc35) => doc35.data());
5063
+ return querySnapshot.docs.map((doc36) => doc36.data());
5051
5064
  }
5052
5065
  /**
5053
5066
  * Dohvata sve draft zdravstvene radnike za određenu kliniku sa statusom DRAFT
@@ -5059,7 +5072,7 @@ var PractitionerService = class extends BaseService {
5059
5072
  where7("status", "==", "draft" /* DRAFT */)
5060
5073
  );
5061
5074
  const querySnapshot = await getDocs7(q);
5062
- return querySnapshot.docs.map((doc35) => doc35.data());
5075
+ return querySnapshot.docs.map((doc36) => doc36.data());
5063
5076
  }
5064
5077
  /**
5065
5078
  * Updates a practitioner
@@ -5273,7 +5286,7 @@ var PractitionerService = class extends BaseService {
5273
5286
  );
5274
5287
  const querySnapshot = await getDocs7(q);
5275
5288
  const practitioners = querySnapshot.docs.map(
5276
- (doc35) => doc35.data()
5289
+ (doc36) => doc36.data()
5277
5290
  );
5278
5291
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
5279
5292
  return {
@@ -5344,8 +5357,8 @@ var PractitionerService = class extends BaseService {
5344
5357
  console.log(
5345
5358
  `[PRACTITIONER_SERVICE] Found ${querySnapshot.docs.length} practitioners with base query`
5346
5359
  );
5347
- let practitioners = querySnapshot.docs.map((doc35) => {
5348
- return { ...doc35.data(), id: doc35.id };
5360
+ let practitioners = querySnapshot.docs.map((doc36) => {
5361
+ return { ...doc36.data(), id: doc36.id };
5349
5362
  });
5350
5363
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
5351
5364
  if (filters.nameSearch && filters.nameSearch.trim() !== "") {
@@ -5425,6 +5438,119 @@ var PractitionerService = class extends BaseService {
5425
5438
  throw error;
5426
5439
  }
5427
5440
  }
5441
+ /**
5442
+ * Enables free consultation for a practitioner in a specific clinic
5443
+ * Creates a free consultation procedure with hardcoded parameters
5444
+ * @param practitionerId - ID of the practitioner
5445
+ * @param clinicId - ID of the clinic
5446
+ * @returns The created consultation procedure
5447
+ */
5448
+ async EnableFreeConsultation(practitionerId, clinicId) {
5449
+ try {
5450
+ const practitioner = await this.getPractitioner(practitionerId);
5451
+ if (!practitioner) {
5452
+ throw new Error(`Practitioner ${practitionerId} not found`);
5453
+ }
5454
+ if (!practitioner.isActive || practitioner.status !== "active" /* ACTIVE */) {
5455
+ throw new Error(`Practitioner ${practitionerId} is not active`);
5456
+ }
5457
+ const clinic = await this.getClinicService().getClinic(clinicId);
5458
+ if (!clinic) {
5459
+ throw new Error(`Clinic ${clinicId} not found`);
5460
+ }
5461
+ if (!practitioner.clinics.includes(clinicId)) {
5462
+ throw new Error(
5463
+ `Practitioner ${practitionerId} is not associated with clinic ${clinicId}`
5464
+ );
5465
+ }
5466
+ const existingProcedures = await this.getProcedureService().getProceduresByPractitioner(
5467
+ practitionerId
5468
+ );
5469
+ const existingConsultation = existingProcedures.find(
5470
+ (procedure) => procedure.name === "Free Consultation" && procedure.clinicBranchId === clinicId && procedure.isActive
5471
+ );
5472
+ if (existingConsultation) {
5473
+ console.log(
5474
+ `Free consultation already exists for practitioner ${practitionerId} in clinic ${clinicId}`
5475
+ );
5476
+ return;
5477
+ }
5478
+ const consultationData = {
5479
+ name: "Free Consultation",
5480
+ description: "Free initial consultation to discuss treatment options and assess patient needs.",
5481
+ family: "aesthetics" /* AESTHETICS */,
5482
+ categoryId: "consultation",
5483
+ subcategoryId: "free-consultation",
5484
+ technologyId: "free-consultation-tech",
5485
+ price: 0,
5486
+ currency: "EUR" /* EUR */,
5487
+ pricingMeasure: "per_session" /* PER_SESSION */,
5488
+ duration: 30,
5489
+ // 30 minutes consultation
5490
+ practitionerId,
5491
+ clinicBranchId: clinicId,
5492
+ photos: []
5493
+ // No photos for consultation
5494
+ };
5495
+ await this.getProcedureService().createConsultationProcedure(
5496
+ consultationData
5497
+ );
5498
+ console.log(
5499
+ `Free consultation enabled for practitioner ${practitionerId} in clinic ${clinicId}`
5500
+ );
5501
+ } catch (error) {
5502
+ console.error(
5503
+ `Error enabling free consultation for practitioner ${practitionerId} in clinic ${clinicId}:`,
5504
+ error
5505
+ );
5506
+ throw error;
5507
+ }
5508
+ }
5509
+ /**
5510
+ * Disables free consultation for a practitioner in a specific clinic
5511
+ * Finds and deactivates the existing free consultation procedure
5512
+ * @param practitionerId - ID of the practitioner
5513
+ * @param clinicId - ID of the clinic
5514
+ */
5515
+ async DisableFreeConsultation(practitionerId, clinicId) {
5516
+ try {
5517
+ const practitioner = await this.getPractitioner(practitionerId);
5518
+ if (!practitioner) {
5519
+ throw new Error(`Practitioner ${practitionerId} not found`);
5520
+ }
5521
+ const clinic = await this.getClinicService().getClinic(clinicId);
5522
+ if (!clinic) {
5523
+ throw new Error(`Clinic ${clinicId} not found`);
5524
+ }
5525
+ if (!practitioner.clinics.includes(clinicId)) {
5526
+ throw new Error(
5527
+ `Practitioner ${practitionerId} is not associated with clinic ${clinicId}`
5528
+ );
5529
+ }
5530
+ const existingProcedures = await this.getProcedureService().getProceduresByPractitioner(
5531
+ practitionerId
5532
+ );
5533
+ const freeConsultation = existingProcedures.find(
5534
+ (procedure) => procedure.name === "Free Consultation" && procedure.clinicBranchId === clinicId && procedure.isActive
5535
+ );
5536
+ if (!freeConsultation) {
5537
+ console.log(
5538
+ `No active free consultation found for practitioner ${practitionerId} in clinic ${clinicId}`
5539
+ );
5540
+ return;
5541
+ }
5542
+ await this.getProcedureService().deactivateProcedure(freeConsultation.id);
5543
+ console.log(
5544
+ `Free consultation disabled for practitioner ${practitionerId} in clinic ${clinicId}`
5545
+ );
5546
+ } catch (error) {
5547
+ console.error(
5548
+ `Error disabling free consultation for practitioner ${practitionerId} in clinic ${clinicId}:`,
5549
+ error
5550
+ );
5551
+ throw error;
5552
+ }
5553
+ }
5428
5554
  };
5429
5555
 
5430
5556
  // src/services/user.service.ts
@@ -5602,7 +5728,7 @@ var UserService = class extends BaseService {
5602
5728
  ];
5603
5729
  const q = query8(collection8(this.db, USERS_COLLECTION), ...constraints);
5604
5730
  const querySnapshot = await getDocs8(q);
5605
- const users = querySnapshot.docs.map((doc35) => doc35.data());
5731
+ const users = querySnapshot.docs.map((doc36) => doc36.data());
5606
5732
  return Promise.all(users.map((userData) => userSchema.parse(userData)));
5607
5733
  }
5608
5734
  /**
@@ -5982,7 +6108,7 @@ async function getAllActiveGroups(db) {
5982
6108
  where9("isActive", "==", true)
5983
6109
  );
5984
6110
  const querySnapshot = await getDocs9(q);
5985
- return querySnapshot.docs.map((doc35) => doc35.data());
6111
+ return querySnapshot.docs.map((doc36) => doc36.data());
5986
6112
  }
5987
6113
  async function updateClinicGroup(db, groupId, data, app) {
5988
6114
  console.log("[CLINIC_GROUP] Updating clinic group", { groupId });
@@ -6447,7 +6573,7 @@ async function getClinicsByGroup(db, groupId) {
6447
6573
  where10("isActive", "==", true)
6448
6574
  );
6449
6575
  const querySnapshot = await getDocs10(q);
6450
- return querySnapshot.docs.map((doc35) => doc35.data());
6576
+ return querySnapshot.docs.map((doc36) => doc36.data());
6451
6577
  }
6452
6578
  async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app) {
6453
6579
  console.log("[CLINIC] Starting clinic update", { clinicId, adminId });
@@ -6641,7 +6767,7 @@ async function getClinicsByAdmin(db, adminId, options = {}, clinicAdminService,
6641
6767
  }
6642
6768
  const q = query10(collection10(db, CLINICS_COLLECTION), ...constraints);
6643
6769
  const querySnapshot = await getDocs10(q);
6644
- return querySnapshot.docs.map((doc35) => doc35.data());
6770
+ return querySnapshot.docs.map((doc36) => doc36.data());
6645
6771
  }
6646
6772
  async function getActiveClinicsByAdmin(db, adminId, clinicAdminService, clinicGroupService) {
6647
6773
  return getClinicsByAdmin(
@@ -6686,11 +6812,11 @@ async function getAllClinics(db, pagination, lastDoc) {
6686
6812
  }
6687
6813
  const clinicsSnapshot = await getDocs10(clinicsQuery);
6688
6814
  const lastVisible = clinicsSnapshot.docs[clinicsSnapshot.docs.length - 1];
6689
- const clinics = clinicsSnapshot.docs.map((doc35) => {
6690
- const data = doc35.data();
6815
+ const clinics = clinicsSnapshot.docs.map((doc36) => {
6816
+ const data = doc36.data();
6691
6817
  return {
6692
6818
  ...data,
6693
- id: doc35.id
6819
+ id: doc36.id
6694
6820
  };
6695
6821
  });
6696
6822
  return {
@@ -6717,8 +6843,8 @@ async function getAllClinicsInRange(db, center, rangeInKm, pagination, lastDoc)
6717
6843
  ];
6718
6844
  const q = query10(collection10(db, CLINICS_COLLECTION), ...constraints);
6719
6845
  const querySnapshot = await getDocs10(q);
6720
- for (const doc35 of querySnapshot.docs) {
6721
- const clinic = doc35.data();
6846
+ for (const doc36 of querySnapshot.docs) {
6847
+ const clinic = doc36.data();
6722
6848
  const distance = distanceBetween2(
6723
6849
  [center.latitude, center.longitude],
6724
6850
  [clinic.location.latitude, clinic.location.longitude]
@@ -6840,8 +6966,8 @@ async function findClinicsInRadius(db, center, radiusInKm, filters) {
6840
6966
  }
6841
6967
  const q = query11(collection11(db, CLINICS_COLLECTION), ...constraints);
6842
6968
  const querySnapshot = await getDocs11(q);
6843
- for (const doc35 of querySnapshot.docs) {
6844
- const clinic = doc35.data();
6969
+ for (const doc36 of querySnapshot.docs) {
6970
+ const clinic = doc36.data();
6845
6971
  const distance = distanceBetween3(
6846
6972
  [center.latitude, center.longitude],
6847
6973
  [clinic.location.latitude, clinic.location.longitude]
@@ -6937,8 +7063,8 @@ async function getClinicsByFilters(db, filters) {
6937
7063
  console.log(
6938
7064
  `[FILTER_UTILS] Found ${querySnapshot.docs.length} clinics in geo bound`
6939
7065
  );
6940
- for (const doc35 of querySnapshot.docs) {
6941
- const clinic = { ...doc35.data(), id: doc35.id };
7066
+ for (const doc36 of querySnapshot.docs) {
7067
+ const clinic = { ...doc36.data(), id: doc36.id };
6942
7068
  const distance = distanceBetween4(
6943
7069
  [center.latitude, center.longitude],
6944
7070
  [clinic.location.latitude, clinic.location.longitude]
@@ -6994,8 +7120,8 @@ async function getClinicsByFilters(db, filters) {
6994
7120
  console.log(
6995
7121
  `[FILTER_UTILS] Found ${querySnapshot.docs.length} clinics with regular query`
6996
7122
  );
6997
- const clinics = querySnapshot.docs.map((doc35) => {
6998
- return { ...doc35.data(), id: doc35.id };
7123
+ const clinics = querySnapshot.docs.map((doc36) => {
7124
+ return { ...doc36.data(), id: doc36.id };
6999
7125
  });
7000
7126
  let filteredClinics = clinics;
7001
7127
  if (filters.center) {
@@ -8442,9 +8568,9 @@ var NotificationService = class extends BaseService {
8442
8568
  orderBy4("notificationTime", "desc")
8443
8569
  );
8444
8570
  const querySnapshot = await getDocs15(q);
8445
- return querySnapshot.docs.map((doc35) => ({
8446
- id: doc35.id,
8447
- ...doc35.data()
8571
+ return querySnapshot.docs.map((doc36) => ({
8572
+ id: doc36.id,
8573
+ ...doc36.data()
8448
8574
  }));
8449
8575
  }
8450
8576
  /**
@@ -8458,9 +8584,9 @@ var NotificationService = class extends BaseService {
8458
8584
  orderBy4("notificationTime", "desc")
8459
8585
  );
8460
8586
  const querySnapshot = await getDocs15(q);
8461
- return querySnapshot.docs.map((doc35) => ({
8462
- id: doc35.id,
8463
- ...doc35.data()
8587
+ return querySnapshot.docs.map((doc36) => ({
8588
+ id: doc36.id,
8589
+ ...doc36.data()
8464
8590
  }));
8465
8591
  }
8466
8592
  /**
@@ -8532,9 +8658,9 @@ var NotificationService = class extends BaseService {
8532
8658
  orderBy4("notificationTime", "desc")
8533
8659
  );
8534
8660
  const querySnapshot = await getDocs15(q);
8535
- return querySnapshot.docs.map((doc35) => ({
8536
- id: doc35.id,
8537
- ...doc35.data()
8661
+ return querySnapshot.docs.map((doc36) => ({
8662
+ id: doc36.id,
8663
+ ...doc36.data()
8538
8664
  }));
8539
8665
  }
8540
8666
  /**
@@ -8547,9 +8673,9 @@ var NotificationService = class extends BaseService {
8547
8673
  orderBy4("notificationTime", "desc")
8548
8674
  );
8549
8675
  const querySnapshot = await getDocs15(q);
8550
- return querySnapshot.docs.map((doc35) => ({
8551
- id: doc35.id,
8552
- ...doc35.data()
8676
+ return querySnapshot.docs.map((doc36) => ({
8677
+ id: doc36.id,
8678
+ ...doc36.data()
8553
8679
  }));
8554
8680
  }
8555
8681
  };
@@ -8844,7 +8970,7 @@ var ProcedureService = class extends BaseService {
8844
8970
  where16("isActive", "==", true)
8845
8971
  );
8846
8972
  const snapshot = await getDocs16(q);
8847
- return snapshot.docs.map((doc35) => doc35.data());
8973
+ return snapshot.docs.map((doc36) => doc36.data());
8848
8974
  }
8849
8975
  /**
8850
8976
  * Gets all procedures for a practitioner
@@ -8858,7 +8984,7 @@ var ProcedureService = class extends BaseService {
8858
8984
  where16("isActive", "==", true)
8859
8985
  );
8860
8986
  const snapshot = await getDocs16(q);
8861
- return snapshot.docs.map((doc35) => doc35.data());
8987
+ return snapshot.docs.map((doc36) => doc36.data());
8862
8988
  }
8863
8989
  /**
8864
8990
  * Updates a procedure
@@ -9070,11 +9196,11 @@ var ProcedureService = class extends BaseService {
9070
9196
  }
9071
9197
  const proceduresSnapshot = await getDocs16(proceduresQuery);
9072
9198
  const lastVisible = proceduresSnapshot.docs[proceduresSnapshot.docs.length - 1];
9073
- const procedures = proceduresSnapshot.docs.map((doc35) => {
9074
- const data = doc35.data();
9199
+ const procedures = proceduresSnapshot.docs.map((doc36) => {
9200
+ const data = doc36.data();
9075
9201
  return {
9076
9202
  ...data,
9077
- id: doc35.id
9203
+ id: doc36.id
9078
9204
  // Ensure ID is present
9079
9205
  };
9080
9206
  });
@@ -9156,8 +9282,8 @@ var ProcedureService = class extends BaseService {
9156
9282
  console.log(
9157
9283
  `[PROCEDURE_SERVICE] Found ${querySnapshot.docs.length} procedures in geo bound`
9158
9284
  );
9159
- for (const doc35 of querySnapshot.docs) {
9160
- const procedure = { ...doc35.data(), id: doc35.id };
9285
+ for (const doc36 of querySnapshot.docs) {
9286
+ const procedure = { ...doc36.data(), id: doc36.id };
9161
9287
  const distance = distanceBetween6(
9162
9288
  [center.latitude, center.longitude],
9163
9289
  [
@@ -9208,8 +9334,8 @@ var ProcedureService = class extends BaseService {
9208
9334
  console.log(
9209
9335
  `[PROCEDURE_SERVICE] Found ${querySnapshot.docs.length} procedures with regular query`
9210
9336
  );
9211
- const procedures = querySnapshot.docs.map((doc35) => {
9212
- return { ...doc35.data(), id: doc35.id };
9337
+ const procedures = querySnapshot.docs.map((doc36) => {
9338
+ return { ...doc36.data(), id: doc36.id };
9213
9339
  });
9214
9340
  if (filters.location) {
9215
9341
  const center = filters.location;
@@ -9313,6 +9439,114 @@ var ProcedureService = class extends BaseService {
9313
9439
  }
9314
9440
  return filteredProcedures;
9315
9441
  }
9442
+ /**
9443
+ * Creates a consultation procedure without requiring a product
9444
+ * This is a special method for consultation procedures that don't use products
9445
+ * @param data - The data for creating a consultation procedure (without productId)
9446
+ * @returns The created procedure
9447
+ */
9448
+ async createConsultationProcedure(data) {
9449
+ var _a;
9450
+ const procedureId = this.generateId();
9451
+ const [category, subcategory, technology] = await Promise.all([
9452
+ this.categoryService.getById(data.categoryId),
9453
+ this.subcategoryService.getById(data.categoryId, data.subcategoryId),
9454
+ this.technologyService.getById(data.technologyId)
9455
+ ]);
9456
+ if (!category || !subcategory || !technology) {
9457
+ throw new Error("One or more required base entities not found");
9458
+ }
9459
+ const clinicRef = doc16(this.db, CLINICS_COLLECTION, data.clinicBranchId);
9460
+ const clinicSnapshot = await getDoc19(clinicRef);
9461
+ if (!clinicSnapshot.exists()) {
9462
+ throw new Error(`Clinic with ID ${data.clinicBranchId} not found`);
9463
+ }
9464
+ const clinic = clinicSnapshot.data();
9465
+ const practitionerRef = doc16(
9466
+ this.db,
9467
+ PRACTITIONERS_COLLECTION,
9468
+ data.practitionerId
9469
+ );
9470
+ const practitionerSnapshot = await getDoc19(practitionerRef);
9471
+ if (!practitionerSnapshot.exists()) {
9472
+ throw new Error(`Practitioner with ID ${data.practitionerId} not found`);
9473
+ }
9474
+ const practitioner = practitionerSnapshot.data();
9475
+ let processedPhotos = [];
9476
+ if (data.photos && data.photos.length > 0) {
9477
+ processedPhotos = await this.processMediaArray(
9478
+ data.photos,
9479
+ procedureId,
9480
+ "procedure-photos"
9481
+ );
9482
+ }
9483
+ const clinicInfo = {
9484
+ id: clinicSnapshot.id,
9485
+ name: clinic.name,
9486
+ description: clinic.description || "",
9487
+ featuredPhoto: clinic.featuredPhotos && clinic.featuredPhotos.length > 0 ? typeof clinic.featuredPhotos[0] === "string" ? clinic.featuredPhotos[0] : "" : typeof clinic.coverPhoto === "string" ? clinic.coverPhoto : "",
9488
+ location: clinic.location,
9489
+ contactInfo: clinic.contactInfo
9490
+ };
9491
+ const doctorInfo = {
9492
+ id: practitionerSnapshot.id,
9493
+ name: `${practitioner.basicInfo.firstName} ${practitioner.basicInfo.lastName}`,
9494
+ description: practitioner.basicInfo.bio || "",
9495
+ photo: typeof practitioner.basicInfo.profileImageUrl === "string" ? practitioner.basicInfo.profileImageUrl : "",
9496
+ rating: ((_a = practitioner.reviewInfo) == null ? void 0 : _a.averageRating) || 0,
9497
+ services: practitioner.procedures || []
9498
+ };
9499
+ const consultationProduct = {
9500
+ id: "consultation-no-product",
9501
+ name: "No Product Required",
9502
+ description: "Consultation procedures do not require specific products",
9503
+ brandId: "consultation-brand",
9504
+ brandName: "Consultation",
9505
+ technologyId: data.technologyId,
9506
+ technologyName: technology.name,
9507
+ isActive: true,
9508
+ createdAt: /* @__PURE__ */ new Date(),
9509
+ updatedAt: /* @__PURE__ */ new Date()
9510
+ };
9511
+ const newProcedure = {
9512
+ id: procedureId,
9513
+ ...data,
9514
+ photos: processedPhotos,
9515
+ category,
9516
+ subcategory,
9517
+ technology,
9518
+ product: consultationProduct,
9519
+ // Use placeholder product
9520
+ blockingConditions: technology.blockingConditions,
9521
+ contraindications: technology.contraindications || [],
9522
+ treatmentBenefits: technology.benefits,
9523
+ preRequirements: technology.requirements.pre,
9524
+ postRequirements: technology.requirements.post,
9525
+ certificationRequirement: technology.certificationRequirement,
9526
+ documentationTemplates: (technology == null ? void 0 : technology.documentationTemplates) || [],
9527
+ clinicInfo,
9528
+ doctorInfo,
9529
+ reviewInfo: {
9530
+ totalReviews: 0,
9531
+ averageRating: 0,
9532
+ effectivenessOfTreatment: 0,
9533
+ outcomeExplanation: 0,
9534
+ painManagement: 0,
9535
+ followUpCare: 0,
9536
+ valueForMoney: 0,
9537
+ recommendationPercentage: 0
9538
+ },
9539
+ isActive: true
9540
+ };
9541
+ const procedureRef = doc16(this.db, PROCEDURES_COLLECTION, procedureId);
9542
+ await setDoc14(procedureRef, {
9543
+ ...newProcedure,
9544
+ createdAt: serverTimestamp14(),
9545
+ updatedAt: serverTimestamp14()
9546
+ });
9547
+ const savedDoc = await getDoc19(procedureRef);
9548
+ return savedDoc.data();
9549
+ }
9316
9550
  };
9317
9551
 
9318
9552
  // src/services/clinic/practitioner-invite.service.ts
@@ -9434,7 +9668,7 @@ var PractitionerInviteService = class extends BaseService {
9434
9668
  ...constraints
9435
9669
  );
9436
9670
  const querySnapshot = await getDocs17(q);
9437
- return querySnapshot.docs.map((doc35) => doc35.data());
9671
+ return querySnapshot.docs.map((doc36) => doc36.data());
9438
9672
  } catch (error) {
9439
9673
  console.error(
9440
9674
  "[PractitionerInviteService] Error getting doctor invites:",
@@ -9463,7 +9697,7 @@ var PractitionerInviteService = class extends BaseService {
9463
9697
  ...constraints
9464
9698
  );
9465
9699
  const querySnapshot = await getDocs17(q);
9466
- return querySnapshot.docs.map((doc35) => doc35.data());
9700
+ return querySnapshot.docs.map((doc36) => doc36.data());
9467
9701
  } catch (error) {
9468
9702
  console.error(
9469
9703
  "[PractitionerInviteService] Error getting clinic invites:",
@@ -9619,7 +9853,7 @@ var PractitionerInviteService = class extends BaseService {
9619
9853
  );
9620
9854
  const querySnapshot = await getDocs17(q);
9621
9855
  let invites = querySnapshot.docs.map(
9622
- (doc35) => doc35.data()
9856
+ (doc36) => doc36.data()
9623
9857
  );
9624
9858
  if (filters.fromDate) {
9625
9859
  invites = invites.filter(
@@ -9889,8 +10123,8 @@ var DocumentationTemplateService = class extends BaseService {
9889
10123
  const q = query18(versionsCollectionRef, orderBy7("version", "desc"));
9890
10124
  const querySnapshot = await getDocs18(q);
9891
10125
  const versions = [];
9892
- querySnapshot.forEach((doc35) => {
9893
- versions.push(doc35.data());
10126
+ querySnapshot.forEach((doc36) => {
10127
+ versions.push(doc36.data());
9894
10128
  });
9895
10129
  return versions;
9896
10130
  }
@@ -9921,9 +10155,9 @@ var DocumentationTemplateService = class extends BaseService {
9921
10155
  const querySnapshot = await getDocs18(q);
9922
10156
  const templates = [];
9923
10157
  let lastVisible = null;
9924
- querySnapshot.forEach((doc35) => {
9925
- templates.push(doc35.data());
9926
- lastVisible = doc35;
10158
+ querySnapshot.forEach((doc36) => {
10159
+ templates.push(doc36.data());
10160
+ lastVisible = doc36;
9927
10161
  });
9928
10162
  return {
9929
10163
  templates,
@@ -9951,9 +10185,9 @@ var DocumentationTemplateService = class extends BaseService {
9951
10185
  const querySnapshot = await getDocs18(q);
9952
10186
  const templates = [];
9953
10187
  let lastVisible = null;
9954
- querySnapshot.forEach((doc35) => {
9955
- templates.push(doc35.data());
9956
- lastVisible = doc35;
10188
+ querySnapshot.forEach((doc36) => {
10189
+ templates.push(doc36.data());
10190
+ lastVisible = doc36;
9957
10191
  });
9958
10192
  return {
9959
10193
  templates,
@@ -9980,9 +10214,9 @@ var DocumentationTemplateService = class extends BaseService {
9980
10214
  const querySnapshot = await getDocs18(q);
9981
10215
  const templates = [];
9982
10216
  let lastVisible = null;
9983
- querySnapshot.forEach((doc35) => {
9984
- templates.push(doc35.data());
9985
- lastVisible = doc35;
10217
+ querySnapshot.forEach((doc36) => {
10218
+ templates.push(doc36.data());
10219
+ lastVisible = doc36;
9986
10220
  });
9987
10221
  return {
9988
10222
  templates,
@@ -10008,8 +10242,8 @@ var DocumentationTemplateService = class extends BaseService {
10008
10242
  }
10009
10243
  const querySnapshot = await getDocs18(q);
10010
10244
  const templates = [];
10011
- querySnapshot.forEach((doc35) => {
10012
- templates.push(doc35.data());
10245
+ querySnapshot.forEach((doc36) => {
10246
+ templates.push(doc36.data());
10013
10247
  });
10014
10248
  return templates;
10015
10249
  }
@@ -10215,9 +10449,9 @@ var FilledDocumentService = class extends BaseService {
10215
10449
  const querySnapshot = await getDocs19(q);
10216
10450
  const documents = [];
10217
10451
  let lastVisible = null;
10218
- querySnapshot.forEach((doc35) => {
10219
- documents.push(doc35.data());
10220
- lastVisible = doc35;
10452
+ querySnapshot.forEach((doc36) => {
10453
+ documents.push(doc36.data());
10454
+ lastVisible = doc36;
10221
10455
  });
10222
10456
  return {
10223
10457
  documents,
@@ -10572,6 +10806,28 @@ var calendarEventSchema = z23.object({
10572
10806
  createdAt: z23.instanceof(Date).or(z23.instanceof(Timestamp21)),
10573
10807
  updatedAt: z23.instanceof(Date).or(z23.instanceof(Timestamp21))
10574
10808
  });
10809
+ var createBlockingEventSchema = z23.object({
10810
+ entityType: z23.enum(["practitioner", "clinic"]),
10811
+ entityId: z23.string().min(1, "Entity ID is required"),
10812
+ eventName: z23.string().min(1, "Event name is required").max(200, "Event name too long"),
10813
+ eventTime: calendarEventTimeSchema,
10814
+ eventType: z23.enum([
10815
+ "blocking" /* BLOCKING */,
10816
+ "break" /* BREAK */,
10817
+ "free_day" /* FREE_DAY */,
10818
+ "other" /* OTHER */
10819
+ ]),
10820
+ description: z23.string().max(1e3, "Description too long").optional()
10821
+ });
10822
+ var updateBlockingEventSchema = z23.object({
10823
+ entityType: z23.enum(["practitioner", "clinic"]),
10824
+ entityId: z23.string().min(1, "Entity ID is required"),
10825
+ eventId: z23.string().min(1, "Event ID is required"),
10826
+ eventName: z23.string().min(1, "Event name is required").max(200, "Event name too long").optional(),
10827
+ eventTime: calendarEventTimeSchema.optional(),
10828
+ description: z23.string().max(1e3, "Description too long").optional(),
10829
+ status: z23.nativeEnum(CalendarEventStatus).optional()
10830
+ });
10575
10831
 
10576
10832
  // src/services/calendar/utils/clinic.utils.ts
10577
10833
  import {
@@ -10922,7 +11178,7 @@ async function searchCalendarEventsUtil(db, params) {
10922
11178
  const finalQuery = query23(collectionRef, ...constraints);
10923
11179
  const querySnapshot = await getDocs23(finalQuery);
10924
11180
  const events = querySnapshot.docs.map(
10925
- (doc35) => ({ id: doc35.id, ...doc35.data() })
11181
+ (doc36) => ({ id: doc36.id, ...doc36.data() })
10926
11182
  );
10927
11183
  return events;
10928
11184
  } catch (error) {
@@ -11015,7 +11271,7 @@ async function getPractitionerSyncedCalendarsUtil(db, practitionerId) {
11015
11271
  );
11016
11272
  const q = query24(calendarsRef, orderBy13("createdAt", "desc"));
11017
11273
  const querySnapshot = await getDocs24(q);
11018
- return querySnapshot.docs.map((doc35) => doc35.data());
11274
+ return querySnapshot.docs.map((doc36) => doc36.data());
11019
11275
  }
11020
11276
  async function getPatientSyncedCalendarUtil(db, patientId, calendarId) {
11021
11277
  const calendarRef = getPatientSyncedCalendarDocRef(db, patientId, calendarId);
@@ -11032,7 +11288,7 @@ async function getPatientSyncedCalendarsUtil(db, patientId) {
11032
11288
  );
11033
11289
  const q = query24(calendarsRef, orderBy13("createdAt", "desc"));
11034
11290
  const querySnapshot = await getDocs24(q);
11035
- return querySnapshot.docs.map((doc35) => doc35.data());
11291
+ return querySnapshot.docs.map((doc36) => doc36.data());
11036
11292
  }
11037
11293
  async function getClinicSyncedCalendarUtil(db, clinicId, calendarId) {
11038
11294
  const calendarRef = getClinicSyncedCalendarDocRef(db, clinicId, calendarId);
@@ -11049,7 +11305,7 @@ async function getClinicSyncedCalendarsUtil(db, clinicId) {
11049
11305
  );
11050
11306
  const q = query24(calendarsRef, orderBy13("createdAt", "desc"));
11051
11307
  const querySnapshot = await getDocs24(q);
11052
- return querySnapshot.docs.map((doc35) => doc35.data());
11308
+ return querySnapshot.docs.map((doc36) => doc36.data());
11053
11309
  }
11054
11310
  async function updatePractitionerSyncedCalendarUtil(db, practitionerId, calendarId, updateData) {
11055
11311
  const calendarRef = getPractitionerSyncedCalendarDocRef(
@@ -12404,9 +12660,9 @@ var CalendarServiceV2 = class extends BaseService {
12404
12660
  where25("eventTime.start", "<=", Timestamp28.fromDate(endDate))
12405
12661
  );
12406
12662
  const eventsSnapshot = await getDocs25(q);
12407
- const events = eventsSnapshot.docs.map((doc35) => ({
12408
- id: doc35.id,
12409
- ...doc35.data()
12663
+ const events = eventsSnapshot.docs.map((doc36) => ({
12664
+ id: doc36.id,
12665
+ ...doc36.data()
12410
12666
  }));
12411
12667
  const calendars = await this.syncedCalendarsService.getPractitionerSyncedCalendars(
12412
12668
  doctorId
@@ -13040,7 +13296,7 @@ var CalendarServiceV2 = class extends BaseService {
13040
13296
  ])
13041
13297
  );
13042
13298
  const querySnapshot = await getDocs25(q);
13043
- return querySnapshot.docs.map((doc35) => doc35.data());
13299
+ return querySnapshot.docs.map((doc36) => doc36.data());
13044
13300
  }
13045
13301
  /**
13046
13302
  * Calculates available time slots based on working hours, schedule and existing appointments
@@ -13164,17 +13420,214 @@ var CalendarServiceV2 = class extends BaseService {
13164
13420
  // #endregion
13165
13421
  };
13166
13422
 
13423
+ // src/services/calendar/calendar.v3.service.ts
13424
+ import { Timestamp as Timestamp29, serverTimestamp as serverTimestamp23 } from "firebase/firestore";
13425
+ import { doc as doc27, getDoc as getDoc29, setDoc as setDoc24, updateDoc as updateDoc26, deleteDoc as deleteDoc17 } from "firebase/firestore";
13426
+ var CalendarServiceV3 = class extends BaseService {
13427
+ /**
13428
+ * Creates a new CalendarServiceV3 instance
13429
+ * @param db - Firestore instance
13430
+ * @param auth - Firebase Auth instance
13431
+ * @param app - Firebase App instance
13432
+ */
13433
+ constructor(db, auth, app) {
13434
+ super(db, auth, app);
13435
+ }
13436
+ // #region Blocking Event CRUD Operations
13437
+ /**
13438
+ * Creates a blocking event for a practitioner or clinic
13439
+ * @param params - Blocking event creation parameters
13440
+ * @returns Created calendar event
13441
+ */
13442
+ async createBlockingEvent(params) {
13443
+ this.validateBlockingEventParams(params);
13444
+ const eventId = this.generateId();
13445
+ const collectionPath = this.getEntityCalendarPath(
13446
+ params.entityType,
13447
+ params.entityId
13448
+ );
13449
+ const eventRef = doc27(this.db, collectionPath, eventId);
13450
+ const eventData = {
13451
+ id: eventId,
13452
+ eventName: params.eventName,
13453
+ eventTime: params.eventTime,
13454
+ eventType: params.eventType,
13455
+ description: params.description || "",
13456
+ status: "confirmed" /* CONFIRMED */,
13457
+ // Blocking events are always confirmed
13458
+ syncStatus: "internal" /* INTERNAL */,
13459
+ createdAt: serverTimestamp23(),
13460
+ updatedAt: serverTimestamp23()
13461
+ };
13462
+ if (params.entityType === "practitioner") {
13463
+ eventData.practitionerProfileId = params.entityId;
13464
+ } else {
13465
+ eventData.clinicBranchId = params.entityId;
13466
+ }
13467
+ await setDoc24(eventRef, eventData);
13468
+ return {
13469
+ ...eventData,
13470
+ createdAt: Timestamp29.now(),
13471
+ updatedAt: Timestamp29.now()
13472
+ };
13473
+ }
13474
+ /**
13475
+ * Updates a blocking event
13476
+ * @param params - Blocking event update parameters
13477
+ * @returns Updated calendar event
13478
+ */
13479
+ async updateBlockingEvent(params) {
13480
+ const collectionPath = this.getEntityCalendarPath(
13481
+ params.entityType,
13482
+ params.entityId
13483
+ );
13484
+ const eventRef = doc27(this.db, collectionPath, params.eventId);
13485
+ const eventDoc = await getDoc29(eventRef);
13486
+ if (!eventDoc.exists()) {
13487
+ throw new Error(`Blocking event with ID ${params.eventId} not found`);
13488
+ }
13489
+ const updateData = {
13490
+ updatedAt: serverTimestamp23()
13491
+ };
13492
+ if (params.eventName !== void 0) {
13493
+ updateData.eventName = params.eventName;
13494
+ }
13495
+ if (params.eventTime !== void 0) {
13496
+ updateData.eventTime = params.eventTime;
13497
+ }
13498
+ if (params.description !== void 0) {
13499
+ updateData.description = params.description;
13500
+ }
13501
+ if (params.status !== void 0) {
13502
+ updateData.status = params.status;
13503
+ }
13504
+ await updateDoc26(eventRef, updateData);
13505
+ const updatedEventDoc = await getDoc29(eventRef);
13506
+ return updatedEventDoc.data();
13507
+ }
13508
+ /**
13509
+ * Deletes a blocking event
13510
+ * @param entityType - Type of entity (practitioner or clinic)
13511
+ * @param entityId - ID of the entity
13512
+ * @param eventId - ID of the event to delete
13513
+ */
13514
+ async deleteBlockingEvent(entityType, entityId, eventId) {
13515
+ const collectionPath = this.getEntityCalendarPath(entityType, entityId);
13516
+ const eventRef = doc27(this.db, collectionPath, eventId);
13517
+ const eventDoc = await getDoc29(eventRef);
13518
+ if (!eventDoc.exists()) {
13519
+ throw new Error(`Blocking event with ID ${eventId} not found`);
13520
+ }
13521
+ await deleteDoc17(eventRef);
13522
+ }
13523
+ /**
13524
+ * Gets a specific blocking event
13525
+ * @param entityType - Type of entity (practitioner or clinic)
13526
+ * @param entityId - ID of the entity
13527
+ * @param eventId - ID of the event to retrieve
13528
+ * @returns Calendar event or null if not found
13529
+ */
13530
+ async getBlockingEvent(entityType, entityId, eventId) {
13531
+ const collectionPath = this.getEntityCalendarPath(entityType, entityId);
13532
+ const eventRef = doc27(this.db, collectionPath, eventId);
13533
+ const eventDoc = await getDoc29(eventRef);
13534
+ if (!eventDoc.exists()) {
13535
+ return null;
13536
+ }
13537
+ return eventDoc.data();
13538
+ }
13539
+ /**
13540
+ * Gets blocking events for a specific entity
13541
+ * @param entityType - Type of entity (practitioner or clinic)
13542
+ * @param entityId - ID of the entity
13543
+ * @param dateRange - Optional date range filter
13544
+ * @param eventType - Optional event type filter
13545
+ * @returns Array of calendar events
13546
+ */
13547
+ async getEntityBlockingEvents(entityType, entityId, dateRange, eventType) {
13548
+ const searchParams = {
13549
+ searchLocation: entityType === "practitioner" ? "practitioner" /* PRACTITIONER */ : "clinic" /* CLINIC */,
13550
+ entityId,
13551
+ dateRange,
13552
+ eventType
13553
+ };
13554
+ if (!eventType) {
13555
+ const allEvents = await searchCalendarEventsUtil(this.db, searchParams);
13556
+ return allEvents.filter(
13557
+ (event) => event.eventType === "blocking" /* BLOCKING */ || event.eventType === "break" /* BREAK */ || event.eventType === "free_day" /* FREE_DAY */ || event.eventType === "other" /* OTHER */
13558
+ );
13559
+ }
13560
+ return searchCalendarEventsUtil(this.db, searchParams);
13561
+ }
13562
+ // #endregion
13563
+ // #region Calendar Event Search
13564
+ /**
13565
+ * Searches for calendar events based on specified criteria.
13566
+ * This method supports searching for ALL event types (appointments, blocking events, etc.)
13567
+ *
13568
+ * @param params - The search parameters
13569
+ * @returns A promise that resolves to an array of matching calendar events
13570
+ */
13571
+ async searchCalendarEvents(params) {
13572
+ return searchCalendarEventsUtil(this.db, params);
13573
+ }
13574
+ // #endregion
13575
+ // #region Private Helper Methods
13576
+ /**
13577
+ * Gets the calendar collection path for a specific entity
13578
+ * @param entityType - Type of entity (practitioner or clinic)
13579
+ * @param entityId - ID of the entity
13580
+ * @returns Collection path string
13581
+ */
13582
+ getEntityCalendarPath(entityType, entityId) {
13583
+ if (entityType === "practitioner") {
13584
+ return `${PRACTITIONERS_COLLECTION}/${entityId}/${CALENDAR_COLLECTION}`;
13585
+ } else {
13586
+ return `${CLINICS_COLLECTION}/${entityId}/${CALENDAR_COLLECTION}`;
13587
+ }
13588
+ }
13589
+ /**
13590
+ * Validates blocking event creation parameters
13591
+ * @param params - Parameters to validate
13592
+ * @throws Error if validation fails
13593
+ */
13594
+ validateBlockingEventParams(params) {
13595
+ if (!params.entityType || !params.entityId) {
13596
+ throw new Error("Entity type and ID are required");
13597
+ }
13598
+ if (!params.eventName || params.eventName.trim() === "") {
13599
+ throw new Error("Event name is required");
13600
+ }
13601
+ if (!params.eventTime || !params.eventTime.start || !params.eventTime.end) {
13602
+ throw new Error("Event time with start and end is required");
13603
+ }
13604
+ if (params.eventTime.end.toMillis() <= params.eventTime.start.toMillis()) {
13605
+ throw new Error("Event end time must be after start time");
13606
+ }
13607
+ const validTypes = [
13608
+ "blocking" /* BLOCKING */,
13609
+ "break" /* BREAK */,
13610
+ "free_day" /* FREE_DAY */,
13611
+ "other" /* OTHER */
13612
+ ];
13613
+ if (!validTypes.includes(params.eventType)) {
13614
+ throw new Error("Invalid event type for blocking events");
13615
+ }
13616
+ }
13617
+ // #endregion
13618
+ };
13619
+
13167
13620
  // src/services/reviews/reviews.service.ts
13168
13621
  import {
13169
13622
  collection as collection26,
13170
- doc as doc27,
13171
- getDoc as getDoc29,
13623
+ doc as doc28,
13624
+ getDoc as getDoc30,
13172
13625
  getDocs as getDocs26,
13173
13626
  query as query26,
13174
13627
  where as where26,
13175
- setDoc as setDoc24,
13176
- deleteDoc as deleteDoc17,
13177
- serverTimestamp as serverTimestamp23
13628
+ setDoc as setDoc25,
13629
+ deleteDoc as deleteDoc18,
13630
+ serverTimestamp as serverTimestamp24
13178
13631
  } from "firebase/firestore";
13179
13632
 
13180
13633
  // src/types/reviews/index.ts
@@ -13260,11 +13713,11 @@ var ReviewService = class extends BaseService {
13260
13713
  updatedAt: now
13261
13714
  };
13262
13715
  reviewSchema.parse(review);
13263
- const docRef = doc27(this.db, REVIEWS_COLLECTION, reviewId);
13264
- await setDoc24(docRef, {
13716
+ const docRef = doc28(this.db, REVIEWS_COLLECTION, reviewId);
13717
+ await setDoc25(docRef, {
13265
13718
  ...review,
13266
- createdAt: serverTimestamp23(),
13267
- updatedAt: serverTimestamp23()
13719
+ createdAt: serverTimestamp24(),
13720
+ updatedAt: serverTimestamp24()
13268
13721
  });
13269
13722
  return review;
13270
13723
  } catch (error) {
@@ -13280,8 +13733,8 @@ var ReviewService = class extends BaseService {
13280
13733
  * @returns The review if found, null otherwise
13281
13734
  */
13282
13735
  async getReview(reviewId) {
13283
- const docRef = doc27(this.db, REVIEWS_COLLECTION, reviewId);
13284
- const docSnap = await getDoc29(docRef);
13736
+ const docRef = doc28(this.db, REVIEWS_COLLECTION, reviewId);
13737
+ const docSnap = await getDoc30(docRef);
13285
13738
  if (!docSnap.exists()) {
13286
13739
  return null;
13287
13740
  }
@@ -13298,7 +13751,7 @@ var ReviewService = class extends BaseService {
13298
13751
  where26("patientId", "==", patientId)
13299
13752
  );
13300
13753
  const snapshot = await getDocs26(q);
13301
- return snapshot.docs.map((doc35) => doc35.data());
13754
+ return snapshot.docs.map((doc36) => doc36.data());
13302
13755
  }
13303
13756
  /**
13304
13757
  * Gets all reviews for a specific clinic
@@ -13311,7 +13764,7 @@ var ReviewService = class extends BaseService {
13311
13764
  where26("clinicReview.clinicId", "==", clinicId)
13312
13765
  );
13313
13766
  const snapshot = await getDocs26(q);
13314
- return snapshot.docs.map((doc35) => doc35.data());
13767
+ return snapshot.docs.map((doc36) => doc36.data());
13315
13768
  }
13316
13769
  /**
13317
13770
  * Gets all reviews for a specific practitioner
@@ -13324,7 +13777,7 @@ var ReviewService = class extends BaseService {
13324
13777
  where26("practitionerReview.practitionerId", "==", practitionerId)
13325
13778
  );
13326
13779
  const snapshot = await getDocs26(q);
13327
- return snapshot.docs.map((doc35) => doc35.data());
13780
+ return snapshot.docs.map((doc36) => doc36.data());
13328
13781
  }
13329
13782
  /**
13330
13783
  * Gets all reviews for a specific procedure
@@ -13337,7 +13790,7 @@ var ReviewService = class extends BaseService {
13337
13790
  where26("procedureReview.procedureId", "==", procedureId)
13338
13791
  );
13339
13792
  const snapshot = await getDocs26(q);
13340
- return snapshot.docs.map((doc35) => doc35.data());
13793
+ return snapshot.docs.map((doc36) => doc36.data());
13341
13794
  }
13342
13795
  /**
13343
13796
  * Gets all reviews for a specific appointment
@@ -13364,7 +13817,7 @@ var ReviewService = class extends BaseService {
13364
13817
  if (!review) {
13365
13818
  throw new Error(`Review with ID ${reviewId} not found`);
13366
13819
  }
13367
- await deleteDoc17(doc27(this.db, REVIEWS_COLLECTION, reviewId));
13820
+ await deleteDoc18(doc28(this.db, REVIEWS_COLLECTION, reviewId));
13368
13821
  }
13369
13822
  /**
13370
13823
  * Calculates the average of an array of numbers
@@ -13383,8 +13836,8 @@ var ReviewService = class extends BaseService {
13383
13836
 
13384
13837
  // src/services/appointment/appointment.service.ts
13385
13838
  import {
13386
- Timestamp as Timestamp30,
13387
- serverTimestamp as serverTimestamp25,
13839
+ Timestamp as Timestamp31,
13840
+ serverTimestamp as serverTimestamp26,
13388
13841
  arrayUnion as arrayUnion8,
13389
13842
  arrayRemove as arrayRemove7,
13390
13843
  where as where28,
@@ -13400,15 +13853,15 @@ import { getFunctions as getFunctions2 } from "firebase/functions";
13400
13853
  // src/services/appointment/utils/appointment.utils.ts
13401
13854
  import {
13402
13855
  collection as collection27,
13403
- doc as doc28,
13404
- getDoc as getDoc30,
13856
+ doc as doc29,
13857
+ getDoc as getDoc31,
13405
13858
  getDocs as getDocs27,
13406
13859
  query as query27,
13407
13860
  where as where27,
13408
- setDoc as setDoc25,
13409
- updateDoc as updateDoc26,
13410
- serverTimestamp as serverTimestamp24,
13411
- Timestamp as Timestamp29,
13861
+ setDoc as setDoc26,
13862
+ updateDoc as updateDoc27,
13863
+ serverTimestamp as serverTimestamp25,
13864
+ Timestamp as Timestamp30,
13412
13865
  orderBy as orderBy14,
13413
13866
  limit as limit12,
13414
13867
  startAfter as startAfter10
@@ -13420,8 +13873,8 @@ var TECHNOLOGIES_COLLECTION = "technologies";
13420
13873
  // src/services/appointment/utils/appointment.utils.ts
13421
13874
  async function updateAppointmentUtil2(db, appointmentId, data) {
13422
13875
  try {
13423
- const appointmentRef = doc28(db, APPOINTMENTS_COLLECTION, appointmentId);
13424
- const appointmentDoc = await getDoc30(appointmentRef);
13876
+ const appointmentRef = doc29(db, APPOINTMENTS_COLLECTION, appointmentId);
13877
+ const appointmentDoc = await getDoc31(appointmentRef);
13425
13878
  if (!appointmentDoc.exists()) {
13426
13879
  throw new Error(`Appointment with ID ${appointmentId} not found`);
13427
13880
  }
@@ -13470,7 +13923,7 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
13470
13923
  ...data,
13471
13924
  completedPreRequirements,
13472
13925
  completedPostRequirements,
13473
- updatedAt: serverTimestamp24()
13926
+ updatedAt: serverTimestamp25()
13474
13927
  };
13475
13928
  Object.keys(updateData).forEach((key) => {
13476
13929
  if (updateData[key] === void 0) {
@@ -13479,7 +13932,7 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
13479
13932
  });
13480
13933
  if (data.status && data.status !== currentAppointment.status) {
13481
13934
  if (data.status === "confirmed" /* CONFIRMED */ && !updateData.confirmationTime) {
13482
- updateData.confirmationTime = Timestamp29.now();
13935
+ updateData.confirmationTime = Timestamp30.now();
13483
13936
  }
13484
13937
  if (currentAppointment.calendarEventId) {
13485
13938
  await updateCalendarEventStatus(
@@ -13489,8 +13942,8 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
13489
13942
  );
13490
13943
  }
13491
13944
  }
13492
- await updateDoc26(appointmentRef, updateData);
13493
- const updatedAppointmentDoc = await getDoc30(appointmentRef);
13945
+ await updateDoc27(appointmentRef, updateData);
13946
+ const updatedAppointmentDoc = await getDoc31(appointmentRef);
13494
13947
  if (!updatedAppointmentDoc.exists()) {
13495
13948
  throw new Error(
13496
13949
  `Failed to retrieve updated appointment ${appointmentId}`
@@ -13504,8 +13957,8 @@ async function updateAppointmentUtil2(db, appointmentId, data) {
13504
13957
  }
13505
13958
  async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus) {
13506
13959
  try {
13507
- const calendarEventRef = doc28(db, CALENDAR_COLLECTION, calendarEventId);
13508
- const calendarEventDoc = await getDoc30(calendarEventRef);
13960
+ const calendarEventRef = doc29(db, CALENDAR_COLLECTION, calendarEventId);
13961
+ const calendarEventDoc = await getDoc31(calendarEventRef);
13509
13962
  if (!calendarEventDoc.exists()) {
13510
13963
  console.warn(`Calendar event with ID ${calendarEventId} not found`);
13511
13964
  return;
@@ -13528,9 +13981,9 @@ async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus)
13528
13981
  default:
13529
13982
  return;
13530
13983
  }
13531
- await updateDoc26(calendarEventRef, {
13984
+ await updateDoc27(calendarEventRef, {
13532
13985
  status: calendarStatus,
13533
- updatedAt: serverTimestamp24()
13986
+ updatedAt: serverTimestamp25()
13534
13987
  });
13535
13988
  } catch (error) {
13536
13989
  console.error(`Error updating calendar event ${calendarEventId}:`, error);
@@ -13538,8 +13991,8 @@ async function updateCalendarEventStatus(db, calendarEventId, appointmentStatus)
13538
13991
  }
13539
13992
  async function getAppointmentByIdUtil(db, appointmentId) {
13540
13993
  try {
13541
- const appointmentDoc = await getDoc30(
13542
- doc28(db, APPOINTMENTS_COLLECTION, appointmentId)
13994
+ const appointmentDoc = await getDoc31(
13995
+ doc29(db, APPOINTMENTS_COLLECTION, appointmentId)
13543
13996
  );
13544
13997
  if (!appointmentDoc.exists()) {
13545
13998
  return null;
@@ -13567,13 +14020,13 @@ async function searchAppointmentsUtil(db, params) {
13567
14020
  where27(
13568
14021
  "appointmentStartTime",
13569
14022
  ">=",
13570
- Timestamp29.fromDate(params.startDate)
14023
+ Timestamp30.fromDate(params.startDate)
13571
14024
  )
13572
14025
  );
13573
14026
  }
13574
14027
  if (params.endDate) {
13575
14028
  constraints.push(
13576
- where27("appointmentStartTime", "<=", Timestamp29.fromDate(params.endDate))
14029
+ where27("appointmentStartTime", "<=", Timestamp30.fromDate(params.endDate))
13577
14030
  );
13578
14031
  }
13579
14032
  if (params.status) {
@@ -13593,7 +14046,7 @@ async function searchAppointmentsUtil(db, params) {
13593
14046
  const q = query27(collection27(db, APPOINTMENTS_COLLECTION), ...constraints);
13594
14047
  const querySnapshot = await getDocs27(q);
13595
14048
  const appointments = querySnapshot.docs.map(
13596
- (doc35) => doc35.data()
14049
+ (doc36) => doc36.data()
13597
14050
  );
13598
14051
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
13599
14052
  return { appointments, lastDoc };
@@ -13962,7 +14415,7 @@ var AppointmentService = class extends BaseService {
13962
14415
  );
13963
14416
  const updateData = {
13964
14417
  status: newStatus,
13965
- updatedAt: serverTimestamp25()
14418
+ updatedAt: serverTimestamp26()
13966
14419
  };
13967
14420
  if (newStatus === "canceled_clinic" /* CANCELED_CLINIC */ || newStatus === "canceled_patient" /* CANCELED_PATIENT */ || newStatus === "canceled_patient_rescheduled" /* CANCELED_PATIENT_RESCHEDULED */) {
13968
14421
  if (!(details == null ? void 0 : details.cancellationReason)) {
@@ -13973,13 +14426,13 @@ var AppointmentService = class extends BaseService {
13973
14426
  }
13974
14427
  updateData.cancellationReason = details.cancellationReason;
13975
14428
  updateData.canceledBy = details.canceledBy;
13976
- updateData.cancellationTime = Timestamp30.now();
14429
+ updateData.cancellationTime = Timestamp31.now();
13977
14430
  }
13978
14431
  if (newStatus === "confirmed" /* CONFIRMED */) {
13979
- updateData.confirmationTime = Timestamp30.now();
14432
+ updateData.confirmationTime = Timestamp31.now();
13980
14433
  }
13981
14434
  if (newStatus === "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */) {
13982
- updateData.rescheduleTime = Timestamp30.now();
14435
+ updateData.rescheduleTime = Timestamp31.now();
13983
14436
  }
13984
14437
  return this.updateAppointment(appointmentId, updateData);
13985
14438
  }
@@ -14057,9 +14510,9 @@ var AppointmentService = class extends BaseService {
14057
14510
  status: "rescheduled_by_clinic" /* RESCHEDULED_BY_CLINIC */,
14058
14511
  appointmentStartTime: startTimestamp,
14059
14512
  appointmentEndTime: endTimestamp,
14060
- rescheduleTime: Timestamp30.now(),
14513
+ rescheduleTime: Timestamp31.now(),
14061
14514
  confirmationTime: null,
14062
- updatedAt: serverTimestamp25()
14515
+ updatedAt: serverTimestamp26()
14063
14516
  };
14064
14517
  return this.updateAppointment(validatedParams.appointmentId, updateData);
14065
14518
  }
@@ -14077,19 +14530,19 @@ var AppointmentService = class extends BaseService {
14077
14530
  return value;
14078
14531
  }
14079
14532
  if (typeof value === "number") {
14080
- return Timestamp30.fromMillis(value);
14533
+ return Timestamp31.fromMillis(value);
14081
14534
  }
14082
14535
  if (typeof value === "string") {
14083
- return Timestamp30.fromDate(new Date(value));
14536
+ return Timestamp31.fromDate(new Date(value));
14084
14537
  }
14085
14538
  if (value instanceof Date) {
14086
- return Timestamp30.fromDate(value);
14539
+ return Timestamp31.fromDate(value);
14087
14540
  }
14088
14541
  if (value && typeof value._seconds === "number") {
14089
- return new Timestamp30(value._seconds, value._nanoseconds || 0);
14542
+ return new Timestamp31(value._seconds, value._nanoseconds || 0);
14090
14543
  }
14091
14544
  if (value && typeof value.seconds === "number") {
14092
- return new Timestamp30(value.seconds, value.nanoseconds || 0);
14545
+ return new Timestamp31(value.seconds, value.nanoseconds || 0);
14093
14546
  }
14094
14547
  throw new Error(
14095
14548
  `Invalid timestamp format: ${typeof value}, value: ${JSON.stringify(
@@ -14188,9 +14641,9 @@ var AppointmentService = class extends BaseService {
14188
14641
  }
14189
14642
  const updateData = {
14190
14643
  status: "in_progress" /* IN_PROGRESS */,
14191
- procedureActualStartTime: Timestamp30.now(),
14644
+ procedureActualStartTime: Timestamp31.now(),
14192
14645
  // Set actual start time
14193
- updatedAt: serverTimestamp25()
14646
+ updatedAt: serverTimestamp26()
14194
14647
  };
14195
14648
  return this.updateAppointment(appointmentId, updateData);
14196
14649
  }
@@ -14208,7 +14661,7 @@ var AppointmentService = class extends BaseService {
14208
14661
  if (!appointment)
14209
14662
  throw new Error(`Appointment ${appointmentId} not found.`);
14210
14663
  let calculatedDurationMinutes = actualDurationMinutesInput;
14211
- const procedureCompletionTime = Timestamp30.now();
14664
+ const procedureCompletionTime = Timestamp31.now();
14212
14665
  if (calculatedDurationMinutes === void 0 && appointment.procedureActualStartTime) {
14213
14666
  const startTimeMillis = appointment.procedureActualStartTime.toMillis();
14214
14667
  const endTimeMillis = procedureCompletionTime.toMillis();
@@ -14231,7 +14684,7 @@ var AppointmentService = class extends BaseService {
14231
14684
  },
14232
14685
  // Optionally update appointmentEndTime to the actual completion time
14233
14686
  // appointmentEndTime: procedureCompletionTime,
14234
- updatedAt: serverTimestamp25()
14687
+ updatedAt: serverTimestamp26()
14235
14688
  };
14236
14689
  return this.updateAppointment(appointmentId, updateData);
14237
14690
  }
@@ -14245,7 +14698,7 @@ var AppointmentService = class extends BaseService {
14245
14698
  const appointment = await this.getAppointmentById(appointmentId);
14246
14699
  if (!appointment)
14247
14700
  throw new Error(`Appointment ${appointmentId} not found.`);
14248
- if (Timestamp30.now().toMillis() < appointment.appointmentStartTime.toMillis()) {
14701
+ if (Timestamp31.now().toMillis() < appointment.appointmentStartTime.toMillis()) {
14249
14702
  throw new Error("Cannot mark no-show before appointment start time.");
14250
14703
  }
14251
14704
  return this.updateAppointmentStatus(
@@ -14269,12 +14722,12 @@ var AppointmentService = class extends BaseService {
14269
14722
  const newMediaItem = {
14270
14723
  ...mediaItemData,
14271
14724
  id: this.generateId(),
14272
- uploadedAt: Timestamp30.now(),
14725
+ uploadedAt: Timestamp31.now(),
14273
14726
  uploadedBy: currentUser.uid
14274
14727
  };
14275
14728
  const updateData = {
14276
14729
  media: arrayUnion8(newMediaItem),
14277
- updatedAt: serverTimestamp25()
14730
+ updatedAt: serverTimestamp26()
14278
14731
  };
14279
14732
  return this.updateAppointment(appointmentId, updateData);
14280
14733
  }
@@ -14295,7 +14748,7 @@ var AppointmentService = class extends BaseService {
14295
14748
  }
14296
14749
  const updateData = {
14297
14750
  media: arrayRemove7(mediaToRemove),
14298
- updatedAt: serverTimestamp25()
14751
+ updatedAt: serverTimestamp26()
14299
14752
  };
14300
14753
  return this.updateAppointment(appointmentId, updateData);
14301
14754
  }
@@ -14309,11 +14762,11 @@ var AppointmentService = class extends BaseService {
14309
14762
  const newReviewInfo = {
14310
14763
  ...reviewData,
14311
14764
  reviewId: this.generateId(),
14312
- reviewedAt: Timestamp30.now()
14765
+ reviewedAt: Timestamp31.now()
14313
14766
  };
14314
14767
  const updateData = {
14315
14768
  reviewInfo: newReviewInfo,
14316
- updatedAt: serverTimestamp25()
14769
+ updatedAt: serverTimestamp26()
14317
14770
  };
14318
14771
  return this.updateAppointment(appointmentId, updateData);
14319
14772
  }
@@ -14327,7 +14780,7 @@ var AppointmentService = class extends BaseService {
14327
14780
  const updateData = {
14328
14781
  paymentStatus,
14329
14782
  paymentTransactionId: paymentTransactionId || null,
14330
- updatedAt: serverTimestamp25()
14783
+ updatedAt: serverTimestamp26()
14331
14784
  };
14332
14785
  return this.updateAppointment(appointmentId, updateData);
14333
14786
  }
@@ -14375,7 +14828,7 @@ var AppointmentService = class extends BaseService {
14375
14828
  where28(
14376
14829
  "appointmentStartTime",
14377
14830
  ">=",
14378
- Timestamp30.fromDate(effectiveStartDate)
14831
+ Timestamp31.fromDate(effectiveStartDate)
14379
14832
  )
14380
14833
  );
14381
14834
  if (options == null ? void 0 : options.endDate) {
@@ -14383,7 +14836,7 @@ var AppointmentService = class extends BaseService {
14383
14836
  where28(
14384
14837
  "appointmentStartTime",
14385
14838
  "<=",
14386
- Timestamp30.fromDate(options.endDate)
14839
+ Timestamp31.fromDate(options.endDate)
14387
14840
  )
14388
14841
  );
14389
14842
  }
@@ -14400,7 +14853,7 @@ var AppointmentService = class extends BaseService {
14400
14853
  );
14401
14854
  const querySnapshot = await getDocs28(q);
14402
14855
  const appointments = querySnapshot.docs.map(
14403
- (doc35) => doc35.data()
14856
+ (doc36) => doc36.data()
14404
14857
  );
14405
14858
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
14406
14859
  console.log(
@@ -14449,7 +14902,7 @@ var AppointmentService = class extends BaseService {
14449
14902
  where28(
14450
14903
  "appointmentStartTime",
14451
14904
  ">=",
14452
- Timestamp30.fromDate(options.startDate)
14905
+ Timestamp31.fromDate(options.startDate)
14453
14906
  )
14454
14907
  );
14455
14908
  }
@@ -14457,7 +14910,7 @@ var AppointmentService = class extends BaseService {
14457
14910
  where28(
14458
14911
  "appointmentStartTime",
14459
14912
  "<=",
14460
- Timestamp30.fromDate(effectiveEndDate)
14913
+ Timestamp31.fromDate(effectiveEndDate)
14461
14914
  )
14462
14915
  );
14463
14916
  constraints.push(orderBy15("appointmentStartTime", "desc"));
@@ -14473,7 +14926,7 @@ var AppointmentService = class extends BaseService {
14473
14926
  );
14474
14927
  const querySnapshot = await getDocs28(q);
14475
14928
  const appointments = querySnapshot.docs.map(
14476
- (doc35) => doc35.data()
14929
+ (doc36) => doc36.data()
14477
14930
  );
14478
14931
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
14479
14932
  console.log(
@@ -14496,13 +14949,13 @@ import {
14496
14949
  getDocs as getDocs29,
14497
14950
  query as query29,
14498
14951
  where as where29,
14499
- doc as doc29,
14500
- updateDoc as updateDoc27,
14501
- Timestamp as Timestamp31,
14952
+ doc as doc30,
14953
+ updateDoc as updateDoc28,
14954
+ Timestamp as Timestamp32,
14502
14955
  orderBy as orderBy16,
14503
14956
  limit as limit14,
14504
14957
  startAfter as startAfter12,
14505
- getDoc as getDoc31
14958
+ getDoc as getDoc32
14506
14959
  } from "firebase/firestore";
14507
14960
 
14508
14961
  // src/types/patient/patient-requirements.ts
@@ -14539,7 +14992,7 @@ var PatientRequirementsService = class extends BaseService {
14539
14992
  );
14540
14993
  }
14541
14994
  getPatientRequirementDocRef(patientId, instanceId) {
14542
- return doc29(
14995
+ return doc30(
14543
14996
  this.getPatientRequirementsCollectionRef(patientId),
14544
14997
  instanceId
14545
14998
  );
@@ -14552,7 +15005,7 @@ var PatientRequirementsService = class extends BaseService {
14552
15005
  */
14553
15006
  async getPatientRequirementInstance(patientId, instanceId) {
14554
15007
  const docRef = this.getPatientRequirementDocRef(patientId, instanceId);
14555
- const docSnap = await getDoc31(docRef);
15008
+ const docSnap = await getDoc32(docRef);
14556
15009
  if (!docSnap.exists()) {
14557
15010
  return null;
14558
15011
  }
@@ -14629,7 +15082,7 @@ var PatientRequirementsService = class extends BaseService {
14629
15082
  */
14630
15083
  async completeInstruction(patientId, instanceId, instructionId) {
14631
15084
  const instanceRef = this.getPatientRequirementDocRef(patientId, instanceId);
14632
- const instanceSnap = await getDoc31(instanceRef);
15085
+ const instanceSnap = await getDoc32(instanceRef);
14633
15086
  if (!instanceSnap.exists()) {
14634
15087
  throw new Error(
14635
15088
  `PatientRequirementInstance ${instanceId} not found for patient ${patientId}.`
@@ -14657,7 +15110,7 @@ var PatientRequirementsService = class extends BaseService {
14657
15110
  `Instruction ${instructionId} is in status ${instructionToUpdate.status} and cannot be marked as completed.`
14658
15111
  );
14659
15112
  }
14660
- const now = Timestamp31.now();
15113
+ const now = Timestamp32.now();
14661
15114
  const updatedInstructions = [...instance.instructions];
14662
15115
  updatedInstructions[instructionIndex] = {
14663
15116
  ...instructionToUpdate,
@@ -14684,7 +15137,7 @@ var PatientRequirementsService = class extends BaseService {
14684
15137
  if (newOverallStatus !== instance.overallStatus) {
14685
15138
  updatePayload.overallStatus = newOverallStatus;
14686
15139
  }
14687
- await updateDoc27(instanceRef, updatePayload);
15140
+ await updateDoc28(instanceRef, updatePayload);
14688
15141
  return {
14689
15142
  ...instance,
14690
15143
  instructions: updatedInstructions,
@@ -14700,11 +15153,11 @@ var PatientRequirementsService = class extends BaseService {
14700
15153
  import {
14701
15154
  addDoc as addDoc3,
14702
15155
  collection as collection30,
14703
- doc as doc30,
14704
- getDoc as getDoc32,
15156
+ doc as doc31,
15157
+ getDoc as getDoc33,
14705
15158
  getDocs as getDocs30,
14706
15159
  query as query30,
14707
- updateDoc as updateDoc28,
15160
+ updateDoc as updateDoc29,
14708
15161
  where as where30
14709
15162
  } from "firebase/firestore";
14710
15163
 
@@ -14740,9 +15193,9 @@ var BrandService = class extends BaseService {
14740
15193
  const q = query30(this.getBrandsRef(), where30("isActive", "==", true));
14741
15194
  const snapshot = await getDocs30(q);
14742
15195
  return snapshot.docs.map(
14743
- (doc35) => ({
14744
- id: doc35.id,
14745
- ...doc35.data()
15196
+ (doc36) => ({
15197
+ id: doc36.id,
15198
+ ...doc36.data()
14746
15199
  })
14747
15200
  );
14748
15201
  }
@@ -14754,8 +15207,8 @@ var BrandService = class extends BaseService {
14754
15207
  ...brand,
14755
15208
  updatedAt: /* @__PURE__ */ new Date()
14756
15209
  };
14757
- const docRef = doc30(this.getBrandsRef(), brandId);
14758
- await updateDoc28(docRef, updateData);
15210
+ const docRef = doc31(this.getBrandsRef(), brandId);
15211
+ await updateDoc29(docRef, updateData);
14759
15212
  return this.getById(brandId);
14760
15213
  }
14761
15214
  /**
@@ -14770,8 +15223,8 @@ var BrandService = class extends BaseService {
14770
15223
  * Gets a brand by ID
14771
15224
  */
14772
15225
  async getById(brandId) {
14773
- const docRef = doc30(this.getBrandsRef(), brandId);
14774
- const docSnap = await getDoc32(docRef);
15226
+ const docRef = doc31(this.getBrandsRef(), brandId);
15227
+ const docSnap = await getDoc33(docRef);
14775
15228
  if (!docSnap.exists()) return null;
14776
15229
  return {
14777
15230
  id: docSnap.id,
@@ -14784,11 +15237,11 @@ var BrandService = class extends BaseService {
14784
15237
  import {
14785
15238
  addDoc as addDoc4,
14786
15239
  collection as collection31,
14787
- doc as doc31,
14788
- getDoc as getDoc33,
15240
+ doc as doc32,
15241
+ getDoc as getDoc34,
14789
15242
  getDocs as getDocs31,
14790
15243
  query as query31,
14791
- updateDoc as updateDoc29,
15244
+ updateDoc as updateDoc30,
14792
15245
  where as where31
14793
15246
  } from "firebase/firestore";
14794
15247
 
@@ -14827,9 +15280,9 @@ var CategoryService = class extends BaseService {
14827
15280
  const q = query31(this.categoriesRef, where31("isActive", "==", true));
14828
15281
  const snapshot = await getDocs31(q);
14829
15282
  return snapshot.docs.map(
14830
- (doc35) => ({
14831
- id: doc35.id,
14832
- ...doc35.data()
15283
+ (doc36) => ({
15284
+ id: doc36.id,
15285
+ ...doc36.data()
14833
15286
  })
14834
15287
  );
14835
15288
  }
@@ -14846,9 +15299,9 @@ var CategoryService = class extends BaseService {
14846
15299
  );
14847
15300
  const snapshot = await getDocs31(q);
14848
15301
  return snapshot.docs.map(
14849
- (doc35) => ({
14850
- id: doc35.id,
14851
- ...doc35.data()
15302
+ (doc36) => ({
15303
+ id: doc36.id,
15304
+ ...doc36.data()
14852
15305
  })
14853
15306
  );
14854
15307
  }
@@ -14863,8 +15316,8 @@ var CategoryService = class extends BaseService {
14863
15316
  ...category,
14864
15317
  updatedAt: /* @__PURE__ */ new Date()
14865
15318
  };
14866
- const docRef = doc31(this.categoriesRef, id);
14867
- await updateDoc29(docRef, updateData);
15319
+ const docRef = doc32(this.categoriesRef, id);
15320
+ await updateDoc30(docRef, updateData);
14868
15321
  return this.getById(id);
14869
15322
  }
14870
15323
  /**
@@ -14880,8 +15333,8 @@ var CategoryService = class extends BaseService {
14880
15333
  * @returns Kategorija ili null ako ne postoji
14881
15334
  */
14882
15335
  async getById(id) {
14883
- const docRef = doc31(this.categoriesRef, id);
14884
- const docSnap = await getDoc33(docRef);
15336
+ const docRef = doc32(this.categoriesRef, id);
15337
+ const docSnap = await getDoc34(docRef);
14885
15338
  if (!docSnap.exists()) return null;
14886
15339
  return {
14887
15340
  id: docSnap.id,
@@ -14894,11 +15347,11 @@ var CategoryService = class extends BaseService {
14894
15347
  import {
14895
15348
  addDoc as addDoc5,
14896
15349
  collection as collection32,
14897
- doc as doc32,
14898
- getDoc as getDoc34,
15350
+ doc as doc33,
15351
+ getDoc as getDoc35,
14899
15352
  getDocs as getDocs32,
14900
15353
  query as query32,
14901
- updateDoc as updateDoc30,
15354
+ updateDoc as updateDoc31,
14902
15355
  where as where32
14903
15356
  } from "firebase/firestore";
14904
15357
 
@@ -14952,9 +15405,9 @@ var SubcategoryService = class extends BaseService {
14952
15405
  );
14953
15406
  const snapshot = await getDocs32(q);
14954
15407
  return snapshot.docs.map(
14955
- (doc35) => ({
14956
- id: doc35.id,
14957
- ...doc35.data()
15408
+ (doc36) => ({
15409
+ id: doc36.id,
15410
+ ...doc36.data()
14958
15411
  })
14959
15412
  );
14960
15413
  }
@@ -14970,8 +15423,8 @@ var SubcategoryService = class extends BaseService {
14970
15423
  ...subcategory,
14971
15424
  updatedAt: /* @__PURE__ */ new Date()
14972
15425
  };
14973
- const docRef = doc32(this.getSubcategoriesRef(categoryId), subcategoryId);
14974
- await updateDoc30(docRef, updateData);
15426
+ const docRef = doc33(this.getSubcategoriesRef(categoryId), subcategoryId);
15427
+ await updateDoc31(docRef, updateData);
14975
15428
  return this.getById(categoryId, subcategoryId);
14976
15429
  }
14977
15430
  /**
@@ -14989,8 +15442,8 @@ var SubcategoryService = class extends BaseService {
14989
15442
  * @returns Podkategorija ili null ako ne postoji
14990
15443
  */
14991
15444
  async getById(categoryId, subcategoryId) {
14992
- const docRef = doc32(this.getSubcategoriesRef(categoryId), subcategoryId);
14993
- const docSnap = await getDoc34(docRef);
15445
+ const docRef = doc33(this.getSubcategoriesRef(categoryId), subcategoryId);
15446
+ const docSnap = await getDoc35(docRef);
14994
15447
  if (!docSnap.exists()) return null;
14995
15448
  return {
14996
15449
  id: docSnap.id,
@@ -15003,11 +15456,11 @@ var SubcategoryService = class extends BaseService {
15003
15456
  import {
15004
15457
  addDoc as addDoc6,
15005
15458
  collection as collection33,
15006
- doc as doc33,
15007
- getDoc as getDoc35,
15459
+ doc as doc34,
15460
+ getDoc as getDoc36,
15008
15461
  getDocs as getDocs33,
15009
15462
  query as query33,
15010
- updateDoc as updateDoc31,
15463
+ updateDoc as updateDoc32,
15011
15464
  where as where33,
15012
15465
  arrayUnion as arrayUnion9,
15013
15466
  arrayRemove as arrayRemove8
@@ -15055,9 +15508,9 @@ var TechnologyService = class extends BaseService {
15055
15508
  const q = query33(this.getTechnologiesRef(), where33("isActive", "==", true));
15056
15509
  const snapshot = await getDocs33(q);
15057
15510
  return snapshot.docs.map(
15058
- (doc35) => ({
15059
- id: doc35.id,
15060
- ...doc35.data()
15511
+ (doc36) => ({
15512
+ id: doc36.id,
15513
+ ...doc36.data()
15061
15514
  })
15062
15515
  );
15063
15516
  }
@@ -15074,9 +15527,9 @@ var TechnologyService = class extends BaseService {
15074
15527
  );
15075
15528
  const snapshot = await getDocs33(q);
15076
15529
  return snapshot.docs.map(
15077
- (doc35) => ({
15078
- id: doc35.id,
15079
- ...doc35.data()
15530
+ (doc36) => ({
15531
+ id: doc36.id,
15532
+ ...doc36.data()
15080
15533
  })
15081
15534
  );
15082
15535
  }
@@ -15093,9 +15546,9 @@ var TechnologyService = class extends BaseService {
15093
15546
  );
15094
15547
  const snapshot = await getDocs33(q);
15095
15548
  return snapshot.docs.map(
15096
- (doc35) => ({
15097
- id: doc35.id,
15098
- ...doc35.data()
15549
+ (doc36) => ({
15550
+ id: doc36.id,
15551
+ ...doc36.data()
15099
15552
  })
15100
15553
  );
15101
15554
  }
@@ -15112,9 +15565,9 @@ var TechnologyService = class extends BaseService {
15112
15565
  );
15113
15566
  const snapshot = await getDocs33(q);
15114
15567
  return snapshot.docs.map(
15115
- (doc35) => ({
15116
- id: doc35.id,
15117
- ...doc35.data()
15568
+ (doc36) => ({
15569
+ id: doc36.id,
15570
+ ...doc36.data()
15118
15571
  })
15119
15572
  );
15120
15573
  }
@@ -15129,8 +15582,8 @@ var TechnologyService = class extends BaseService {
15129
15582
  ...technology,
15130
15583
  updatedAt: /* @__PURE__ */ new Date()
15131
15584
  };
15132
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15133
- await updateDoc31(docRef, updateData);
15585
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15586
+ await updateDoc32(docRef, updateData);
15134
15587
  return this.getById(technologyId);
15135
15588
  }
15136
15589
  /**
@@ -15148,8 +15601,8 @@ var TechnologyService = class extends BaseService {
15148
15601
  * @returns Tehnologija ili null ako ne postoji
15149
15602
  */
15150
15603
  async getById(technologyId) {
15151
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15152
- const docSnap = await getDoc35(docRef);
15604
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15605
+ const docSnap = await getDoc36(docRef);
15153
15606
  if (!docSnap.exists()) return null;
15154
15607
  return {
15155
15608
  id: docSnap.id,
@@ -15163,9 +15616,9 @@ var TechnologyService = class extends BaseService {
15163
15616
  * @returns Ažurirana tehnologija sa novim zahtevom
15164
15617
  */
15165
15618
  async addRequirement(technologyId, requirement) {
15166
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15619
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15167
15620
  const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
15168
- await updateDoc31(docRef, {
15621
+ await updateDoc32(docRef, {
15169
15622
  [requirementType]: arrayUnion9(requirement),
15170
15623
  updatedAt: /* @__PURE__ */ new Date()
15171
15624
  });
@@ -15178,9 +15631,9 @@ var TechnologyService = class extends BaseService {
15178
15631
  * @returns Ažurirana tehnologija bez uklonjenog zahteva
15179
15632
  */
15180
15633
  async removeRequirement(technologyId, requirement) {
15181
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15634
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15182
15635
  const requirementType = requirement.type === "pre" ? "requirements.pre" : "requirements.post";
15183
- await updateDoc31(docRef, {
15636
+ await updateDoc32(docRef, {
15184
15637
  [requirementType]: arrayRemove8(requirement),
15185
15638
  updatedAt: /* @__PURE__ */ new Date()
15186
15639
  });
@@ -15218,8 +15671,8 @@ var TechnologyService = class extends BaseService {
15218
15671
  * @returns Ažurirana tehnologija
15219
15672
  */
15220
15673
  async addBlockingCondition(technologyId, condition) {
15221
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15222
- await updateDoc31(docRef, {
15674
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15675
+ await updateDoc32(docRef, {
15223
15676
  blockingConditions: arrayUnion9(condition),
15224
15677
  updatedAt: /* @__PURE__ */ new Date()
15225
15678
  });
@@ -15232,8 +15685,8 @@ var TechnologyService = class extends BaseService {
15232
15685
  * @returns Ažurirana tehnologija
15233
15686
  */
15234
15687
  async removeBlockingCondition(technologyId, condition) {
15235
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15236
- await updateDoc31(docRef, {
15688
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15689
+ await updateDoc32(docRef, {
15237
15690
  blockingConditions: arrayRemove8(condition),
15238
15691
  updatedAt: /* @__PURE__ */ new Date()
15239
15692
  });
@@ -15246,8 +15699,8 @@ var TechnologyService = class extends BaseService {
15246
15699
  * @returns Ažurirana tehnologija
15247
15700
  */
15248
15701
  async addContraindication(technologyId, contraindication) {
15249
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15250
- await updateDoc31(docRef, {
15702
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15703
+ await updateDoc32(docRef, {
15251
15704
  contraindications: arrayUnion9(contraindication),
15252
15705
  updatedAt: /* @__PURE__ */ new Date()
15253
15706
  });
@@ -15260,8 +15713,8 @@ var TechnologyService = class extends BaseService {
15260
15713
  * @returns Ažurirana tehnologija
15261
15714
  */
15262
15715
  async removeContraindication(technologyId, contraindication) {
15263
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15264
- await updateDoc31(docRef, {
15716
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15717
+ await updateDoc32(docRef, {
15265
15718
  contraindications: arrayRemove8(contraindication),
15266
15719
  updatedAt: /* @__PURE__ */ new Date()
15267
15720
  });
@@ -15274,8 +15727,8 @@ var TechnologyService = class extends BaseService {
15274
15727
  * @returns Ažurirana tehnologija
15275
15728
  */
15276
15729
  async addBenefit(technologyId, benefit) {
15277
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15278
- await updateDoc31(docRef, {
15730
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15731
+ await updateDoc32(docRef, {
15279
15732
  benefits: arrayUnion9(benefit),
15280
15733
  updatedAt: /* @__PURE__ */ new Date()
15281
15734
  });
@@ -15288,8 +15741,8 @@ var TechnologyService = class extends BaseService {
15288
15741
  * @returns Ažurirana tehnologija
15289
15742
  */
15290
15743
  async removeBenefit(technologyId, benefit) {
15291
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15292
- await updateDoc31(docRef, {
15744
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15745
+ await updateDoc32(docRef, {
15293
15746
  benefits: arrayRemove8(benefit),
15294
15747
  updatedAt: /* @__PURE__ */ new Date()
15295
15748
  });
@@ -15329,8 +15782,8 @@ var TechnologyService = class extends BaseService {
15329
15782
  * @returns Ažurirana tehnologija
15330
15783
  */
15331
15784
  async updateCertificationRequirement(technologyId, certificationRequirement) {
15332
- const docRef = doc33(this.getTechnologiesRef(), technologyId);
15333
- await updateDoc31(docRef, {
15785
+ const docRef = doc34(this.getTechnologiesRef(), technologyId);
15786
+ await updateDoc32(docRef, {
15334
15787
  certificationRequirement,
15335
15788
  updatedAt: /* @__PURE__ */ new Date()
15336
15789
  });
@@ -15433,11 +15886,11 @@ var TechnologyService = class extends BaseService {
15433
15886
  import {
15434
15887
  addDoc as addDoc7,
15435
15888
  collection as collection34,
15436
- doc as doc34,
15437
- getDoc as getDoc36,
15889
+ doc as doc35,
15890
+ getDoc as getDoc37,
15438
15891
  getDocs as getDocs34,
15439
15892
  query as query34,
15440
- updateDoc as updateDoc32,
15893
+ updateDoc as updateDoc33,
15441
15894
  where as where34
15442
15895
  } from "firebase/firestore";
15443
15896
 
@@ -15488,9 +15941,9 @@ var ProductService = class extends BaseService {
15488
15941
  );
15489
15942
  const snapshot = await getDocs34(q);
15490
15943
  return snapshot.docs.map(
15491
- (doc35) => ({
15492
- id: doc35.id,
15493
- ...doc35.data()
15944
+ (doc36) => ({
15945
+ id: doc36.id,
15946
+ ...doc36.data()
15494
15947
  })
15495
15948
  );
15496
15949
  }
@@ -15510,9 +15963,9 @@ var ProductService = class extends BaseService {
15510
15963
  const snapshot = await getDocs34(q);
15511
15964
  products.push(
15512
15965
  ...snapshot.docs.map(
15513
- (doc35) => ({
15514
- id: doc35.id,
15515
- ...doc35.data()
15966
+ (doc36) => ({
15967
+ id: doc36.id,
15968
+ ...doc36.data()
15516
15969
  })
15517
15970
  )
15518
15971
  );
@@ -15527,8 +15980,8 @@ var ProductService = class extends BaseService {
15527
15980
  ...product,
15528
15981
  updatedAt: /* @__PURE__ */ new Date()
15529
15982
  };
15530
- const docRef = doc34(this.getProductsRef(technologyId), productId);
15531
- await updateDoc32(docRef, updateData);
15983
+ const docRef = doc35(this.getProductsRef(technologyId), productId);
15984
+ await updateDoc33(docRef, updateData);
15532
15985
  return this.getById(technologyId, productId);
15533
15986
  }
15534
15987
  /**
@@ -15543,8 +15996,8 @@ var ProductService = class extends BaseService {
15543
15996
  * Gets a product by ID
15544
15997
  */
15545
15998
  async getById(technologyId, productId) {
15546
- const docRef = doc34(this.getProductsRef(technologyId), productId);
15547
- const docSnap = await getDoc36(docRef);
15999
+ const docRef = doc35(this.getProductsRef(technologyId), productId);
16000
+ const docSnap = await getDoc37(docRef);
15548
16001
  if (!docSnap.exists()) return null;
15549
16002
  return {
15550
16003
  id: docSnap.id,
@@ -15666,6 +16119,7 @@ export {
15666
16119
  CalendarEventStatus,
15667
16120
  CalendarEventType,
15668
16121
  CalendarServiceV2,
16122
+ CalendarServiceV3,
15669
16123
  CalendarSyncStatus,
15670
16124
  CategoryService,
15671
16125
  CertificationLevel,
@@ -15772,6 +16226,7 @@ export {
15772
16226
  contraindicationSchema,
15773
16227
  createAdminTokenSchema,
15774
16228
  createAppointmentSchema,
16229
+ createBlockingEventSchema,
15775
16230
  createCalendarEventSchema,
15776
16231
  createClinicAdminSchema,
15777
16232
  createClinicGroupSchema,
@@ -15842,6 +16297,7 @@ export {
15842
16297
  updateAllergySchema,
15843
16298
  updateAppointmentSchema,
15844
16299
  updateBlockingConditionSchema,
16300
+ updateBlockingEventSchema,
15845
16301
  updateCalendarEventSchema,
15846
16302
  updateClinicAdminSchema,
15847
16303
  updateClinicGroupSchema,