from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
FILES = {
    "AgrarianTypes.h": ROOT / "Source" / "AgrarianGame" / "AgrarianTypes.h",
    "AgrarianSurvivalComponent.h": ROOT / "Source" / "AgrarianGame" / "AgrarianSurvivalComponent.h",
    "AgrarianSurvivalComponent.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianSurvivalComponent.cpp",
    "AgrarianGameCharacter.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianGameCharacter.cpp",
    "AgrarianDebugHUD.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianDebugHUD.cpp",
    "AgrarianGamePlayerController.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianGamePlayerController.cpp",
    "PersistenceDesignDocument.md": ROOT / "Docs" / "PersistenceDesignDocument.md",
}

EXPECTED = {
    "AgrarianTypes.h": ["float SicknessSeverity = 0.0f;"],
    "AgrarianSurvivalComponent.h": [
        "float SicknessDamagePerMinute = 1.5f;",
        "float SicknessRecoveryPerSecond = 0.02f;",
        "void AddSickness(float Severity);",
        "void ReduceSickness(float Amount);",
    ],
    "AgrarianSurvivalComponent.cpp": [
        "Survival.SicknessSeverity > 0.0f",
        "CareHistory.IllnessBurden",
        "SicknessDamagePerMinute",
        "void UAgrarianSurvivalComponent::AddSickness",
        "void UAgrarianSurvivalComponent::ReduceSickness",
        "Survival.SicknessSeverity = FMath::Clamp(Survival.SicknessSeverity, 0.0f, 100.0f);",
    ],
    "AgrarianGameCharacter.cpp": [
        "const float SicknessMultiplier = FMath::GetMappedRangeValueClamped",
        "Survival.SicknessSeverity",
        "InjuryMultiplier * SicknessMultiplier * ExhaustionMultiplier",
    ],
    "AgrarianDebugHUD.cpp": ["Sick:", "Survival.SicknessSeverity"],
    "AgrarianGamePlayerController.cpp": [
        "Sickness %.1f",
        "Survival.SicknessSeverity",
        "SurvivalComponent->ReduceSickness(100.0f);",
    ],
    "PersistenceDesignDocument.md": ["sickness severity"],
}


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

    if missing:
        raise RuntimeError("Sickness placeholder verification failed: " + "; ".join(missing))

    print("Agrarian sickness placeholder verification complete.")


if __name__ == "__main__":
    main()
