#!/usr/bin/env node
/**
 * Academy Full Deploy Script
 * Run this on production to populate all modules and lessons.
 * 
 * Usage: node src/scripts/deploy_academy.js
 */

const { execSync } = require('child_process');
const path = require('path');

const scriptsDir = __dirname;

// All module scripts in order
const moduleScripts = [
    'create_module3_lessons.js',
    'create_module4_lessons.js',
    'create_modules456_lessons.js',
    'create_module10_lessons.js',
    'create_module11_windows.js',
    'create_module12_logs.js',
    'create_module14_proxies.js',
    'create_modules15_17.js',
    'create_module18.js',
    'create_module19.js',
    'create_module20.js',
    'create_module21.js',
    'create_module22.js',
    'create_module23.js',
    'create_module24.js',
    'create_module25.js',
    'create_module26.js',
    'create_module27.js',
    'create_module28.js',
    'create_module29.js',
    'create_module30.js',
    'create_module31.js',
    'create_module32.js',
    'create_module33.js',
    'create_module34.js',
    'create_module36.js',
    'create_module37.js',
    'create_module38.js',
    'create_module39.js',
    'create_module40.js',
    'create_module41.js',
    'create_module42.js',
    'create_module43.js',
    'create_module44.js',
];

console.log('🎓 Academy Full Deployment Script');
console.log('==================================\n');

let success = 0;
let failed = 0;

for (const script of moduleScripts) {
    const scriptPath = path.join(scriptsDir, script);
    try {
        console.log(`Running: ${script}...`);
        execSync(`node ${scriptPath}`, { stdio: 'inherit', timeout: 60000 });
        success++;
    } catch (error) {
        console.error(`❌ Failed: ${script}`);
        failed++;
    }
}

console.log('\n==================================');
console.log(`✅ Completed: ${success} modules`);
if (failed > 0) console.log(`❌ Failed: ${failed} modules`);
console.log('\nAcademy deployment complete!');
