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

async function generatePresentation() {
  console.log('🍝 Génération Alimentari Piccolo PowerPoint...\n');

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

  const htmlFile = path.join(__dirname, 'alimentari_piccolo.html');

  try {
    await html2pptx(htmlFile, pptx, { tmpDir: __dirname });

    const outputPath = path.join(__dirname, '..', 'Alimentari_Piccolo.pptx');
    await pptx.writeFile({ fileName: outputPath });

    console.log(`✅ Présentation créée avec succès: ${outputPath}`);
  } catch (error) {
    console.error('❌ Erreur lors de la génération:', error.message);
    if (error.stack) {
      console.error(error.stack);
    }
    process.exit(1);
  }
}

generatePresentation();
