const pptxgen = require('pptxgenjs');
const path = require('path');
const html2pptx = require('../../.claude/skills/pptx/scripts/html2pptx.js');

async function createPresentation() {
    console.log('🍝 Création présentation Alimentari Piccolo (Design LUXE)...\n');

    const pptx = new pptxgen();
    pptx.layout = 'LAYOUT_16x9';
    pptx.author = 'Alexis - Xiezuo Course';
    pptx.title = 'Alimentari Piccolo - 意大利餐吧评价';
    pptx.subject = '餐厅评价作业';

    try {
        // Slide 1: Title
        console.log('📄 Slide 1: 封面 LUXE...');
        await html2pptx(
            path.join(__dirname, 'slides/slide1_title.html'),
            pptx,
            { tmpDir: path.join(__dirname, '_build') }
        );

        // Slide 2: Location
        console.log('📄 Slide 2: 位置 (hero photo + overlay)...');
        await html2pptx(
            path.join(__dirname, 'slides/slide2_location.html'),
            pptx,
            { tmpDir: path.join(__dirname, '_build') }
        );

        // Slide 3: Piadina
        console.log('📄 Slide 3: Piadina (asymétrique)...');
        await html2pptx(
            path.join(__dirname, 'slides/slide3_piadina.html'),
            pptx,
            { tmpDir: path.join(__dirname, '_build') }
        );

        // Slide 4: Croquettes
        console.log('📄 Slide 4: Croquettes (asymétrique inversé)...');
        await html2pptx(
            path.join(__dirname, 'slides/slide4_croquettes.html'),
            pptx,
            { tmpDir: path.join(__dirname, '_build') }
        );

        // Slide 5: Ambiance
        console.log('📄 Slide 5: Ambiance intérieure + évaluation...');
        await html2pptx(
            path.join(__dirname, 'slides/slide5_ambiance.html'),
            pptx,
            { tmpDir: path.join(__dirname, '_build') }
        );

        // Slide 6: Menu
        console.log('📄 Slide 6: Menu (carte CN uniquement)...');
        await html2pptx(
            path.join(__dirname, 'slides/slide6_menu.html'),
            pptx,
            { tmpDir: path.join(__dirname, '_build') }
        );

        // Slide 7: Credits
        console.log('📄 Slide 7: Crédits (noms membres)...');
        await html2pptx(
            path.join(__dirname, 'slides/slide7_credits.html'),
            pptx,
            { tmpDir: path.join(__dirname, '_build') }
        );

        // Save
        const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, -5);
        const outputFile = `Alimentari_Piccolo_${timestamp}.pptx`;
        await pptx.writeFile({ fileName: path.join(__dirname, outputFile) });

        console.log('\n✅ 演示文稿创建成功！');
        console.log(`📁 文件名: ${outputFile}`);
        console.log('📍 位置: work_chinese/PPT04122025/');
        console.log('\n🎨 Design LUXE & CLASSE :');
        console.log('   ✓ Fond noir #1A1A1A (ultra-premium)');
        console.log('   ✓ Or riche #D4AF37 (signature)');
        console.log('   ✓ Vert forêt #2D5016 + Bordeaux #8B1A1A');
        console.log('   ✓ Barre dorée verticale SIGNATURE');
        console.log('   ✓ Pattern géométrique italien');
        console.log('   ✓ Drapeau diagonal 3 bandes (rotation globale)');
        console.log('   ✓ TOUTES les images utilisées');
        console.log('   ✓ Design asymétrique luxueux');
        console.log('   ✓ Texte 100% chinois/italien (zéro anglais)');
        console.log('   ✓ 7 slides premium');
        console.log('\n📝 Contenu :');
        console.log('   1. Titre LUXE avec pattern géométrique');
        console.log('   2. Hero photo extérieur + overlay info (位置/评分/价格)');
        console.log('   3. Piadina (grande photo gauche, info droite)');
        console.log('   4. Croquettes (inversé : info gauche, photo droite)');
        console.log('   5. Ambiance intérieure (2 photos) + évaluation');
        console.log('   6. Menu (carte CN uniquement, centrée)');
        console.log('   7. Crédits (李知珉、闵智铉、亓昊天)');

    } catch (error) {
        console.error('\n❌ 错误:', error.message);
        if (error.stack) {
            console.error('\nStack:', error.stack);
        }
    }
}

createPresentation();
