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

import typing
import pathlib
from styxdefs import *
import dataclasses

INSPEC_METADATA = Metadata(
    id="8b4982198616126758279eb8952fb78096cd1ed7.boutiques",
    name="inspec",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


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


def inspec(
    specfile: InputPathType,
    newspecname: str | None = None,
    detail: float | None = None,
    leftspec: InputPathType | None = None,
    rightspec: InputPathType | None = None,
    state_rm: str | None = None,
    help_: bool = False,
    runner: Runner | None = None,
) -> InspecOutputs:
    """
    Outputs information found from specfile.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/inspec.html
    
    Args:
        specfile: Spec file to be read.
        newspecname: Rewrite spec file.
        detail: Level of output detail. Default is 1 in general, 0 with\
            -LRmerge. Available levels are 0, 1, 2, and 3.
        leftspec: Merge two spec files in a way that makes sense for viewing in\
            SUMA.
        rightspec: Merge two spec files in a way that makes sense for viewing\
            in SUMA.
        state_rm: Get rid of state STATE_RM from the specfile.
        help_: Display help message.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `InspecOutputs`).
    """
    if detail is not None and not (0 <= detail <= 3): 
        raise ValueError(f"'detail' must be between 0 <= x <= 3 but was {detail}")
    runner = runner or get_global_runner()
    execution = runner.start_execution(INSPEC_METADATA)
    cargs = []
    cargs.append("inspec")
    cargs.extend([
        "-spec",
        execution.input_file(specfile)
    ])
    if newspecname is not None:
        cargs.extend([
            "-prefix",
            newspecname
        ])
    if detail is not None:
        cargs.extend([
            "-detail",
            str(detail)
        ])
    if leftspec is not None:
        cargs.extend([
            "-LRmerge",
            execution.input_file(leftspec)
        ])
    if rightspec is not None:
        cargs.extend([
            "-LRmerge",
            execution.input_file(rightspec)
        ])
    if state_rm is not None:
        cargs.extend([
            "-remove_state",
            state_rm
        ])
    if help_:
        cargs.append("-help")
    ret = InspecOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "INSPEC_METADATA",
    "InspecOutputs",
    "inspec",
]
