 import mongoose from "mongoose";
import Fees from "./models/Fees.js"; // Ensure this matches your exact filename

const schoolFeesData = [
    { name: "School Fees - Term 1", amount: 200000 },
    { name: "School Fees - Term 2", amount: 200000 },
    { name: "School Fees - Term 3", amount: 200000 },
    { name: "Registration Fee", amount: 25000 },
    { name: "Transport Fee", amount: 50000 }
];

const seedAllFees = async () => {
    try {
        // Hardcoded directly so it can never be "undefined"
        await mongoose.connect("mongodb://localhost:27017/seed");
        console.log("Connected to database successfully");
        
        await Fees.deleteMany();
        console.log("Old fee data cleared");
        
        await Fees.insertMany(schoolFeesData);
        console.log("School fees options seeded successfully!");
        process.exit();
    } catch (error) {
        console.log("Seeding failed:", error.message);
        process.exit(1);
    }
};

seedAllFees();
