from typing import Dict
from typing import Any
from typing import OrderedDict


def parse_dict_flat(dictionary: Dict) -> Any:
    """Parse flat dictionary.

    Parameters
    ----------
    dictionary
        The dictionary to parse like:
            {'variable': [value, comment, block], ...}.

    Returns
    -------
    date_time : datetime.datetime
    header : list
    block_names : list
    (variables, values, comments, blocks) : Tuple[str, Any, str, str]
    """
    blocks = list()
    variables = list()
    values = list()
    comments = list()

    header = None
    date_time = None

    for key, item in dictionary.items():
        if key == '__header__':
            header = item
        elif key == '__datetime__':
            date_time = item
        else:
            var = key
            val = item[0]
            comment = item[1]
            block = item[2]
            variables.append(var)
            values.append(val)
            comments.append(comment)
            blocks.append(block)

    block_names = list(OrderedDict.fromkeys(blocks))

    return date_time, header, block_names, (variables, values, comments, blocks)