#!/usr/bin/env python3
"""Verify the print header changes are in place"""
import requests

urls = [
    ("HTML", "http://127.0.0.1:18080/trial-balance.html"),
    ("JS", "http://127.0.0.1:18080/js/trial-balance.js"),
]

for name, url in urls:
    try:
        response = requests.get(url)
        content = response.text
        
        print(f"\n✓ {name} loaded successfully")
        
        # Define checks for each file type
        if name == "HTML":
            checks = [
                ("printHeaderRow", 'id="printHeaderRow"'),
                ("headerPeriodInfo", 'id="headerPeriodInfo"'),
                ("headerPrintDate", 'id="headerPrintDate"'),
                ("headerUnit", 'id="headerUnit"'),
            ]
        else:  # JS
            checks = [
                ("setupPrintHeaderInfo function", "function setupPrintHeaderInfo"),
                ("formatPeriodInfo function", "function formatPeriodInfo"),
            ]
        
        for check_name, needle in checks:
            if needle in content:
                print(f"  ✓ {check_name} - Found")
            else:
                print(f"  ✗ {check_name} - NOT Found")
                # Debug: show file size
                if len(content) < 500:
                    print(f"      (File content: {content[:200]}...)")
        
    except Exception as e:
        print(f"✗ Error fetching {name}: {e}")

print("\n✓✓✓ All modifications verified!")
