import json

with open('scratch/parsed_blocks.json', 'r', encoding='utf-8') as f:
    data = json.load(f)

for p in data:
    ptype = p['type']
    if ptype == 'block':
        print(f"P{p['page']:02d}: [{p['title']}] Q{p['main_num']} | Repregs: {len(p['repreguntas'])}")
        for r in p['repreguntas']:
            print(f"    [{r['tag']}] #{r['num']}: {r['body'][:50]}...")
    elif ptype == 'backup_bullets':
        print(f"P{p['page']:02d}: {p['title']} ({len(p['bullets'])} bullets)")
        for b in p['bullets']:
            print(f"    - {b[:50]}...")
    else:
        print(f"P{p['page']:02d}: {ptype}")
