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

import typing
import pathlib
from styxdefs import *

SURFACE_FLIP_LR_METADATA = Metadata(
    id="40cffc47a1b0a452d60871c5a8697c2aec5d0f41.boutiques",
    name="surface-flip-lr",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


SurfaceFlipLrParameters = typing.TypedDict('SurfaceFlipLrParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/surface-flip-lr"]],
    "surface": InputPathType,
    "surface_out": str,
})
SurfaceFlipLrParametersTagged = typing.TypedDict('SurfaceFlipLrParametersTagged', {
    "@type": typing.Literal["workbench/surface-flip-lr"],
    "surface": InputPathType,
    "surface_out": str,
})


class SurfaceFlipLrOutputs(typing.NamedTuple):
    """
    Output object returned when calling `SurfaceFlipLrParameters(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    surface_out: OutputPathType
    """the output flipped surface"""


def surface_flip_lr_params(
    surface: InputPathType,
    surface_out: str,
) -> SurfaceFlipLrParametersTagged:
    """
    Build parameters.
    
    Args:
        surface: the surface to flip.
        surface_out: the output flipped surface.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/surface-flip-lr",
        "surface": surface,
        "surface_out": surface_out,
    }
    return params


def surface_flip_lr_cargs(
    params: SurfaceFlipLrParameters,
    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-flip-lr")
    cargs.append(execution.input_file(params.get("surface", None)))
    cargs.append(params.get("surface_out", None))
    return cargs


def surface_flip_lr_outputs(
    params: SurfaceFlipLrParameters,
    execution: Execution,
) -> SurfaceFlipLrOutputs:
    """
    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 = SurfaceFlipLrOutputs(
        root=execution.output_file("."),
        surface_out=execution.output_file(params.get("surface_out", None)),
    )
    return ret


def surface_flip_lr_execute(
    params: SurfaceFlipLrParameters,
    runner: Runner | None = None,
) -> SurfaceFlipLrOutputs:
    """
    surface-flip-lr
    
    Mirror a surface through the yz plane.
    
    This command negates the x coordinate of each vertex, and flips the surface
    normals, so that you have a surface of opposite handedness with the same
    features and vertex correspondence, with normals consistent with the
    original surface. That is, if the input surface has normals facing outward,
    the output surface will also have normals facing outward.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceFlipLrOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SURFACE_FLIP_LR_METADATA)
    params = execution.params(params)
    cargs = surface_flip_lr_cargs(params, execution)
    ret = surface_flip_lr_outputs(params, execution)
    execution.run(cargs)
    return ret


def surface_flip_lr(
    surface: InputPathType,
    surface_out: str,
    runner: Runner | None = None,
) -> SurfaceFlipLrOutputs:
    """
    surface-flip-lr
    
    Mirror a surface through the yz plane.
    
    This command negates the x coordinate of each vertex, and flips the surface
    normals, so that you have a surface of opposite handedness with the same
    features and vertex correspondence, with normals consistent with the
    original surface. That is, if the input surface has normals facing outward,
    the output surface will also have normals facing outward.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        surface: the surface to flip.
        surface_out: the output flipped surface.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceFlipLrOutputs`).
    """
    params = surface_flip_lr_params(
        surface=surface,
        surface_out=surface_out,
    )
    return surface_flip_lr_execute(params, runner)


__all__ = [
    "SURFACE_FLIP_LR_METADATA",
    "SurfaceFlipLrOutputs",
    "surface_flip_lr",
    "surface_flip_lr_execute",
    "surface_flip_lr_params",
]
