from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]

EXPECTED = {
    ROOT / "Docs" / "Ops" / "PersistenceSaveRecoveryPlan.md": [
        "Saved/SaveGames/AgrarianMVP.sav",
        "Saved/SaveGames/Backups",
        "Copy the current `AgrarianMVP.sav` aside with a `.suspect` suffix.",
        "Copy that backup to `Saved/SaveGames/AgrarianMVP.sav`.",
        "There is no automated save-file validation tool yet.",
    ],
    ROOT / "Docs" / "PersistenceDesignDocument.md": [
        "`Docs/Ops/PersistenceSaveRecoveryPlan.md`",
        "preserve the suspect save",
        "restore the newest timestamped",
    ],
    ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md": [
        "[x] Add recovery plan for corrupted save.",
        "`Docs/Ops/PersistenceSaveRecoveryPlan.md`",
        "current MVP limitations",
    ],
}


def main() -> None:
    missing = []
    for path, snippets in EXPECTED.items():
        text = path.read_text(encoding="utf-8")
        for snippet in snippets:
            if snippet not in text:
                missing.append(f"{path.relative_to(ROOT)}: {snippet}")

    if missing:
        raise RuntimeError("Save recovery plan verification failed: " + "; ".join(missing))

    print("PASS: corrupted-save recovery plan is documented.")


if __name__ == "__main__":
    main()
