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

import typing
import pathlib
from styxdefs import *

SURFACE_NORMALS_METADATA = Metadata(
    id="a04e63a81424932a907bb5d57ff1d5439a7a29aa.boutiques",
    name="surface-normals",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


SurfaceNormalsParameters = typing.TypedDict('SurfaceNormalsParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/surface-normals"]],
    "surface": InputPathType,
    "metric_out": str,
})
SurfaceNormalsParametersTagged = typing.TypedDict('SurfaceNormalsParametersTagged', {
    "@type": typing.Literal["workbench/surface-normals"],
    "surface": InputPathType,
    "metric_out": str,
})


class SurfaceNormalsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `SurfaceNormalsParameters(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    metric_out: OutputPathType
    """the normal vectors"""


def surface_normals_params(
    surface: InputPathType,
    metric_out: str,
) -> SurfaceNormalsParametersTagged:
    """
    Build parameters.
    
    Args:
        surface: the surface to output the normals of.
        metric_out: the normal vectors.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/surface-normals",
        "surface": surface,
        "metric_out": metric_out,
    }
    return params


def surface_normals_cargs(
    params: SurfaceNormalsParameters,
    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("-surface-normals")
    cargs.append(execution.input_file(params.get("surface", None)))
    cargs.append(params.get("metric_out", None))
    return cargs


def surface_normals_outputs(
    params: SurfaceNormalsParameters,
    execution: Execution,
) -> SurfaceNormalsOutputs:
    """
    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 = SurfaceNormalsOutputs(
        root=execution.output_file("."),
        metric_out=execution.output_file(params.get("metric_out", None)),
    )
    return ret


def surface_normals_execute(
    params: SurfaceNormalsParameters,
    runner: Runner | None = None,
) -> SurfaceNormalsOutputs:
    """
    surface-normals
    
    Output vertex normals as metric file.
    
    Computes the normal vectors of the surface file, and outputs them as a 3
    column metric file.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceNormalsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SURFACE_NORMALS_METADATA)
    params = execution.params(params)
    cargs = surface_normals_cargs(params, execution)
    ret = surface_normals_outputs(params, execution)
    execution.run(cargs)
    return ret


def surface_normals(
    surface: InputPathType,
    metric_out: str,
    runner: Runner | None = None,
) -> SurfaceNormalsOutputs:
    """
    surface-normals
    
    Output vertex normals as metric file.
    
    Computes the normal vectors of the surface file, and outputs them as a 3
    column metric file.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        surface: the surface to output the normals of.
        metric_out: the normal vectors.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceNormalsOutputs`).
    """
    params = surface_normals_params(
        surface=surface,
        metric_out=metric_out,
    )
    return surface_normals_execute(params, runner)


__all__ = [
    "SURFACE_NORMALS_METADATA",
    "SurfaceNormalsOutputs",
    "surface_normals",
    "surface_normals_execute",
    "surface_normals_params",
]
