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

import typing
import pathlib
from styxdefs import *

SURFACE_VERTEX_AREAS_METADATA = Metadata(
    id="2ce95b755322be2b857b320aad4cfef1152d88c0.boutiques",
    name="surface-vertex-areas",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


SurfaceVertexAreasParameters = typing.TypedDict('SurfaceVertexAreasParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/surface-vertex-areas"]],
    "surface": InputPathType,
    "metric": str,
})
SurfaceVertexAreasParametersTagged = typing.TypedDict('SurfaceVertexAreasParametersTagged', {
    "@type": typing.Literal["workbench/surface-vertex-areas"],
    "surface": InputPathType,
    "metric": str,
})


class SurfaceVertexAreasOutputs(typing.NamedTuple):
    """
    Output object returned when calling `SurfaceVertexAreasParameters(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    metric: OutputPathType
    """the output metric"""


def surface_vertex_areas_params(
    surface: InputPathType,
    metric: str,
) -> SurfaceVertexAreasParametersTagged:
    """
    Build parameters.
    
    Args:
        surface: the surface to measure.
        metric: the output metric.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/surface-vertex-areas",
        "surface": surface,
        "metric": metric,
    }
    return params


def surface_vertex_areas_cargs(
    params: SurfaceVertexAreasParameters,
    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-vertex-areas")
    cargs.append(execution.input_file(params.get("surface", None)))
    cargs.append(params.get("metric", None))
    return cargs


def surface_vertex_areas_outputs(
    params: SurfaceVertexAreasParameters,
    execution: Execution,
) -> SurfaceVertexAreasOutputs:
    """
    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 = SurfaceVertexAreasOutputs(
        root=execution.output_file("."),
        metric=execution.output_file(params.get("metric", None)),
    )
    return ret


def surface_vertex_areas_execute(
    params: SurfaceVertexAreasParameters,
    runner: Runner | None = None,
) -> SurfaceVertexAreasOutputs:
    """
    surface-vertex-areas
    
    Measure surface area each vertex is responsible for.
    
    Each vertex gets one third of the area of each triangle it is a part of.
    Units are mm^2.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceVertexAreasOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SURFACE_VERTEX_AREAS_METADATA)
    params = execution.params(params)
    cargs = surface_vertex_areas_cargs(params, execution)
    ret = surface_vertex_areas_outputs(params, execution)
    execution.run(cargs)
    return ret


def surface_vertex_areas(
    surface: InputPathType,
    metric: str,
    runner: Runner | None = None,
) -> SurfaceVertexAreasOutputs:
    """
    surface-vertex-areas
    
    Measure surface area each vertex is responsible for.
    
    Each vertex gets one third of the area of each triangle it is a part of.
    Units are mm^2.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        surface: the surface to measure.
        metric: the output metric.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceVertexAreasOutputs`).
    """
    params = surface_vertex_areas_params(
        surface=surface,
        metric=metric,
    )
    return surface_vertex_areas_execute(params, runner)


__all__ = [
    "SURFACE_VERTEX_AREAS_METADATA",
    "SurfaceVertexAreasOutputs",
    "surface_vertex_areas",
    "surface_vertex_areas_execute",
    "surface_vertex_areas_params",
]
