"""Generate tenant-dossier.pdf for neutralization demo. Run: python _generateTenantDossierPdf.py

Uses ReportLab so the PDF opens reliably in all viewers (stdlib-only PDFs are fragile).
"""
from pathlib import Path

from reportlab.lib.pagesizes import A4
from reportlab.pdfgen import canvas


def _main():
    outPath = Path(__file__).resolve().parent / "tenant-dossier.pdf"
    c = canvas.Canvas(str(outPath), pagesize=A4)
    _, h = A4
    margin = 72
    y = h - margin
    c.setFont("Helvetica-Bold", 13)
    c.drawString(margin, y, "Tenant dossier (demo) - confidential")
    y -= 22
    c.setFont("Helvetica", 11)
    lines = [
        "Fictional demo data for neutralization testing.",
        "",
        "Tenant name: Hans Muster",
        "Date of birth: 14.03.1982",
        "Nationality: Swiss",
        "",
        "Residential address:",
        "Bahnhofstrasse 1",
        "8001 Zurich",
        "Switzerland",
        "",
        "Email: hans.muster@example-mail.demo",
        "Phone: +41 79 123 45 67",
        "",
        "Lease reference: LE-2024-88421",
        "Monthly rent: CHF 2450.00",
        "Deposit held: CHF 7350.00",
        "",
        "Employer: Demo Consulting AG, Limmatquai 78, 8001 Zurich",
        "",
        "Notes: Tenant requested balcony repair (ticket REQ-992).",
    ]
    lineHeight = 14
    for line in lines:
        if y < margin and line:
            c.showPage()
            c.setFont("Helvetica", 11)
            y = h - margin
        c.drawString(margin, y, line)
        y -= lineHeight
    c.save()
    print(f"Wrote {outPath}")


if __name__ == "__main__":
    _main()
