import dataiku


def do(payload, config, plugin_config, inputs):
    client = dataiku.api_client()
    parameter_name = payload["parameterName"]
    

    if parameter_name == "db_explorer_folder_paths":
        client = dataiku.api_client()
        project = client.get_project(dataiku.get_custom_variables()["projectKey"])
        managed_folders = project.list_managed_folders()
        choices = [{"value": folder["name"], "label": folder["name"]} for folder in managed_folders]
        return {"choices": choices}
    else:
        raise Exception(f"Unexpected parameter name '{parameter_name}'.")
