"""
    Global.Options.py
"""

GLOBAL_OPTIONS = dict(
    mapped_trimming = True,
    flowchange = False,
    developer_mode = False,
    elution_recognition = 'icurve',
)

def set_molass_options(**kwargs):
    """Set global options for molass.

    Parameters
    ----------
    mapped_trimming : bool, optional
        Whether to perform mapped trimming. Default is True.
        See :func:`molass.Trimming.TrimmingUtils.make_mapped_trimming_info` for details.
    flowchange : bool or str, optional
        Whether to consider flow change. Default is False.
        If a string is given and equal to 'auto', flow change will be considered
        according to the beamline info of input data as follows.

        - If the beamline name starts with "PF", flow change will be considered.
        - Otherwise, flow change will not be considered.
    developer_mode : bool, optional
        Whether to enable developer mode. Default is False.
    elution_recognition : str, optional
        Which elution curve to use for peak detection and buffer-frame
        classification.  Default is ``'icurve'`` (single row at q≈0.02,
        current behaviour).  Set to ``'sum'`` to use the sum over all
        (trimmed) q-rows, which is more robust when baseline drift is
        q-dependent (e.g. MY-type datasets).
    kwargs : dict
        Other options to set.
    """
    for key, value in kwargs.items():
        try:
            v = GLOBAL_OPTIONS[key]
        except:
            raise ValueError("No such global option: %s" % key)
        GLOBAL_OPTIONS[key] = value

def get_molass_options(*args):
    """Get global options for molass.

    Parameters
    ----------
    args : str
        The names of the options to get.
        The options are:

        - 'mapped_trimming': Whether to perform mapped trimming.
        - 'flowchange': Whether to consider flow change.
        - 'developer_mode': Whether to enable developer mode.
        - 'elution_recognition': Which elution curve to use for recognition
          (``'icurve'`` or ``'sum'``).
    Returns
    -------
    dict
        The values of the requested options.
    """
    if len(args) == 1:
        return GLOBAL_OPTIONS[args[0]]
    else:
        return [GLOBAL_OPTIONS[key] for key in args]