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

import typing
import pathlib
from styxdefs import *
import dataclasses

ABIDS_JSON_INFO_PY_METADATA = Metadata(
    id="29b15b0c3b3b92b7936e8e79bd8f79411f0e65a4.boutiques",
    name="abids_json_info.py",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


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


def abids_json_info_py(
    json_files: list[InputPathType],
    tr_flag: bool = False,
    te_flag: bool = False,
    te_sec_flag: bool = False,
    match_nii_flag: bool = False,
    field_list: list[str] | None = None,
    list_fields_flag: bool = False,
    help_flag: bool = False,
    runner: Runner | None = None,
) -> AbidsJsonInfoPyOutputs:
    """
    A tool to extract information from BIDS formatted json files.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        json_files: Specify .json file(s).
        tr_flag: Print the TR from the json file in seconds, from the\
            'RepetitionTime' field.
        te_flag: Print out the 'EchoTime' field in milliseconds (the json file\
            stores it in seconds).
        te_sec_flag: Print the 'EchoTime' field in seconds.
        match_nii_flag: Check if there is a .nii or .nii.gz file that matches\
            the .json file (1 if the dataset is loadable).
        field_list: Print any field or list of fields from the json file.
        list_fields_flag: Print a list of the available fields from the .json\
            file. This must be the only argument specified.
        help_flag: Show this help message and exit.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `AbidsJsonInfoPyOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(ABIDS_JSON_INFO_PY_METADATA)
    cargs = []
    cargs.append("abids_json_info.py")
    cargs.extend([execution.input_file(f) for f in json_files])
    if tr_flag:
        cargs.append("-TR")
    if te_flag:
        cargs.append("-TE")
    if te_sec_flag:
        cargs.append("-TE_sec")
    if match_nii_flag:
        cargs.append("-match_nii")
    if field_list is not None:
        cargs.extend([
            "-field",
            *field_list
        ])
    if list_fields_flag:
        cargs.append("-list_fields")
    if help_flag:
        cargs.append("-help")
    ret = AbidsJsonInfoPyOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "ABIDS_JSON_INFO_PY_METADATA",
    "AbidsJsonInfoPyOutputs",
    "abids_json_info_py",
]
