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

import typing
import pathlib
from styxdefs import *
import dataclasses

WHIRLGIF_METADATA = Metadata(
    id="e4c0871988c7cdc7bddc466fe2124de7c556f8a7.boutiques",
    name="whirlgif",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class WhirlgifOutputs(typing.NamedTuple):
    """
    Output object returned when calling `whirlgif(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_gif: OutputPathType | None
    """The output GIF file"""


def whirlgif(
    gif_files: list[InputPathType],
    verbose: bool = False,
    loop: str | None = None,
    transparency_index: float | None = None,
    inter_frame_delay: float | None = None,
    outfile: str | None = None,
    infile: InputPathType | None = None,
    runner: Runner | None = None,
) -> WhirlgifOutputs:
    """
    A quick program that reads a series of GIF files and produces a single GIF file
    composed of those images.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        gif_files: Input GIF files to be combined into a single GIF file.
        verbose: Verbose mode.
        loop: Add the Netscape 'loop' extension. Optionally specify a loop\
            count.
        transparency_index: Set the colormap index 'index' to be transparent.
        inter_frame_delay: Inter-frame timing delay.
        outfile: Specify the output file to write the results to.
        infile: Read a list of filenames from a file.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `WhirlgifOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(WHIRLGIF_METADATA)
    cargs = []
    cargs.append("whirlgif")
    if verbose:
        cargs.append("-v")
    if loop is not None:
        cargs.extend([
            "-loop",
            loop
        ])
    if transparency_index is not None:
        cargs.extend([
            "-trans",
            str(transparency_index)
        ])
    if inter_frame_delay is not None:
        cargs.extend([
            "-time",
            str(inter_frame_delay)
        ])
    if outfile is not None:
        cargs.extend([
            "-o",
            outfile
        ])
    if infile is not None:
        cargs.extend([
            "-i",
            execution.input_file(infile)
        ])
    cargs.extend([execution.input_file(f) for f in gif_files])
    ret = WhirlgifOutputs(
        root=execution.output_file("."),
        output_gif=execution.output_file(outfile) if (outfile is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "WHIRLGIF_METADATA",
    "WhirlgifOutputs",
    "whirlgif",
]
