from typing import Dict
from typing import Any


def validate_result(result: Dict[str, Any]) -> bool:
    """Validates the result.json file generated by prosecoPlanner.cpp

    Parameters
    ----------
    results: Dict[str, Any]
        Loaded result.json file.

    Returns
    -------
    bool
        Validity of the result dictionary.
    """
    keys = (
        "carsCollided",
        "carsInvalid",
        "desiresFulfilled",
        "finalstep",
        "maxSimTimeReached",
        "normalizedCoopRewardSum",
        "normalizedEgoRewardSum",
        "scenario",
    )
    for key in keys:
        if key in result.keys():
            if result[key] is None:
                print("key: '{}' is None in result".format(key))
                return False
        else:
            print("key: '{}' is missing in result".format(key))
            return False
    return True