# Path: slicer_cli_web/cli_utils.py
# SLICER_TYPE_TO_GIRDER_MODEL_MAP = {
#     'image': 'file',
#     'file': 'file',
#     'item': 'item',
#     'directory': 'folder'
# }
# SLICER_SUPPORTED_TYPES = set(['boolean', 'integer', 'float', 'double', 'string',
#                               'integer-vector', 'float-vector', 'double-vector', 'string-vector',
#                               'integer-enumeration', 'float-enumeration', 'double-enumeration',
#                               'string-enumeration',
#                               'region'] + list(SLICER_TYPE_TO_GIRDER_MODEL_MAP.keys()))
# def generate_description(clim):
# def as_model(cliXML):
# def get_cli_parameters(clim):
#     def get_flag(p):
# def is_on_girder(param):
# def is_girder_api(param):


import json
import jinja2
    import uuid
from girder import logger
from girder.api.rest import RestException
from girder.constants import AccessType
from girder.exceptions import FilePathException
from girder.models.file import File
from girder.models.setting import Setting
from girder.utility.model_importer import ModelImporter
from .cli_utils import (SLICER_TYPE_TO_GIRDER_MODEL_MAP, is_girder_api, is_on_girder,
                        return_parameter_file_name)
    from girder_worker.docker.transforms.girder import (GirderFileIdToVolume,
                                                        GirderFolderIdToVolume,
                                                        GirderItemIdToVolume)
    from girder_worker.girder_plugin.constants import PluginSettings
    from .girder_worker_plugin.direct_docker_run import DirectGirderFileIdToVolume
    from .girder_worker_plugin.direct_docker_run import GirderApiUrl, GirderToken
    from girder_worker.docker.transforms import VolumePath
    from girder_worker.docker.transforms.girder import GirderUploadVolumePathToFolder
    from girder_worker.docker.transforms import VolumePath
    from girder_worker.docker.transforms.girder import GirderUploadVolumePathToFolder
    from girder_worker.docker.transforms import VolumePath
    from girder_worker.docker.transforms.girder import GirderUploadVolumePathToFolder
    return value


def _add_optional_input_param(param, args, user, token, templateParams):
    if param.identifier() not in args:
        return []
    value = _parseParamValue(param, args[param.identifier()], user, token)

    container_args = []
    if param.longflag:
        container_args.append(param.longflag)
    elif param.flag:
        container_args.append(param.flag)
    else:
        return []

    if is_on_girder(param):
        # Bindings
        container_args.append(_to_file_volume(param, value))
    elif is_girder_api(param):
        # Bindings
        container_args.append(_to_girder_api(param, value))
    else:
        value = _processTemplates(value, param, templateParams)
        container_args.append(value)
    return container_args


def _add_optional_output_param(param, args, user, result_hooks, reference, templateParams):


# Path: slicer_cli_web/cli_utils.py
# SLICER_TYPE_TO_GIRDER_MODEL_MAP = {
#     'image': 'file',
#     'file': 'file',
#     'item': 'item',
#     'directory': 'folder'
# }
# SLICER_SUPPORTED_TYPES = set(['boolean', 'integer', 'float', 'double', 'string',
#                               'integer-vector', 'float-vector', 'double-vector', 'string-vector',
#                               'integer-enumeration', 'float-enumeration', 'double-enumeration',
#                               'string-enumeration',
#                               'region'] + list(SLICER_TYPE_TO_GIRDER_MODEL_MAP.keys()))
# def generate_description(clim):
# def as_model(cliXML):
# def get_cli_parameters(clim):
#     def get_flag(p):
# def is_on_girder(param):
# def is_girder_api(param):


# Path: slicer_cli_web/prepare_task.py
import json
import jinja2
    import uuid
from girder import logger
from girder.api.rest import RestException
from girder.constants import AccessType
from girder.exceptions import FilePathException
from girder.models.file import File
from girder.models.setting import Setting
from girder.utility.model_importer import ModelImporter
from .cli_utils import (SLICER_TYPE_TO_GIRDER_MODEL_MAP, is_girder_api, is_on_girder,
                        return_parameter_file_name)
    from girder_worker.docker.transforms.girder import (GirderFileIdToVolume,
                                                        GirderFolderIdToVolume,
                                                        GirderItemIdToVolume)
    from girder_worker.girder_plugin.constants import PluginSettings
    from .girder_worker_plugin.direct_docker_run import DirectGirderFileIdToVolume
    from .girder_worker_plugin.direct_docker_run import GirderApiUrl, GirderToken
    from girder_worker.docker.transforms import VolumePath
    from girder_worker.docker.transforms.girder import GirderUploadVolumePathToFolder
    from girder_worker.docker.transforms import VolumePath
    from girder_worker.docker.transforms.girder import GirderUploadVolumePathToFolder
    from girder_worker.docker.transforms import VolumePath
    from girder_worker.docker.transforms.girder import GirderUploadVolumePathToFolder

    return value


def _add_optional_input_param(param, args, user, token, templateParams):
    if param.identifier() not in args:
        return []
    value = _parseParamValue(param, args[param.identifier()], user, token)

    container_args = []
    if param.longflag:
        container_args.append(param.longflag)
    elif param.flag:
        container_args.append(param.flag)
    else:
        return []

    if is_on_girder(param):
        # Bindings
        container_args.append(_to_file_volume(param, value))
    elif is_girder_api(param):
        # Bindings
        container_args.append(_to_girder_api(param, value))
    else:
        value = _processTemplates(value, param, templateParams)
        container_args.append(value)
    return container_args


def _add_optional_output_param(param, args, user, result_hooks, reference, templateParams):


    if (not param.isExternalType() or not is_on_girder(param) or