import { getFirestore, DocumentReference } from "firebase-admin/firestore";
import { readFileSync } from "fs";

// Function to seed Firestore
export const seedFirestore = async (): Promise<void> => {
  console.log("testing");
  const db = getFirestore();
  const rawData = readFileSync(
    "/functions/db_seed/DoctorCategory.json",
    "utf8"
  );
  const data = JSON.parse(rawData);
  for (const item of data) {
    const docRef: DocumentReference = db.collection("DoctorCategory").doc(); // Replace "YourCollectionName" with your desired collection name
    await docRef.set(item);
  }
};

// Invoke the seeding function
// seedFirestore();
