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

import typing
import pathlib
from styxdefs import *

ADD_TO_SPEC_FILE_METADATA = Metadata(
    id="70700f2e4a649b189d35240af30e2fe156a782f2.boutiques",
    name="add-to-spec-file",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


AddToSpecFileParameters = typing.TypedDict('AddToSpecFileParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/add-to-spec-file"]],
    "specfile": str,
    "structure": str,
    "filename": str,
})
AddToSpecFileParametersTagged = typing.TypedDict('AddToSpecFileParametersTagged', {
    "@type": typing.Literal["workbench/add-to-spec-file"],
    "specfile": str,
    "structure": str,
    "filename": str,
})


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


def add_to_spec_file_params(
    specfile: str,
    structure: str,
    filename: str,
) -> AddToSpecFileParametersTagged:
    """
    Build parameters.
    
    Args:
        specfile: the specification file to add to.
        structure: the structure of the data file.
        filename: the path to the file.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/add-to-spec-file",
        "specfile": specfile,
        "structure": structure,
        "filename": filename,
    }
    return params


def add_to_spec_file_cargs(
    params: AddToSpecFileParameters,
    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("-add-to-spec-file")
    cargs.append(params.get("specfile", None))
    cargs.append(params.get("structure", None))
    cargs.append(params.get("filename", None))
    return cargs


def add_to_spec_file_outputs(
    params: AddToSpecFileParameters,
    execution: Execution,
) -> AddToSpecFileOutputs:
    """
    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 = AddToSpecFileOutputs(
        root=execution.output_file("."),
    )
    return ret


def add_to_spec_file_execute(
    params: AddToSpecFileParameters,
    runner: Runner | None = None,
) -> AddToSpecFileOutputs:
    """
    add-to-spec-file
    
    Add a file to a specification file.
    
    The resulting spec file overwrites the existing spec file. If the spec file
    doesn't exist, it is created with default metadata. The structure argument
    must be one of the following:
    
    CORTEX_LEFT
    CORTEX_RIGHT
    CEREBELLUM
    ACCUMBENS_LEFT
    ACCUMBENS_RIGHT
    ALL_GREY_MATTER
    ALL_WHITE_MATTER
    AMYGDALA_LEFT
    AMYGDALA_RIGHT
    BRAIN_STEM
    CAUDATE_LEFT
    CAUDATE_RIGHT
    CEREBELLAR_WHITE_MATTER_LEFT
    CEREBELLAR_WHITE_MATTER_RIGHT
    CEREBELLUM_LEFT
    CEREBELLUM_RIGHT
    CEREBRAL_WHITE_MATTER_LEFT
    CEREBRAL_WHITE_MATTER_RIGHT
    CORTEX
    DIENCEPHALON_VENTRAL_LEFT
    DIENCEPHALON_VENTRAL_RIGHT
    HIPPOCAMPUS_LEFT
    HIPPOCAMPUS_RIGHT
    INVALID
    OTHER
    OTHER_GREY_MATTER
    OTHER_WHITE_MATTER
    PALLIDUM_LEFT
    PALLIDUM_RIGHT
    PUTAMEN_LEFT
    PUTAMEN_RIGHT
    THALAMUS_LEFT
    THALAMUS_RIGHT
    .
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `AddToSpecFileOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(ADD_TO_SPEC_FILE_METADATA)
    params = execution.params(params)
    cargs = add_to_spec_file_cargs(params, execution)
    ret = add_to_spec_file_outputs(params, execution)
    execution.run(cargs)
    return ret


def add_to_spec_file(
    specfile: str,
    structure: str,
    filename: str,
    runner: Runner | None = None,
) -> AddToSpecFileOutputs:
    """
    add-to-spec-file
    
    Add a file to a specification file.
    
    The resulting spec file overwrites the existing spec file. If the spec file
    doesn't exist, it is created with default metadata. The structure argument
    must be one of the following:
    
    CORTEX_LEFT
    CORTEX_RIGHT
    CEREBELLUM
    ACCUMBENS_LEFT
    ACCUMBENS_RIGHT
    ALL_GREY_MATTER
    ALL_WHITE_MATTER
    AMYGDALA_LEFT
    AMYGDALA_RIGHT
    BRAIN_STEM
    CAUDATE_LEFT
    CAUDATE_RIGHT
    CEREBELLAR_WHITE_MATTER_LEFT
    CEREBELLAR_WHITE_MATTER_RIGHT
    CEREBELLUM_LEFT
    CEREBELLUM_RIGHT
    CEREBRAL_WHITE_MATTER_LEFT
    CEREBRAL_WHITE_MATTER_RIGHT
    CORTEX
    DIENCEPHALON_VENTRAL_LEFT
    DIENCEPHALON_VENTRAL_RIGHT
    HIPPOCAMPUS_LEFT
    HIPPOCAMPUS_RIGHT
    INVALID
    OTHER
    OTHER_GREY_MATTER
    OTHER_WHITE_MATTER
    PALLIDUM_LEFT
    PALLIDUM_RIGHT
    PUTAMEN_LEFT
    PUTAMEN_RIGHT
    THALAMUS_LEFT
    THALAMUS_RIGHT
    .
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        specfile: the specification file to add to.
        structure: the structure of the data file.
        filename: the path to the file.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `AddToSpecFileOutputs`).
    """
    params = add_to_spec_file_params(
        specfile=specfile,
        structure=structure,
        filename=filename,
    )
    return add_to_spec_file_execute(params, runner)


__all__ = [
    "ADD_TO_SPEC_FILE_METADATA",
    "AddToSpecFileOutputs",
    "add_to_spec_file",
    "add_to_spec_file_execute",
    "add_to_spec_file_params",
]
