from typing import Union
from typing import Dict
from typing import List


def _get_project_names(data: Union[Dict, List]) -> List[str]:
    """
    Recursively searches for collection names 
    under "Projects" key in CMR umm_json response

    :param data: CMR umm_json response

    :return: A list of found collection names for the given platform
    """
    output = []
    if isinstance(data, Dict):
        for key, value in data.items():
            if key == "Projects":
                return [list(item.values())[0] for item in value]
            output.extend(_get_project_names(value))
    elif isinstance(data, List):
        for item in data:
            output.extend(_get_project_names(item))
    
    return output