from pathlib import Path


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

EXPECTED = {
    ROOT / "Source" / "AgrarianGame" / "AgrarianTypes.h": [
        "struct FAgrarianCareHistorySnapshot",
        "float NutritionQuality = 1.0f;",
        "float IllnessBurden = 0.0f;",
        "float InjuryBurden = 0.0f;",
        "float SleepQuality = 1.0f;",
        "float ShelterQuality = 1.0f;",
        "float StressBurden = 0.0f;",
        "float WorkloadBurden = 0.0f;",
        "float TreatmentQuality = 1.0f;",
    ],
    ROOT / "Source" / "AgrarianGame" / "AgrarianSaveGame.h": [
        "FAgrarianCareHistorySnapshot CareHistory;",
    ],
    ROOT / "Source" / "AgrarianGame" / "AgrarianPersistenceSubsystem.cpp": [
        "SavedPlayer.CareHistory = SurvivalComponent->CareHistory;",
        "SurvivalComponent->ApplySavedState(SavedPlayer->Survival, SavedPlayer->CareHistory);",
    ],
    ROOT / "Docs" / "PersistenceDesignDocument.md": [
        "`FAgrarianSavedPlayer::CareHistory`",
        "nutrition, illness, injury, sleep, shelter, stress, workload",
        "lifespan, inheritance, or generational outcome gameplay",
    ],
    ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md": [
        "[x] Save long-term character care history placeholders",
        "`FAgrarianSavedPlayer::CareHistory`",
        "deferred",
    ],
}


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("Care history persistence verification failed: " + "; ".join(missing))

    print("PASS: care history placeholders persist without enabling aging gameplay.")


if __name__ == "__main__":
    main()
