const fs = require('fs');
console.log("TEST SEUIL")
const generateData = () => {
    let data = [];
    for (let i = 1; i <= 500; i++) {
        data.push({
            "IdSeuil": `SEUIL${i.toString().padStart(3, '0')}`,
            "codeEcole": `ECOLE${Math.ceil(i/50)}`,
            "codeClasse": `CLASSE${(i % 20) + 1}`,
            "MoySeuil": parseFloat((9 + Math.random() * 3).toFixed(1)),
            "nbrMat": 6 + Math.floor(Math.random() * 4),
            "moyPasse": parseFloat((10 + Math.random() * 4).toFixed(1)),
            "moyDecis": parseFloat((9.5 + Math.random() * 3).toFixed(1)),
            "moyRedouble": parseFloat((8 + Math.random() * 3).toFixed(1)),
            "minAnnEval": 4 + Math.floor(Math.random() * 4)
        });
    }
    return data;
};

const fullData = {
    listeElementAjout: generateData(),
    logiUsername: "admin",
    key: "votre_cle_secrete",
    logiPassword: "votre_mot_de_passe"
};

fs.writeFileSync('payload.json', JSON.stringify(fullData, null, 2));
console.log('Fichier payload.json généré avec succès');