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

import typing
import pathlib
from styxdefs import *

GIFTI_CONVERT_METADATA = Metadata(
    id="00ca05307d704bb4b72ca8d609e922d80aac69c0.boutiques",
    name="gifti-convert",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


GiftiConvertParameters = typing.TypedDict('GiftiConvertParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/gifti-convert"]],
    "gifti_encoding": str,
    "input_gifti_file": str,
    "output_gifti_file": str,
})
GiftiConvertParametersTagged = typing.TypedDict('GiftiConvertParametersTagged', {
    "@type": typing.Literal["workbench/gifti-convert"],
    "gifti_encoding": str,
    "input_gifti_file": str,
    "output_gifti_file": str,
})


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


def gifti_convert_params(
    gifti_encoding: str,
    input_gifti_file: str,
    output_gifti_file: str,
) -> GiftiConvertParametersTagged:
    """
    Build parameters.
    
    Args:
        gifti_encoding: what the output encoding should be.
        input_gifti_file: the input gifti file.
        output_gifti_file: output - the output gifti file.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/gifti-convert",
        "gifti_encoding": gifti_encoding,
        "input_gifti_file": input_gifti_file,
        "output_gifti_file": output_gifti_file,
    }
    return params


def gifti_convert_cargs(
    params: GiftiConvertParameters,
    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("-gifti-convert")
    cargs.append(params.get("gifti_encoding", None))
    cargs.append(params.get("input_gifti_file", None))
    cargs.append(params.get("output_gifti_file", None))
    return cargs


def gifti_convert_outputs(
    params: GiftiConvertParameters,
    execution: Execution,
) -> GiftiConvertOutputs:
    """
    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 = GiftiConvertOutputs(
        root=execution.output_file("."),
    )
    return ret


def gifti_convert_execute(
    params: GiftiConvertParameters,
    runner: Runner | None = None,
) -> GiftiConvertOutputs:
    """
    gifti-convert
    
    Convert a gifti file to a different encoding.
    
    The value of <gifti-encoding> must be one of the following:
    
    ASCII
    BASE64_BINARY
    GZIP_BASE64_BINARY
    EXTERNAL_FILE_BINARY.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `GiftiConvertOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(GIFTI_CONVERT_METADATA)
    params = execution.params(params)
    cargs = gifti_convert_cargs(params, execution)
    ret = gifti_convert_outputs(params, execution)
    execution.run(cargs)
    return ret


def gifti_convert(
    gifti_encoding: str,
    input_gifti_file: str,
    output_gifti_file: str,
    runner: Runner | None = None,
) -> GiftiConvertOutputs:
    """
    gifti-convert
    
    Convert a gifti file to a different encoding.
    
    The value of <gifti-encoding> must be one of the following:
    
    ASCII
    BASE64_BINARY
    GZIP_BASE64_BINARY
    EXTERNAL_FILE_BINARY.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        gifti_encoding: what the output encoding should be.
        input_gifti_file: the input gifti file.
        output_gifti_file: output - the output gifti file.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `GiftiConvertOutputs`).
    """
    params = gifti_convert_params(
        gifti_encoding=gifti_encoding,
        input_gifti_file=input_gifti_file,
        output_gifti_file=output_gifti_file,
    )
    return gifti_convert_execute(params, runner)


__all__ = [
    "GIFTI_CONVERT_METADATA",
    "GiftiConvertOutputs",
    "gifti_convert",
    "gifti_convert_execute",
    "gifti_convert_params",
]
