import fs from "fs";
import path from "path";
import PizZip from "pizzip";
const contentTypes = `
`;
const rels = `
`;
const documentXml = `
{field_name} 异常检测报告
评估日期:{datatime}
接入风机:{turbine_count} 台;异常风机:{abnormal_count} 台
【自动插入:异常概览图】
【自动插入:风机检测器图表】
`;
const zip = new PizZip();
zip.file("[Content_Types].xml", contentTypes);
zip.file("_rels/.rels", rels);
zip.file("word/document.xml", documentXml);
const outDir = path.join(process.cwd(), "templates");
fs.mkdirSync(outDir, { recursive: true });
const outPath = path.join(outDir, "anomaly-report-template.docx");
fs.writeFileSync(outPath, zip.generate({ type: "nodebuffer" }));
console.log("created:", outPath);