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

import typing
import pathlib
from styxdefs import *
import dataclasses

FSL_MRS_SIM_METADATA = Metadata(
    id="d8751192080281b952d5e68a6abe3ed8ca8d7fdd.boutiques",
    name="fsl_mrs_sim",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class FslMrsSimOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fsl_mrs_sim(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    generated_output: OutputPathType | None
    """Generated output files based on provided parameters"""


def fsl_mrs_sim(
    sequence_file: InputPathType,
    metab: str,
    metab_file: InputPathType,
    custom_spinsys: InputPathType,
    output_folder: str | None = None,
    raw_flag: bool = False,
    jmru_flag: bool = False,
    addref_flag: bool = False,
    autophase_ppm: float | None = None,
    lcm_loc: str | None = None,
    mm_json: InputPathType | None = None,
    output_te: float | None = None,
    overwrite_flag: bool = False,
    verbose_flag: bool = False,
    runner: Runner | None = None,
) -> FslMrsSimOutputs:
    """
    FSL Magnetic Resonance Spectroscopy Simulation Tool.
    
    Author: FSL
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/fsl_mrs
    
    Args:
        sequence_file: Pulse sequence file or previous results file.
        metab: Single metabolite string.
        metab_file: Path to file containing metabolite list for batch\
            simulation.
        custom_spinsys: Path to JSON file containing custom spin systems.
        output_folder: Output folder.
        raw_flag: Output LCModel Style Raw files.
        jmru_flag: Output jMRUI Style txt files.
        addref_flag: Add 0 ppm reference to all outputs.
        autophase_ppm: Simulate a singlet peak at <ppm> to auto-phase the basis\
            spectra. Relative to receiver central frequency.
        lcm_loc: Location to enter into lcm IN file.
        mm_json: JSON file containing MM FID to add to the basis output.
        output_te: Echo time value in ms for output files (no effect on\
            simulation).
        overwrite_flag: Overwrite existing output folder.
        verbose_flag: Verbose output.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FslMrsSimOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FSL_MRS_SIM_METADATA)
    cargs = []
    cargs.append("fsl_mrs_sim")
    cargs.append(execution.input_file(sequence_file))
    cargs.extend([
        "-m",
        metab
    ])
    cargs.extend([
        "-b",
        execution.input_file(metab_file)
    ])
    cargs.extend([
        "-s",
        execution.input_file(custom_spinsys)
    ])
    if output_folder is not None:
        cargs.extend([
            "-o",
            output_folder
        ])
    if raw_flag:
        cargs.append("-r")
    if jmru_flag:
        cargs.append("-j")
    if addref_flag:
        cargs.append("-a")
    if autophase_ppm is not None:
        cargs.extend([
            "-p",
            str(autophase_ppm)
        ])
    if lcm_loc is not None:
        cargs.extend([
            "--lcmIN",
            lcm_loc
        ])
    if mm_json is not None:
        cargs.extend([
            "--MM",
            execution.input_file(mm_json)
        ])
    if output_te is not None:
        cargs.extend([
            "-e",
            str(output_te)
        ])
    if overwrite_flag:
        cargs.append("--overwrite")
    if verbose_flag:
        cargs.append("--verbose")
    ret = FslMrsSimOutputs(
        root=execution.output_file("."),
        generated_output=execution.output_file(output_folder + "/<generated_file>") if (output_folder is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FSL_MRS_SIM_METADATA",
    "FslMrsSimOutputs",
    "fsl_mrs_sim",
]
