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

import typing
import pathlib
from styxdefs import *
import dataclasses

V__PARSE_AFNI_NAME_METADATA = Metadata(
    id="12d1dff851d7fa23b8eb242b2486503f1c1932d3.boutiques",
    name="@parse_afni_name",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class VParseAfniNameOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v__parse_afni_name(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_path: OutputPathType
    """Output path parsed from the AFNI name"""
    output_prefix: OutputPathType
    """Output prefix parsed from the AFNI name"""
    output_view: OutputPathType
    """Output view parsed from the AFNI name"""
    output_subbrick: OutputPathType
    """Output sub-brick selection string parsed from the AFNI name"""


def v__parse_afni_name(
    afni_name: str,
    runner: Runner | None = None,
) -> VParseAfniNameOutputs:
    """
    A script to parse an AFNI name, outputting the path, prefix, view, and sub-brick
    selection string.
    
    Author: AFNI Team
    
    URL:
    https://afni.nimh.nih.gov/pub/dist/doc/program_help/@parse_afni_name.html
    
    Args:
        afni_name: The AFNI name to be parsed.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `VParseAfniNameOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V__PARSE_AFNI_NAME_METADATA)
    cargs = []
    cargs.append("@parse_afni_name")
    cargs.append(afni_name)
    ret = VParseAfniNameOutputs(
        root=execution.output_file("."),
        output_path=execution.output_file("parsed_name_path.txt"),
        output_prefix=execution.output_file("parsed_name_prefix.txt"),
        output_view=execution.output_file("parsed_name_view.txt"),
        output_subbrick=execution.output_file("parsed_name_subbrick.txt"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "VParseAfniNameOutputs",
    "V__PARSE_AFNI_NAME_METADATA",
    "v__parse_afni_name",
]
