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

import typing
import pathlib
from styxdefs import *

CIFTI_CREATE_SCALAR_SERIES_METADATA = Metadata(
    id="89382f5dba10644cb62354103467cd5b9bd291f2.boutiques",
    name="cifti-create-scalar-series",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


CiftiCreateScalarSeriesSeriesParameters = typing.TypedDict('CiftiCreateScalarSeriesSeriesParameters', {
    "@type": typing.NotRequired[typing.Literal["series"]],
    "unit": str,
    "start": float,
    "step": float,
})
CiftiCreateScalarSeriesSeriesParametersTagged = typing.TypedDict('CiftiCreateScalarSeriesSeriesParametersTagged', {
    "@type": typing.Literal["series"],
    "unit": str,
    "start": float,
    "step": float,
})


CiftiCreateScalarSeriesParameters = typing.TypedDict('CiftiCreateScalarSeriesParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/cifti-create-scalar-series"]],
    "input": str,
    "cifti_out": str,
    "opt_transpose": bool,
    "opt_name_file_file": typing.NotRequired[str | None],
    "series": typing.NotRequired[CiftiCreateScalarSeriesSeriesParameters | None],
})
CiftiCreateScalarSeriesParametersTagged = typing.TypedDict('CiftiCreateScalarSeriesParametersTagged', {
    "@type": typing.Literal["workbench/cifti-create-scalar-series"],
    "input": str,
    "cifti_out": str,
    "opt_transpose": bool,
    "opt_name_file_file": typing.NotRequired[str | None],
    "series": typing.NotRequired[CiftiCreateScalarSeriesSeriesParameters | None],
})


def cifti_create_scalar_series_series_params(
    unit: str,
    start: float,
    step: float,
) -> CiftiCreateScalarSeriesSeriesParametersTagged:
    """
    Build parameters.
    
    Args:
        unit: the unit to use.
        start: the value at the first series point.
        step: the interval between series points.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "series",
        "unit": unit,
        "start": start,
        "step": step,
    }
    return params


def cifti_create_scalar_series_series_cargs(
    params: CiftiCreateScalarSeriesSeriesParameters,
    execution: Execution,
) -> list[str]:
    """
    Build command-line arguments from parameters.
    
    Args:
        params: The parameters.
        execution: The execution object for resolving input paths.
    Returns:
        Command-line arguments.
    """
    cargs = []
    cargs.append("-series")
    cargs.append(params.get("unit", None))
    cargs.append(str(params.get("start", None)))
    cargs.append(str(params.get("step", None)))
    return cargs


class CiftiCreateScalarSeriesOutputs(typing.NamedTuple):
    """
    Output object returned when calling `CiftiCreateScalarSeriesParameters(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    cifti_out: OutputPathType
    """output cifti file"""


def cifti_create_scalar_series_params(
    input_: str,
    cifti_out: str,
    opt_transpose: bool = False,
    opt_name_file_file: str | None = None,
    series: CiftiCreateScalarSeriesSeriesParameters | None = None,
) -> CiftiCreateScalarSeriesParametersTagged:
    """
    Build parameters.
    
    Args:
        input_: input file.
        cifti_out: output cifti file.
        opt_transpose: use if the rows of the text file are along the scalar\
            dimension.
        opt_name_file_file: use a text file to set names on scalar dimension:\
            text file containing names, one per line.
        series: set the units and values of the series.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/cifti-create-scalar-series",
        "input": input_,
        "cifti_out": cifti_out,
        "opt_transpose": opt_transpose,
    }
    if opt_name_file_file is not None:
        params["opt_name_file_file"] = opt_name_file_file
    if series is not None:
        params["series"] = series
    return params


def cifti_create_scalar_series_cargs(
    params: CiftiCreateScalarSeriesParameters,
    execution: Execution,
) -> list[str]:
    """
    Build command-line arguments from parameters.
    
    Args:
        params: The parameters.
        execution: The execution object for resolving input paths.
    Returns:
        Command-line arguments.
    """
    cargs = []
    cargs.append("wb_command")
    cargs.append("-cifti-create-scalar-series")
    cargs.append(params.get("input", None))
    cargs.append(params.get("cifti_out", None))
    if params.get("opt_transpose", False):
        cargs.append("-transpose")
    if params.get("opt_name_file_file", None) is not None:
        cargs.extend([
            "-name-file",
            params.get("opt_name_file_file", None)
        ])
    if params.get("series", None) is not None:
        cargs.extend(cifti_create_scalar_series_series_cargs(params.get("series", None), execution))
    return cargs


def cifti_create_scalar_series_outputs(
    params: CiftiCreateScalarSeriesParameters,
    execution: Execution,
) -> CiftiCreateScalarSeriesOutputs:
    """
    Build outputs object containing output file paths and possibly stdout/stderr.
    
    Args:
        params: The parameters.
        execution: The execution object for resolving input paths.
    Returns:
        Outputs object.
    """
    ret = CiftiCreateScalarSeriesOutputs(
        root=execution.output_file("."),
        cifti_out=execution.output_file(params.get("cifti_out", None)),
    )
    return ret


def cifti_create_scalar_series_execute(
    params: CiftiCreateScalarSeriesParameters,
    runner: Runner | None = None,
) -> CiftiCreateScalarSeriesOutputs:
    """
    cifti-create-scalar-series
    
    Import series data into cifti.
    
    Convert a text file containing series of equal length into a cifti file. The
    text file should have lines made up of numbers separated by whitespace, with
    no extra newlines between lines.
    
    The <unit> argument must be one of the following:
    
    SECOND
    HERTZ
    METER
    RADIAN.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiCreateScalarSeriesOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(CIFTI_CREATE_SCALAR_SERIES_METADATA)
    params = execution.params(params)
    cargs = cifti_create_scalar_series_cargs(params, execution)
    ret = cifti_create_scalar_series_outputs(params, execution)
    execution.run(cargs)
    return ret


def cifti_create_scalar_series(
    input_: str,
    cifti_out: str,
    opt_transpose: bool = False,
    opt_name_file_file: str | None = None,
    series: CiftiCreateScalarSeriesSeriesParameters | None = None,
    runner: Runner | None = None,
) -> CiftiCreateScalarSeriesOutputs:
    """
    cifti-create-scalar-series
    
    Import series data into cifti.
    
    Convert a text file containing series of equal length into a cifti file. The
    text file should have lines made up of numbers separated by whitespace, with
    no extra newlines between lines.
    
    The <unit> argument must be one of the following:
    
    SECOND
    HERTZ
    METER
    RADIAN.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        input_: input file.
        cifti_out: output cifti file.
        opt_transpose: use if the rows of the text file are along the scalar\
            dimension.
        opt_name_file_file: use a text file to set names on scalar dimension:\
            text file containing names, one per line.
        series: set the units and values of the series.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiCreateScalarSeriesOutputs`).
    """
    params = cifti_create_scalar_series_params(
        input_=input_,
        cifti_out=cifti_out,
        opt_transpose=opt_transpose,
        opt_name_file_file=opt_name_file_file,
        series=series,
    )
    return cifti_create_scalar_series_execute(params, runner)


__all__ = [
    "CIFTI_CREATE_SCALAR_SERIES_METADATA",
    "CiftiCreateScalarSeriesOutputs",
    "cifti_create_scalar_series",
    "cifti_create_scalar_series_execute",
    "cifti_create_scalar_series_params",
    "cifti_create_scalar_series_series_params",
]
