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

import typing
import pathlib
from styxdefs import *

SPEC_FILE_RELOCATE_METADATA = Metadata(
    id="749f2233af5a8f3e4bd24c29117982578dc8bf47.boutiques",
    name="spec-file-relocate",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


SpecFileRelocateParameters = typing.TypedDict('SpecFileRelocateParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/spec-file-relocate"]],
    "input_spec": str,
    "output_spec": str,
})
SpecFileRelocateParametersTagged = typing.TypedDict('SpecFileRelocateParametersTagged', {
    "@type": typing.Literal["workbench/spec-file-relocate"],
    "input_spec": str,
    "output_spec": str,
})


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


def spec_file_relocate_params(
    input_spec: str,
    output_spec: str,
) -> SpecFileRelocateParametersTagged:
    """
    Build parameters.
    
    Args:
        input_spec: the spec file to use.
        output_spec: output - the new spec file to create.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/spec-file-relocate",
        "input_spec": input_spec,
        "output_spec": output_spec,
    }
    return params


def spec_file_relocate_cargs(
    params: SpecFileRelocateParameters,
    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-relocate")
    cargs.append(params.get("input_spec", None))
    cargs.append(params.get("output_spec", None))
    return cargs


def spec_file_relocate_outputs(
    params: SpecFileRelocateParameters,
    execution: Execution,
) -> SpecFileRelocateOutputs:
    """
    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 = SpecFileRelocateOutputs(
        root=execution.output_file("."),
    )
    return ret


def spec_file_relocate_execute(
    params: SpecFileRelocateParameters,
    runner: Runner | None = None,
) -> SpecFileRelocateOutputs:
    """
    spec-file-relocate
    
    Recreate spec file in new location.
    
    Spec files contain internal relative paths, such that moving or copying a
    spec file will cause it to lose track of the files it refers to. This
    command makes a modified copy of the spec file, changing the relative paths
    to refer to the new relative locations of the 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 `SpecFileRelocateOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SPEC_FILE_RELOCATE_METADATA)
    params = execution.params(params)
    cargs = spec_file_relocate_cargs(params, execution)
    ret = spec_file_relocate_outputs(params, execution)
    execution.run(cargs)
    return ret


def spec_file_relocate(
    input_spec: str,
    output_spec: str,
    runner: Runner | None = None,
) -> SpecFileRelocateOutputs:
    """
    spec-file-relocate
    
    Recreate spec file in new location.
    
    Spec files contain internal relative paths, such that moving or copying a
    spec file will cause it to lose track of the files it refers to. This
    command makes a modified copy of the spec file, changing the relative paths
    to refer to the new relative locations of the files.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        input_spec: the spec file to use.
        output_spec: output - the new spec file to create.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SpecFileRelocateOutputs`).
    """
    params = spec_file_relocate_params(
        input_spec=input_spec,
        output_spec=output_spec,
    )
    return spec_file_relocate_execute(params, runner)


__all__ = [
    "SPEC_FILE_RELOCATE_METADATA",
    "SpecFileRelocateOutputs",
    "spec_file_relocate",
    "spec_file_relocate_execute",
    "spec_file_relocate_params",
]
