#!/usr/bin/env python3
"""Verify multiplayer learning rules are documented."""

from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
DOC = ROOT / "Docs" / "KnowledgeAndSkillFoundation.md"
ROADMAP = ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md"

REQUIRED = {
    DOC: [
        "## Multiplayer Learning Rules",
        "Teaching:",
        "The server validates teaching credit.",
        "Observation:",
        "Passive observation grants less credit than direct practice.",
        "Shared work:",
        "Group tasks can grant role-specific experience to active contributors.",
        "Group skill benefits:",
        "Benefits should be capped",
        "No global aura:",
        "Network rules:",
        "Server authority validates distance, visibility, participation, role,",
        "Multiplayer rule:",
    ],
    ROADMAP: [
        "[x] Add multiplayer rules for teaching, observation, shared work, and group skill benefits.",
    ],
}


def main() -> None:
    missing: list[str] = []
    for path, snippets in REQUIRED.items():
        text = path.read_text(encoding="utf-8")
        for snippet in snippets:
            if snippet not in text:
                missing.append(f"{path.relative_to(ROOT)} missing {snippet!r}")
    if missing:
        raise SystemExit("FAILED: " + "; ".join(missing))
    print("OK: multiplayer learning rules are documented.")


if __name__ == "__main__":
    main()
