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

import typing
import pathlib
from styxdefs import *
import dataclasses

WBSPARSE_MERGE_DENSE_METADATA = Metadata(
    id="6eb20685f4c22c6b65becfd09a6b95edde9c4769.boutiques",
    name="wbsparse-merge-dense",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


@dataclasses.dataclass
class WbsparseMergeDenseWbsparse:
    """
    specify an input wbsparse file.
    """
    wbsparse_in: str
    """a wbsparse file to merge"""
    
    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("-wbsparse")
        cargs.append(self.wbsparse_in)
        return cargs


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


def wbsparse_merge_dense(
    direction: str,
    wbsparse_out: str,
    wbsparse: list[WbsparseMergeDenseWbsparse] | None = None,
    runner: Runner | None = None,
) -> WbsparseMergeDenseOutputs:
    """
    Merge wbsparse files along dense dimension.
    
    The input wbsparse files must have matching mappings along the direction not
    specified, and the mapping along the specified direction must be brain
    models.
    
    Author: Washington University School of Medicin
    
    Args:
        direction: which dimension to merge along, ROW or COLUMN.
        wbsparse_out: output - the output wbsparse file.
        wbsparse: specify an input wbsparse file.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `WbsparseMergeDenseOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(WBSPARSE_MERGE_DENSE_METADATA)
    cargs = []
    cargs.append("wb_command")
    cargs.append("-wbsparse-merge-dense")
    cargs.append(direction)
    cargs.append(wbsparse_out)
    if wbsparse is not None:
        cargs.extend([a for c in [s.run(execution) for s in wbsparse] for a in c])
    ret = WbsparseMergeDenseOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "WBSPARSE_MERGE_DENSE_METADATA",
    "WbsparseMergeDenseOutputs",
    "WbsparseMergeDenseWbsparse",
    "wbsparse_merge_dense",
]
