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

import typing
import pathlib
from styxdefs import *
import dataclasses

GEN_GROUP_COMMAND_PY_METADATA = Metadata(
    id="51c3095191f9344439630ab4bd49fe90d933b15f.boutiques",
    name="gen_group_command.py",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class GenGroupCommandPyOutputs(typing.NamedTuple):
    """
    Output object returned when calling `gen_group_command_py(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_script: OutputPathType | None
    """The generated command script file"""


def gen_group_command_py(
    command_name: str,
    datasets: list[str],
    prefix: str | None = None,
    set_labels: list[str] | None = None,
    subj_prefix: str | None = None,
    subj_suffix: str | None = None,
    subs_betas: list[str] | None = None,
    subs_tstats: list[str] | None = None,
    type_: str | None = None,
    verb: str | None = None,
    write_script: str | None = None,
    other_options: list[str] | None = None,
    runner: Runner | None = None,
) -> GenGroupCommandPyOutputs:
    """
    Generate group analysis command scripts by parsing wildcard-based lists of input
    datasets.
    
    Author: AFNI Team
    
    URL:
    https://afni.nimh.nih.gov/pub/dist/doc/program_help/gen_group_command.py.html
    
    Args:
        command_name: Resulting command, such as 3dttest++.
        datasets: List of datasets, can be used multiple times for different\
            groups.
        prefix: Prefix for the output file names.
        set_labels: Labels corresponding to datasets entries.
        subj_prefix: Prefix for subject names.
        subj_suffix: Suffix for subject names.
        subs_betas: Sub-bricks for beta weights.
        subs_tstats: Sub-bricks for t-stats (3dMEMA).
        type_: Specify the type of test to perform.
        verb: Set the verbosity level.
        write_script: Write command script to specified file name.
        other_options: List of options to pass along to result.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `GenGroupCommandPyOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(GEN_GROUP_COMMAND_PY_METADATA)
    cargs = []
    cargs.append("gen_group_command.py")
    cargs.extend([
        "-command",
        command_name
    ])
    cargs.extend([
        "-dsets",
        *datasets
    ])
    cargs.append("[OPTIONS]")
    if prefix is not None:
        cargs.extend([
            "-prefix",
            prefix
        ])
    if set_labels is not None:
        cargs.extend([
            "-set_labels",
            *set_labels
        ])
    if subj_prefix is not None:
        cargs.extend([
            "-subj_prefix",
            subj_prefix
        ])
    if subj_suffix is not None:
        cargs.extend([
            "-subj_suffix",
            subj_suffix
        ])
    if subs_betas is not None:
        cargs.extend([
            "-subs_betas",
            *subs_betas
        ])
    if subs_tstats is not None:
        cargs.extend([
            "-subs_tstats",
            *subs_tstats
        ])
    if type_ is not None:
        cargs.extend([
            "-type",
            type_
        ])
    if verb is not None:
        cargs.extend([
            "-verb",
            verb
        ])
    if write_script is not None:
        cargs.extend([
            "-write_script",
            write_script
        ])
    if other_options is not None:
        cargs.extend([
            "-options",
            *other_options
        ])
    ret = GenGroupCommandPyOutputs(
        root=execution.output_file("."),
        output_script=execution.output_file(write_script) if (write_script is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "GEN_GROUP_COMMAND_PY_METADATA",
    "GenGroupCommandPyOutputs",
    "gen_group_command_py",
]
