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

import typing
import pathlib
from styxdefs import *
import dataclasses

LONG_QDEC_TABLE_METADATA = Metadata(
    id="3e490486cd37e1e7aa6f857009bf74cde0ba7251.boutiques",
    name="long_qdec_table",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class LongQdecTableOutputs(typing.NamedTuple):
    """
    Output object returned when calling `long_qdec_table(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_table: OutputPathType | None
    """Output table file generated by the specified operations"""


def long_qdec_table(
    qdec_table: InputPathType,
    split: str | None = None,
    cross_flag: bool = False,
    sort: str | None = None,
    out: str | None = None,
    runner: Runner | None = None,
) -> LongQdecTableOutputs:
    """
    Tool to operate on longitudinal QDEC tables.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        qdec_table: QDEC table file specifying the subjects and time points.
        split: Split table based on column (e.g., use 'fsid-base' to separate\
            subjects).
        cross_flag: Collapse table to cross sectional (one line per subject).
        sort: Sort table based on column within subject (e.g., 'age').
        out: Output file name for operations producing a single table.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `LongQdecTableOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(LONG_QDEC_TABLE_METADATA)
    cargs = []
    cargs.append("long_qdec_table")
    cargs.extend([
        "--qdec",
        execution.input_file(qdec_table)
    ])
    if split is not None:
        cargs.extend([
            "--split",
            split
        ])
    if cross_flag:
        cargs.append("--cross")
    if sort is not None:
        cargs.extend([
            "--sort",
            sort
        ])
    if out is not None:
        cargs.extend([
            "--out",
            out
        ])
    ret = LongQdecTableOutputs(
        root=execution.output_file("."),
        output_table=execution.output_file(out) if (out is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "LONG_QDEC_TABLE_METADATA",
    "LongQdecTableOutputs",
    "long_qdec_table",
]
