from pathlib import Path
from docx import Document
from docx.shared import Inches, Pt
from pptx import Presentation
from pptx.util import Inches as PI
import sqlite3, json, zipfile, hashlib, shutil, subprocess
ROOT=Path('/tmp/lead-32693-r2/capture-1')
P=ROOT/'project'; P.mkdir(exist_ok=True)
for variant in ['A','B']:
 d=Document(); sec=d.sections[0]; sec.page_width=Inches(8.5); sec.page_height=Inches(11)
 for n in range(1,22):
  d.add_heading(f'Section {n:02d} — Synthetic report {variant}',0)
  for i in range(1,10): d.add_paragraph(f'Page {n:02d}, paragraph {i}. This synthetic evidence document contains no personal data. An unchanged preview should retain the current reading position.')
  if n<21: d.add_page_break()
 d.save(ROOT/f'report-{variant}.docx')
shutil.copyfile(ROOT/'report-A.docx',P/'report.docx')
r=Presentation()
for n in range(1,4):
 s=r.slides.add_slide(r.slide_layouts[1]); s.shapes.title.text=f'Synthetic slide {n}'
 s.placeholders[1].text=f'Slide {n} of 3\nRetain slide 2 through a no-op turn.\nSynthetic preview evidence.'
r.save(P/'slides.pptx')
c=sqlite3.connect(P/'records.sqlite');c.executescript('CREATE TABLE records (id INTEGER PRIMARY KEY, label TEXT, notes TEXT, extra TEXT); CREATE TABLE categories (id INTEGER, name TEXT); INSERT INTO categories VALUES (1,"Synthetic");')
c.executemany('INSERT INTO records VALUES (?,?,?,?)',[(i,f'Record {i:03d}','Synthetic long cell — '+('wide column content '*8),'End column '+str(i)) for i in range(1,401)]);c.commit();c.close()
(P/'payload.bin').write_bytes(b'SYNTHETIC\0BINARY\x01\x02'*20)
(P/'bad.txt').write_bytes(b'SYNTHETIC\0BINARY\x01\x02'*20)
(P/'corrupt.docx').write_bytes(b'Invalid synthetic Office fixture')
(P/'README.md').write_text('# Preview evidence\nSynthetic fixtures for file preview retention.\n')
subprocess.run(['git','init','-q',str(P)],check=True)
subprocess.run(['git','-C',str(P),'add','.'],check=True)
subprocess.run(['git','-C',str(P),'-c','user.name=Synthetic Evidence','-c','user.email=synthetic@example.invalid','commit','-qm','Synthetic fixtures'],check=True)
(ROOT/'fixture-sha256.json').write_text(json.dumps({f.name:hashlib.sha256(f.read_bytes()).hexdigest() for f in P.iterdir() if f.is_file()},indent=2))
print(P)
