from typing import Dict


def get_param(elem: dict) -> Dict[str, str]:
    """
    get parameter in function signature from yaml element, e.g.
    -
        name: input
        type: str
    produces ["const std::string &"] and ["input_name"]
    :param elem: yaml element of a input
    :return: A tuple, (type, name)
    """
    if elem['cpp_type'] == 'str':
        ret = {'type': 'const std::string &', 'name': elem['name']}
    elif elem['cpp_type'] == 'optional_str':
        ret = {'type': 'const dnn::optional<std::string> &', 'name': elem['name']}
    elif elem['cpp_type'] == 'str_list':
        ret = {'type': 'const std::vector<std::string> &', 'name': elem['name']}
    elif elem['cpp_type'] == 'int32_list':
        ret = {'type': 'const std::vector<int32_t> &', 'name': elem['name']}
    else:
        ret = {'type': elem['cpp_type'], 'name': elem['name']}
    # If we make some input (e.g. api 29 new input) optional, the outputs (after inputs in arg list)
    # have to be optional too, so disable it.
    # if 'default' in elem:
        # ret['default'] = elem['default']
    return ret