def process_configs()

in python/remote-control-center/GetConfigLambda/lambda_function.py [0:0]


def process_configs(collection_id, raw_configs, language_code):
    response = {
        "SUCCESS": "TRUE"
    }

    for conf in raw_configs:
        config_id = conf["ConfigId"]
        
        if conf["ConfigType"] == "STATIC_ROUTING":
            response[config_id] = conf["DefaultResponse"]

        elif conf["ConfigType"] == "LANGUAGE_ROUTING":
            if language_code in conf:
                response[config_id] = conf[language_code]
            else:
                add_new_language(collection_id, config_id, conf["DefaultResponse"], language_code)
                response[config_id] = conf["DefaultResponse"]

        elif conf["ConfigType"] == "MESSAGE":
            if language_code in conf:
                response[config_id] = conf[language_code]
            else:
                response_text, language_code = translate_and_update(collection_id, config_id, conf['DefaultResponse'], language_code)
                response[config_id] = response_text

    return response