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

import typing
import pathlib
from styxdefs import *

BORDER_EXPORT_COLOR_TABLE_METADATA = Metadata(
    id="c4fae465526913da9084677d6ed578ea3f03a993.boutiques",
    name="border-export-color-table",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


BorderExportColorTableParameters = typing.TypedDict('BorderExportColorTableParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/border-export-color-table"]],
    "border_file": InputPathType,
    "table_out": str,
    "opt_class_colors": bool,
})
BorderExportColorTableParametersTagged = typing.TypedDict('BorderExportColorTableParametersTagged', {
    "@type": typing.Literal["workbench/border-export-color-table"],
    "border_file": InputPathType,
    "table_out": str,
    "opt_class_colors": bool,
})


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


def border_export_color_table_params(
    border_file: InputPathType,
    table_out: str,
    opt_class_colors: bool = False,
) -> BorderExportColorTableParametersTagged:
    """
    Build parameters.
    
    Args:
        border_file: the input border file.
        table_out: output - the output text file.
        opt_class_colors: use class colors instead of the name colors.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/border-export-color-table",
        "border_file": border_file,
        "table_out": table_out,
        "opt_class_colors": opt_class_colors,
    }
    return params


def border_export_color_table_cargs(
    params: BorderExportColorTableParameters,
    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("-border-export-color-table")
    cargs.append(execution.input_file(params.get("border_file", None)))
    cargs.append(params.get("table_out", None))
    if params.get("opt_class_colors", False):
        cargs.append("-class-colors")
    return cargs


def border_export_color_table_outputs(
    params: BorderExportColorTableParameters,
    execution: Execution,
) -> BorderExportColorTableOutputs:
    """
    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 = BorderExportColorTableOutputs(
        root=execution.output_file("."),
    )
    return ret


def border_export_color_table_execute(
    params: BorderExportColorTableParameters,
    runner: Runner | None = None,
) -> BorderExportColorTableOutputs:
    """
    border-export-color-table
    
    Write border names and colors as text.
    
    Takes the names and colors of each border, and writes it to the same format
    as -metric-label-import expects. By default, the borders are colored by
    border name, specify -class-colors to color them by class instead. The key
    values start at 1 and follow the order of the borders in the 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 `BorderExportColorTableOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(BORDER_EXPORT_COLOR_TABLE_METADATA)
    params = execution.params(params)
    cargs = border_export_color_table_cargs(params, execution)
    ret = border_export_color_table_outputs(params, execution)
    execution.run(cargs)
    return ret


def border_export_color_table(
    border_file: InputPathType,
    table_out: str,
    opt_class_colors: bool = False,
    runner: Runner | None = None,
) -> BorderExportColorTableOutputs:
    """
    border-export-color-table
    
    Write border names and colors as text.
    
    Takes the names and colors of each border, and writes it to the same format
    as -metric-label-import expects. By default, the borders are colored by
    border name, specify -class-colors to color them by class instead. The key
    values start at 1 and follow the order of the borders in the file.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        border_file: the input border file.
        table_out: output - the output text file.
        opt_class_colors: use class colors instead of the name colors.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `BorderExportColorTableOutputs`).
    """
    params = border_export_color_table_params(
        border_file=border_file,
        table_out=table_out,
        opt_class_colors=opt_class_colors,
    )
    return border_export_color_table_execute(params, runner)


__all__ = [
    "BORDER_EXPORT_COLOR_TABLE_METADATA",
    "BorderExportColorTableOutputs",
    "border_export_color_table",
    "border_export_color_table_execute",
    "border_export_color_table_params",
]
