"""
T-DATA: Demo data files verification.

Ensures all expected demo data files exist in gateway/demoData/.
"""

from pathlib import Path

_DEMO_DATA_ROOT = Path(__file__).resolve().parent.parent.parent / "demoData"


class TestDemoDataStructure:

    def test_rootExists(self):
        assert _DEMO_DATA_ROOT.exists(), f"demoData root not found: {_DEMO_DATA_ROOT}"

    def test_invoicesNotEmpty(self):
        d = _DEMO_DATA_ROOT / "invoices"
        assert d.exists(), "invoices/ dir missing"
        files = [f for f in d.iterdir() if not f.name.startswith(".")]
        assert len(files) >= 1, f"invoices/ is empty: {list(d.iterdir())}"

    def test_expensesNotEmpty(self):
        d = _DEMO_DATA_ROOT / "expenses"
        assert d.exists(), "expenses/ dir missing"
        files = [f for f in d.iterdir() if not f.name.startswith(".")]
        assert len(files) >= 1, f"expenses/ is empty: {list(d.iterdir())}"

    def test_knowledgeBaseNotEmpty(self):
        d = _DEMO_DATA_ROOT / "knowledge-base"
        assert d.exists(), "knowledge-base/ dir missing"
        files = [f for f in d.iterdir() if not f.name.startswith(".")]
        assert len(files) >= 3, f"knowledge-base/ should have >=3 docs, found {len(files)}"

    def test_neutralizerHasDossier(self):
        pdf = _DEMO_DATA_ROOT / "neutralizer" / "tenant-dossier.pdf"
        assert pdf.exists(), "tenant-dossier.pdf missing"
        assert pdf.stat().st_size > 500, "tenant-dossier.pdf too small"

    def test_trusteeNotEmpty(self):
        d = _DEMO_DATA_ROOT / "trustee"
        assert d.exists(), "trustee/ dir missing"
        files = [f for f in d.iterdir() if not f.name.startswith(".")]
        assert len(files) >= 1, f"trustee/ is empty"
