import mongoose from "mongoose";
import "dotenv/config";
import Service from "./models/Service.js";
 
const services = [
    { serviceCode: "SRV001", serviceName: "Engine Repair", servicePrice: 150000 },
    { serviceCode: "SRV002", serviceName: "Transmission Repair", servicePrice: 80000 },
    { serviceCode: "SRV003", serviceName: "Oil Change", servicePrice: 60000 },
    { serviceCode: "SRV004", serviceName: "Chair Replacement", servicePrice: 40000 },
    { serviceCode: "SRV005", serviceName: "Disc Replacement", servicePrice: 400000 },
    { serviceCode: "SRV006", serviceName: "Wheel Alignment", servicePrice: 5000 },
];
 
const seedServices = async () => {
    try {
        await mongoose.connect(process.env.MONGO_URI);
        console.log("Connected to database");
        await Service.deleteMany();
        console.log("Old services cleared");
        await Service.insertMany(services);
        console.log("All 6 services seeded successfully");
        process.exit();
    } catch (error) {
        console.log("Seeding failed:", error.message);
        process.exit(1);
    }
};
 
seedServices();