from typing import Dict
from typing import Any


def _get_player_pts_stat_type(player_pts: Dict[str, Any]) -> str:
    """
    Helper function to get the stat type within the pulled player
    points. Will be either 'projectedStats' or 'stats'.
    """
    unique_type = set([list(v.keys())[0] for v in player_pts.values()])

    if len(unique_type) > 1:
        raise ValueError(f"More than one unique stats type detected: {unique_type}")

    stats_type = list(unique_type)[0]

    if stats_type not in ("projectedStats", "stats"):
        raise ValueError(
            f"Unrecognized stats type: '{stats_type}'. "
            + "Expected either 'projectedStats' or 'stats'."
        )

    return stats_type