# This file was auto generated by Styx.
# Do not edit this file directly.

import typing
import pathlib
from styxdefs import *
import dataclasses

SET_MAP_NAMES_METADATA = Metadata(
    id="b84e64ed99a4d53eca7499a7b67fae1ad3f6a9af.boutiques",
    name="set-map-names",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


@dataclasses.dataclass
class SetMapNamesMap:
    """
    specify a map to set the name of.
    """
    index: int
    """the map index to change the name of"""
    new_name: str
    """the name to set for the map"""
    
    def run(
        self,
        execution: Execution,
    ) -> list[str]:
        """
        Build command line arguments. This method is called by the main command.
        
        Args:
            execution: The execution object.
        Returns:
            Command line arguments
        """
        cargs = []
        cargs.append("-map")
        cargs.append(str(self.index))
        cargs.append(self.new_name)
        return cargs


class SetMapNamesOutputs(typing.NamedTuple):
    """
    Output object returned when calling `set_map_names(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def set_map_names(
    data_file: str,
    opt_name_file_file: str | None = None,
    opt_from_data_file_file: str | None = None,
    map_: list[SetMapNamesMap] | None = None,
    runner: Runner | None = None,
) -> SetMapNamesOutputs:
    """
    Set the name of one or more maps in a file.
    
    Sets the name of one or more maps for metric, shape, label, volume, cifti
    scalar or cifti label files. You must specify either -name-file, or
    -from-data-file, or at least one -map option. The three option types are
    mutually exclusive.
    
    Author: Washington University School of Medicin
    
    Args:
        data_file: the file to set the map names of.
        opt_name_file_file: use a text file to replace all map names: text file\
            containing map names, one per line.
        opt_from_data_file_file: use the map names from another data file: a\
            data file with the same number of maps.
        map_: specify a map to set the name of.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SetMapNamesOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SET_MAP_NAMES_METADATA)
    cargs = []
    cargs.append("wb_command")
    cargs.append("-set-map-names")
    cargs.append(data_file)
    if opt_name_file_file is not None:
        cargs.extend([
            "-name-file",
            opt_name_file_file
        ])
    if opt_from_data_file_file is not None:
        cargs.extend([
            "-from-data-file",
            opt_from_data_file_file
        ])
    if map_ is not None:
        cargs.extend([a for c in [s.run(execution) for s in map_] for a in c])
    ret = SetMapNamesOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "SET_MAP_NAMES_METADATA",
    "SetMapNamesMap",
    "SetMapNamesOutputs",
    "set_map_names",
]
