from pathlib import Path
import json


def auxiliary(frm, alph):
    """
    Retrieve appropriate auxiliaries

    Parameters
    ----------
    frm : str
        A string used to determine the formality
    alph : str
        A string used to determine the type of alphabet

    Returns
    -------
    list
        a list of auxiliaries
    """
    dir_path = Path(__file__).parents[0]
    path = f'{dir_path}/data/irregulars.json'

    # load irregulars and conjugations files
    with open(path, 'r', encoding='utf-8') as file:
        data = json.load(file)
    # retrieve past perfect auxiliary
    prf_aux = data['بودن']['paradigm'][frm][alph]['affirmative']['past']['simple']
    # retrieve past subjunctive auxiliary
    sub_aux = data['بودن']['paradigm'][frm][alph]['affirmative']['present']['subjunctive']
    # retrieve present progressive auxiliary
    prg_prs_aux = data['داشتن']['paradigm'][frm][alph]['affirmative']['present']['simple']
    # retrieve past progressive auxiliary
    prg_pst_aux = data['داشتن']['paradigm'][frm][alph]['affirmative']['past']['simple']
    # retrieve future auxiliary
    ftr_aux = data['خواستن']['paradigm'][frm][alph]['affirmative']['present']['simple']
    return [prf_aux, sub_aux, prg_prs_aux, prg_pst_aux, ftr_aux]