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

import typing
import pathlib
from styxdefs import *

SURFACE_SPHERE_TRIANGULAR_PATCHES_METADATA = Metadata(
    id="cb66e6f1207807e8529312a550ed72acdff594ee.boutiques",
    name="surface-sphere-triangular-patches",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


SurfaceSphereTriangularPatchesParameters = typing.TypedDict('SurfaceSphereTriangularPatchesParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/surface-sphere-triangular-patches"]],
    "sphere": InputPathType,
    "divisions": int,
    "text_out": str,
})
SurfaceSphereTriangularPatchesParametersTagged = typing.TypedDict('SurfaceSphereTriangularPatchesParametersTagged', {
    "@type": typing.Literal["workbench/surface-sphere-triangular-patches"],
    "sphere": InputPathType,
    "divisions": int,
    "text_out": str,
})


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


def surface_sphere_triangular_patches_params(
    sphere: InputPathType,
    divisions: int,
    text_out: str,
) -> SurfaceSphereTriangularPatchesParametersTagged:
    """
    Build parameters.
    
    Args:
        sphere: an undistorted, regularly divided icosahedral sphere.
        divisions: how many pieces to divide each icosahedral edge into, must\
            divide perfectly into the given sphere.
        text_out: output - text file for the vertex numbers of the patches.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/surface-sphere-triangular-patches",
        "sphere": sphere,
        "divisions": divisions,
        "text_out": text_out,
    }
    return params


def surface_sphere_triangular_patches_cargs(
    params: SurfaceSphereTriangularPatchesParameters,
    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-sphere-triangular-patches")
    cargs.append(execution.input_file(params.get("sphere", None)))
    cargs.append(str(params.get("divisions", None)))
    cargs.append(params.get("text_out", None))
    return cargs


def surface_sphere_triangular_patches_outputs(
    params: SurfaceSphereTriangularPatchesParameters,
    execution: Execution,
) -> SurfaceSphereTriangularPatchesOutputs:
    """
    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 = SurfaceSphereTriangularPatchesOutputs(
        root=execution.output_file("."),
    )
    return ret


def surface_sphere_triangular_patches_execute(
    params: SurfaceSphereTriangularPatchesParameters,
    runner: Runner | None = None,
) -> SurfaceSphereTriangularPatchesOutputs:
    """
    surface-sphere-triangular-patches
    
    Divide standard sphere into patches.
    
    Divide the given undistorted sphere into equally-sized triangular patches.
    Patches overlap by a border of 1 vertex.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceSphereTriangularPatchesOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SURFACE_SPHERE_TRIANGULAR_PATCHES_METADATA)
    params = execution.params(params)
    cargs = surface_sphere_triangular_patches_cargs(params, execution)
    ret = surface_sphere_triangular_patches_outputs(params, execution)
    execution.run(cargs)
    return ret


def surface_sphere_triangular_patches(
    sphere: InputPathType,
    divisions: int,
    text_out: str,
    runner: Runner | None = None,
) -> SurfaceSphereTriangularPatchesOutputs:
    """
    surface-sphere-triangular-patches
    
    Divide standard sphere into patches.
    
    Divide the given undistorted sphere into equally-sized triangular patches.
    Patches overlap by a border of 1 vertex.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        sphere: an undistorted, regularly divided icosahedral sphere.
        divisions: how many pieces to divide each icosahedral edge into, must\
            divide perfectly into the given sphere.
        text_out: output - text file for the vertex numbers of the patches.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceSphereTriangularPatchesOutputs`).
    """
    params = surface_sphere_triangular_patches_params(
        sphere=sphere,
        divisions=divisions,
        text_out=text_out,
    )
    return surface_sphere_triangular_patches_execute(params, runner)


__all__ = [
    "SURFACE_SPHERE_TRIANGULAR_PATCHES_METADATA",
    "SurfaceSphereTriangularPatchesOutputs",
    "surface_sphere_triangular_patches",
    "surface_sphere_triangular_patches_execute",
    "surface_sphere_triangular_patches_params",
]
