const path = require('path');
module.paths.unshift(path.join(require('os').homedir(), '.claude/skills/pptx-skill/scripts/node_modules'));

const html2pptx = require(path.join(require('os').homedir(), '.claude/skills/pptx-skill/scripts/html2pptx.js'));
const PptxGenJS = require('pptxgenjs');

async function main() {
    const pres = new PptxGenJS();
    pres.defineLayout({ name: 'CUSTOM_16x9', width: 10, height: 5.625 });
    pres.layout = 'CUSTOM_16x9';
    pres.author = '(주)코드브릿지엑스';
    pres.subject = 'SAM 활용방안 - AI 자동화로 중소 제조업을 혁신하다';

    const slideDir = __dirname;
    const slideFiles = [
        'slide-01.html', 'slide-02.html', 'slide-03.html',
        'slide-04.html', 'slide-05.html', 'slide-06.html', 'slide-07.html'
    ];

    for (const file of slideFiles) {
        const htmlPath = path.join(slideDir, file);
        console.log(`Converting: ${file}`);
        await html2pptx(htmlPath, pres);
    }

    const outputPath = path.join(slideDir, 'SAM_활용방안.pptx');
    await pres.writeFile({ fileName: outputPath });
    console.log(`\nPPTX saved: ${outputPath}`);
}

main().catch(err => { console.error(err); process.exit(1); });
