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

import typing
import pathlib
from styxdefs import *
import dataclasses

PLUGOUT_IJK_METADATA = Metadata(
    id="546af73f34fcb7f296f73da1cc63ae4ec231fec2.boutiques",
    name="plugout_ijk",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


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


def plugout_ijk(
    host: str | None = None,
    verbose: bool = False,
    port: float | None = None,
    name: str | None = None,
    port_offset: float | None = None,
    port_quiet: float | None = None,
    port_bloc_offset: float | None = None,
    max_bloc: bool = False,
    max_bloc_quiet: bool = False,
    num_assigned_ports: bool = False,
    num_assigned_ports_quiet: bool = False,
    runner: Runner | None = None,
) -> PlugoutIjkOutputs:
    """
    Connects to AFNI and sends (i,j,k) dataset indices to control the viewpoint.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        host: Connect to AFNI running on the specified computer using TCP/IP.
        verbose: Verbose mode.
        port: Use TCP/IP port number 'pp'.
        name: Use the string 'sss' for the name that AFNI assigns to this\
            plugout.
        port_offset: Provide a port offset to allow multiple instances of\
            communicating programs to operate on the same machine.
        port_quiet: Provide a port offset like -np, but more quiet in the face\
            of adversity.
        port_bloc_offset: Provide a port offset block for easier port\
            management.
        max_bloc: Print the current value of MAX_BLOC and exit.
        max_bloc_quiet: Print MAX_BLOC value only and exit.
        num_assigned_ports: Print the number of assigned ports used by AFNI\
            then quit.
        num_assigned_ports_quiet: Prints the number of assigned ports quietly.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `PlugoutIjkOutputs`).
    """
    if port_offset is not None and not (1025 <= port_offset <= 65500): 
        raise ValueError(f"'port_offset' must be between 1025 <= x <= 65500 but was {port_offset}")
    if port_bloc_offset is not None and not (port_bloc_offset <= 4000): 
        raise ValueError(f"'port_bloc_offset' must be less than x <= 4000 but was {port_bloc_offset}")
    runner = runner or get_global_runner()
    execution = runner.start_execution(PLUGOUT_IJK_METADATA)
    cargs = []
    cargs.append("plugout_ijk")
    if host is not None:
        cargs.extend([
            "-host",
            host
        ])
    if verbose:
        cargs.append("-v")
    if port is not None:
        cargs.extend([
            "-port",
            str(port)
        ])
    if name is not None:
        cargs.extend([
            "-name",
            name
        ])
    if port_offset is not None:
        cargs.extend([
            "-np",
            str(port_offset)
        ])
    if port_quiet is not None:
        cargs.extend([
            "-npq",
            str(port_quiet)
        ])
    if port_bloc_offset is not None:
        cargs.extend([
            "-npb",
            str(port_bloc_offset)
        ])
    if max_bloc:
        cargs.append("-max_port_bloc")
    if max_bloc_quiet:
        cargs.append("-max_port_bloc_quiet")
    if num_assigned_ports:
        cargs.append("-num_assigned_ports")
    if num_assigned_ports_quiet:
        cargs.append("-num_assigned_ports_quiet")
    ret = PlugoutIjkOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "PLUGOUT_IJK_METADATA",
    "PlugoutIjkOutputs",
    "plugout_ijk",
]
