from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
LEGACY_ACTION_CODES = {
    "CONFIRM_PAYMENT_AND_PREPARE_SHIPMENT",
    "CHECK_SHIPMENT_STATUS",
    "CHECK_MISSING_MATERIAL",
    "HANDLE_TECHNICAL_SUPPORT",
    "HANDLE_WARRANTY_SUPPORT",
    "PREPARE_ORDER",
    "VALIDATE_SHIPMENT",
    "FOLLOW_UP_INFO",
    "CONTACT_CLIENT",
    "SCHEDULE_MEETING",
}


def test_action_catalog_contains_only_current_triage_codes():
    text = (ROOT / "app" / "action_catalog.py").read_text()
    for code in LEGACY_ACTION_CODES:
        assert code not in text


def test_no_absolute_dashboard_paths():
    text = (ROOT / "app" / "admin_dashboard.py").read_text()
    assert "/mnt/ssd/home/plx/clientflow_backend" not in text
    assert "/mnt/ssd/backups/clientflow" not in text


def test_task_preparations_schema_exists():
    text = (ROOT / "app" / "db.py").read_text()
    assert "CREATE TABLE IF NOT EXISTS task_preparations" in text


def test_sqlite_default_removed():
    text = (ROOT / "app" / "config.py").read_text()
    assert "sqlite:///" not in text
    assert "database_url: str" in text
