from typing import Dict
from typing import Any
from typing import Union


def get_mineral_name(mineral_dict: Dict[str, Any]) -> Union[str, None]:
    """Get the mineral name from a mineral dictionary.

    Args:
        mineral_dict: The mineral dictionary from the condensed description.

    Returns:
        If ``mineral_dict["type"]`` is set, the mineral name will be returned as
        a string, else ``None`` will be returned.
    """
    if mineral_dict['type']:
        if not mineral_dict['n_species_type_match']:
            suffix = "-derived"
        elif mineral_dict['distance'] >= 0:
            suffix = "-like"
        else:
            suffix = ""

        return "{}{}".format(mineral_dict['type'], suffix)

    else:
        return None