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

import typing
import pathlib
from styxdefs import *

SPEC_FILE_MERGE_METADATA = Metadata(
    id="dc8ed74b03797d25ba546c4df5d98037f0153fa7.boutiques",
    name="spec-file-merge",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


SpecFileMergeParameters = typing.TypedDict('SpecFileMergeParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/spec-file-merge"]],
    "spec_1": str,
    "spec_2": str,
    "out_spec": str,
})
SpecFileMergeParametersTagged = typing.TypedDict('SpecFileMergeParametersTagged', {
    "@type": typing.Literal["workbench/spec-file-merge"],
    "spec_1": str,
    "spec_2": str,
    "out_spec": str,
})


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


def spec_file_merge_params(
    spec_1: str,
    spec_2: str,
    out_spec: str,
) -> SpecFileMergeParametersTagged:
    """
    Build parameters.
    
    Args:
        spec_1: first spec file to merge.
        spec_2: second spec file to merge.
        out_spec: output - output spec file.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/spec-file-merge",
        "spec_1": spec_1,
        "spec_2": spec_2,
        "out_spec": out_spec,
    }
    return params


def spec_file_merge_cargs(
    params: SpecFileMergeParameters,
    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("-spec-file-merge")
    cargs.append(params.get("spec_1", None))
    cargs.append(params.get("spec_2", None))
    cargs.append(params.get("out_spec", None))
    return cargs


def spec_file_merge_outputs(
    params: SpecFileMergeParameters,
    execution: Execution,
) -> SpecFileMergeOutputs:
    """
    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 = SpecFileMergeOutputs(
        root=execution.output_file("."),
    )
    return ret


def spec_file_merge_execute(
    params: SpecFileMergeParameters,
    runner: Runner | None = None,
) -> SpecFileMergeOutputs:
    """
    spec-file-merge
    
    Merge two spec files into one.
    
    The output spec file contains every file that is in either of the input spec
    files.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SpecFileMergeOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SPEC_FILE_MERGE_METADATA)
    params = execution.params(params)
    cargs = spec_file_merge_cargs(params, execution)
    ret = spec_file_merge_outputs(params, execution)
    execution.run(cargs)
    return ret


def spec_file_merge(
    spec_1: str,
    spec_2: str,
    out_spec: str,
    runner: Runner | None = None,
) -> SpecFileMergeOutputs:
    """
    spec-file-merge
    
    Merge two spec files into one.
    
    The output spec file contains every file that is in either of the input spec
    files.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        spec_1: first spec file to merge.
        spec_2: second spec file to merge.
        out_spec: output - output spec file.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SpecFileMergeOutputs`).
    """
    params = spec_file_merge_params(
        spec_1=spec_1,
        spec_2=spec_2,
        out_spec=out_spec,
    )
    return spec_file_merge_execute(params, runner)


__all__ = [
    "SPEC_FILE_MERGE_METADATA",
    "SpecFileMergeOutputs",
    "spec_file_merge",
    "spec_file_merge_execute",
    "spec_file_merge_params",
]
